[4suite] creating a CDATA Section in XML using 4suite in python
Mike Brown
mike at skew.org
Wed Oct 1 10:22:31 MDT 2008
The only thing a CDATA section does is removes the need to write "<" as "<"
and "&" as "&". Why not just use the filename as-is (well, converted to
unicode) and put it into an ordinary text node? An XML parser isn't going to
know the difference.
Muraleedhara Reddy wrote:
> Hello,
>
> I am trying to generate a XML document from a log message having a
> list file names. Below is the code snippet. For the "name" element, I want
> to add the file name (filename) as CDATA Section. Would anybody please tell
> me how to do that?
>
> ==========================================
> from Ft.Xml import Domlette
>
> di = Ft.Xml.Domlette.implementation
> doc = di.createDocument(None, "MyXML", None)
> root = doc.documentElement
> root.setAttributeNS(None, "attr1", attrvalue1)
> entry = doc.createElementNS(None, "entry")
> root.appendChild(entry)
> name = doc.createElementNS(None, "name")
> entry.appendChild(name)
> C = Ft.Xml.Domlette.CDATA.appendData(filename)
> C.appendData(filename)
> ==========================================
>
> Thanks in advance,
> Muraleedhara Reddy. S
> _______________________________________________
> 4suite mailing list
> 4suite at lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/4suite
More information about the 4suite
mailing list