Monday, November 19, 2007

XML parsing using flex (Ignoring white space and newline)

In flex if you create XMLDocument following way
var str:String="<"root"> <"node"><"/node">\n<"/root">"; //there will be no extra "
var doc:XMLDocument =new XMLDocument(str);
doc.ignoreWhite=true;

this will not ignore white space



what you have to do is
var str:String="<"root"> <"node"><"/node">\n<"/root">";//there will be no extra "
var doc:XMLDocument =new XMLDocument();
doc.ignoreWhite=true;
doc.parseXML(str);
this will actually ignore the white space and new line

1 comments:

vats said...

Hi nahid,
thanks for this information.
i am newbie at flex. can you help me in making a logic.
i want to store some information in XML document that contains HTML tags.
but when i parse this XML in flex, i am not getting proper output.

any idea to store HTML data in XML and retrieve the same back.

thanks