>>>On Mon, Oct 26, 2009 at 8:33 PM, Shivaraj M S <shivraj...@gmail.com>wrote:
> > This may be a solution if I am not getting you wrong. > 1.write the whole string to a file > 2.feed that to xml.dom.minidom.parse > 3.retrieve whole or childnodes from toxml Thank you for the reply. My problem was that i had an element and had created a textnode with a public certificate and then appended it as a child to the element. Problem is writexml(), toxml() when given '\n' for pretty printing add a newline between the element and the text node. So So my third party wants - <element>----BEGIN CERTIFICATE .. .... </element> and we give him <element> -----BEGIN CERITIFICATE ...... </element> >>> import xml.dom.minidom as md >>> doc = md.Document() >>> e = doc.createElement("element") >>> t = doc.createTextNode("----BEGIN CERT---- blah blah ---END---CERT---") >>> e.appendChild(t) <DOM Text node "----BEGIN ..."> >>> e.toxml() '<element>----BEGIN CERT---- blah blah ---END---CERT---</element>' >>> e.toprettyxml() '<element>\n\t----BEGIN CERT---- blah blah ---END---CERT---\n</element>\n' So was using writexml('\t', '\n') so as the xml is readable and it added a newline after the element and before the text node causing my third party library to barf in agony. http://stackoverflow.com/questions/1623607/escaping-and-in-xml-when-using-xml-dom-minidom --Bhaskar. _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers