Create xml with elementtree ET and xml escaping
nenad.cikic at gmail.com
nenad.cikic at gmail.com
Tue Dec 11 21:19:22 EST 2012
Il giorno martedì 11 dicembre 2012 20:59:54 UTC+1, MRAB ha scritto:
> > Hello, I have posted the same in XML group but it seems pretty dead there so I will repost here.
>
> >
>
> > I am new to xml processing in python.
>
> > I am looking to create XML. Xml is not too difficult so I thought to create it manually using ElementTree.
>
> > First I noted that ET.toString does escape <>& but not " and '
>
> > Is that normal?
>
> >
>
> " needs to be encoded when it's in an attribute's value:
>
>
>
> <tag value="a quote (")">
OK I understood.
>
>
> because it's also being used as a delimiter in that case, but elsewhere
>
> it has no special meaning.
>
>
>
> > Since I have also the need to sign the XML I need the ability to create xml but without xml escaping (unescaped data are signed).
>
>
>
> XML with the escaping isn't valid XML.
>
Of course I know it is not valid without escaping. But I need it only for signing. I will recheck this if really the web service wants the data to be signed as non escaped.
Thanks
Nenad
More information about the Python-list
mailing list