Confused somewhat xml newbie. I'm trying to output xml with a CDATA
section, using saxutils.XMLGen erator, but the output contains escaped
'<' and '>' and '&' from the CDATA element. Shouldn't it be spit out
intact?
Here's code and output:
from xml.sax import saxutils
import sys
handler = saxutils.XMLGen erator(sys.stdo ut)
handler.startDo cument()
handler.startEl ement('sometag' , {})
handler.charact ers('<![CDATA[x&<>xxx]]>')
handler.endElem ent('sometag')
handler.endDocu ment()
Produces:
<?xml version="1.0" encoding="iso-8859-1"?>
<sometag>< ![CDATA[x&<>x xx]]></sometag>
I was expecting to see
<?xml version="1.0" encoding="iso-8859-1"?>
<sometag><![CDATA[x&<>xxx]]></sometag>
What am I doing wrong here?
Thanks,
Chris
section, using saxutils.XMLGen erator, but the output contains escaped
'<' and '>' and '&' from the CDATA element. Shouldn't it be spit out
intact?
Here's code and output:
from xml.sax import saxutils
import sys
handler = saxutils.XMLGen erator(sys.stdo ut)
handler.startDo cument()
handler.startEl ement('sometag' , {})
handler.charact ers('<![CDATA[x&<>xxx]]>')
handler.endElem ent('sometag')
handler.endDocu ment()
Produces:
<?xml version="1.0" encoding="iso-8859-1"?>
<sometag>< ![CDATA[x&<>x xx]]></sometag>
I was expecting to see
<?xml version="1.0" encoding="iso-8859-1"?>
<sometag><![CDATA[x&<>xxx]]></sometag>
What am I doing wrong here?
Thanks,
Chris
Comment