[XML-SIG] elementtree ProcessingInstructions

Lars Marius Garshol larsga at ontopia.net
Mon Dec 19 17:17:02 CET 2005

* Werner F. Bruhin
> I think that the following are considered ProcessingInstructions.
> <?xml version="1.0" encoding="UTF-8"?>
> <?jaxfront version=1.60;time=2005-12-18 12:15:07.078;xsd=wineXML.xsd?>
> Am I correct?

Only about the second one. The first one is the XML declaration, and  
is not considered a processing instruction, despite being  
syntactically extremely similar.

> If yes how do I get them into file?

Well, that particular XML declaration is equivalent to not having  
one, since UTF-8 is the default encoding. If the system at the other  
end requires one, then either your MIME types need fixing, or the  
system at the other end is broken.

>     pi2 = et.ProcessingInstruction(("twcb version=% 
> s;xsd=wineXML.xsd") %
>                             (__version__.twcbVERSION_STRING))
>     doc.append(pi2) # append is not what I want/need

What's wrong with append here? Does it give the right result, or some  

Lars Marius Garshol, Ontopian               http://www.ontopia.net
+47 98 21 55 50                             http://www.garshol.priv.no

More information about the XML-SIG mailing list