I recently learned how to format the output with simpleXML in PHP. You just add the line $xml->formatOutPut = true;
But when I did it, the javascripts that I have written cannot parse the XML. I use to opt out the formatOutPut line, so the XML are written unformatted in one line. When I opt out the format line the javascript can parse the XML. Re开发者_JS百科ally wierd. Is there a way to not opt out the format line in PHP?
How do you parse the XML with javascript?
If the problem is the formatted output, I guess you use methods/collections which also handle textNodes (childNodes for example). If that's the case you have to modify your javascript in that way, that it will skip textNodes that only contain whiteSpaces(jQuery for example could do this for you).
精彩评论