Re: elementtree ProcessingInstructions

"Werner F. Bruhin" <[email protected]>
Newsgroups gmane.comp.python.xml
Message-ID <[email protected]>
Lars Marius Garshol wrote:

>
> * Werner F. Bruhin
> .....
>
>> I like it at the top of the file and not in the middle.  I was  starting
>> with a doc containing the root, but I think I am changing this in  which
>> case I could do this append as the first thing.
>
>
> Exactly. :)

But :-(  it does not work.

If I do this:
pi = et.ProcessingInstruction("twcb version=1.7;xsd=wineXML.xsd")
 >>> wine = et.Element('wine')
 >>> pi.append(wine)
 >>> et.dump(pi)
<?twcb version=1.7;xsd=wineXML.xsd?>

There is no "wine" element.

And if I do this:

 >>> wine = et.Element('wine')
 >>> wine.insert(0, pi)
 >>> et.dump(wine)
<wine><?twcb version=1.7;xsd=wineXML.xsd?></wine>

Then I have it in the middle again (same result with append or insert).

So back to square one.  Is there another way of building the 
document/tree which allows me to put the PI at the top?

Sorry to be a bother
Werner

_______________________________________________
XML-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/xml-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.