[XML-SIG] problem in ElementTree SubElement

Sbaush sbaush at gmail.com
Mon Feb 6 20:10:31 CET 2006


is possible to preserve the order building the XML tree with DOM?

2006/2/6, Radovan Chytracek <radovan.chytracek at gmail.com>:
>
> Hi,
>
>    you simply can't rely on the order of attributes unless your XML
> data are in canonical form which keeps attributes alphabetically
> ordered. I guess this a very simple way of saying that the SAX parser
> likely to be running behind ElementTree API layer does not preserve
> the order of attributes. In general SAX(2) does not have to. Please
> correct me if I am wrong about this.
>
> Cheers
>                  Radovan
>
> On 2/6/06, Sbaush <sbaush at gmail.com> wrote:
> > Hi all.
> > I would get this element in xml:
> >
> > <date month="02" day="06"  />
> >
> > I have write this:
> >
> > date=ET.SubElement(idsreq,"date")
> >         date.set("month",month)
> >         date.set("day",day)
> >
> > but i get this:
> >
> > <date day="06" month="02" />
> >
> > The attributes are not in my order!!
> > how i can get the attributes in right order???
> > Thanks all.
> >
> > --
> > Sbaush
> > _______________________________________________
> > XML-SIG maillist  -  XML-SIG at python.org
> > http://mail.python.org/mailman/listinfo/xml-sig
> >
> >
> >
>
>
> --
> Radovan Chytracek CERN IT PSS
> mailto:Radovan.Chytracek at cern.ch
> phone: +41227674578 fax: +41227669830
> _______________________________________________
> XML-SIG maillist  -  XML-SIG at python.org
> http://mail.python.org/mailman/listinfo/xml-sig
>



--
Sbaush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20060206/6f3ae73e/attachment.htm 


More information about the XML-SIG mailing list