[XML-SIG] elementtree ProcessingInstructions

Werner F. Bruhin werner.bruhin at free.fr
Mon Dec 19 19:39:20 CET 2005

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

More information about the XML-SIG mailing list