[XML-SIG] parsing CDATA section

Ankit Rastogi mr_ankit_rastogi at yahoo.com
Wed Dec 28 17:02:37 CET 2005


I am having problem with parsing CDATA section. I am using PyXml and minidom for parsing the xml document. 
  My motive is to get the data back in the same format in one string as it is writen in xml file. Here is the sample:
  --
  <StateChg>
      <![CDATA[
                check.. its cdata section
  
                 all data is printed in it s format
                 ]]>
<StateChg>
  --
  put when I print all its childs using:
  ---
   print StChg.childNodes  #StChg. is instance to <StateChg> element
  --
  It gives following output
  --
  [<DOM Text node "\n">, <DOM Text node "\t\t\t\t \t">, <DOM Text node "\n">, <DOM Text node "\t\t\t\t\t chec...">, <DOM Text node "\n">, <DOM Text node "\t\t\t\t\t all ...">, <DOM Text node "\n">, <DOM Text node "\t\t\t\t\t ">, <DOM Text node "\n">, <DOM Text node "\t\t\t\t\t">]
--
   
  The output Shows it is text node but we had declare it as CDATA_SECTION_NODE.
   
  and also the output is not desired ( format lost and some data is lost), 
   
  Why its happening. What I have to do to get the same output as in xml with the format and indentation.
   
  Please,correct me, where I am wrong


		
---------------------------------
Yahoo! Shopping
 Find Great Deals on Holiday Gifts at Yahoo! Shopping 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20051228/8fbb063e/attachment.html


More information about the XML-SIG mailing list