Hi Lars, Lars Marius Garshol wrote:
>* 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. > Just about any file I came acros they have these things in there, so is this just overkill or is it a convention that one puts them in. So, if they were not the default, i.e. if I would use "ISO-8859-1" how would I add them. > > >> 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 >problem? > > 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. Thanks for your hints and sorry if these are stupid questions or are answered in the specifications (frankly they are more confusing then helpful to me). I am trying to figure out what tools to use (easy to use, but still pretty full featured) and at the same time learn XML. I was jumping between lxml, elementtree and amara and just got more confused along the lines. So, as elementtree will become part of Python, I assume that this is happening as it is the best of the crop, I will just use it. Best regards Werner >-- >Lars Marius Garshol, Ontopian http://www.ontopia.net >+47 98 21 55 50 http://www.garshol.priv.no > > >_______________________________________________ >XML-SIG maillist - XML-SIG@python.org >http://mail.python.org/mailman/listinfo/xml-sig > > > > > _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig