How to create a DOMNode in PHP?

…衆ロ難τιáo~ 提交于 2019-12-11 19:54:53

问题


The class DOMNode doesn't provide a contructor and also no static methods like createInstance(). So, how to create an DOMNode instance?


回答1:


Create a DOMDocument. It extends from DOMNode, has a constructor, and represents the rootnode of a document. Being a DOMNode, DOMDocument has methods for adding children. For instance, DOMDocument has a method CreateElement, which returns a DOMElement, which also inherits from DOMNode. All in all, it seems that DOMNode is just the base class and shouldn't be used directly.



来源:https://stackoverflow.com/questions/17846468/how-to-create-a-domnode-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!