昨天下午搞了一下Qt中的dom解析。发现并无java中的好用。java
1. 除了QDomDocument类之外,均没有toString方法。我仅仅想吧QDom**->QString 只能经过QDomDocuemnt来实现node
2. 就算用QDomDocument。 须要将QDom** append到QDomDocument。就会出现下面的结果:api
QDom**是经过此QDomDocument::create**出来的。能够append.app
QDom**不是经过此QDomDocument::create**出来的,QDomDocument用带参的初始化方法初始化的。能够appenddom
QDom**不是经过此QDomDocument::create**出来的,QDomDocument用无参的初始化方法初始化的。不能够append函数
3. QDomNode是全部QDom**的父类。其中appendChild()又是咱们常常用的。看官网注释this
Appends newChild as the node's last child. If newChild is the child of another node, it is reparented to this node. If newChild is a child of this node, then its position in the list of children is changed. If newChild is a QDomDocumentFragment, then the children of the fragment are removed from the fragment and appended. If newChild is a QDomElement and this node is a QDomDocument that already has an element node as a child, newChild is not added as a child and a null node is returned. Returns a new reference to newChild on success or a null node on failure. Calling this function on a null node(created, for example, with the default constructor) does nothing and returns a null node. The DOM specification disallow inserting attribute nodes, but for historical reasons, QDom accepts them anyway.
1. 若是newChild是其余节点的孩子,那么重定向到此节点,若是是这个节点的孩子,则改变位置。google
若是我仅仅想复制newChild到其余节点。那么我须要copy newChild,比较蛋疼须要从新new一个而后一个一个copy。blog
ok 我知道写个clone方法或者有api能够调用。可是增长一个直接插入的函数难道很差么?我帮起个名字:appendChildFocus();ci
2. 3. 就不说了。也是限制条件。
我只关注了这些。浪费了我4个小时的时间后,而后决定用QJson OYE.
google了一下你们怎么评论的。第一条就是" just confusing me!!!" 因此建议你们能不用QDom就不用。