开发者

Does PHP simplexml_import_dom convert the full DOM?

I have an XML document I am importing into a PHP DOM and validating with XSD (RelaxNG is not an option). I then want to turn the DOM into simpleXML for processing. The function simplexml_import_dom seems to be the thing to use, but the documentation says "This function takes a node of a DOM document and makes it into a SimpleXML node." This implies that only one开发者_开发百科 node is converted, not the full DOM tree. Is this correct?

I could get the XML as simpleXML by re-reading the file, but that would be wasteful. If simplexml_import_dom does not do the full DOM tree, how do I convert the DOM to simpleXML? I've looked for example code for recursive DOM traversal but have not found any examples. Any suggestions?


SimpleXML objects/elements/nodes include their children. The simplexml_import_dom function handles the recursion for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜