Here is an example of XML-file consisting of a root-element, parent and child nodes. I was looking for the best way to remove doubles of nodes (when necessary), and I tried lots of tricks and ways to do it: like childNode.ParentNode.RemoveChild(childNode) etc., but every method I tried, was not working properly (or I did something wrong, or maybe because of DTD; I'm not sure). Well, I found an alternative way to do it and I thought: maybe it could be interesting to share with other people.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE root[
<!ELEMENT root (parent, child)>
<!ELEMENT parent (child)>
<!ELEMENT child EMPTY>
]>
<root>
<parent>
<child />
</parent>
<parent>
<child />
</parent>
<parent>
<child />
</parent>
</root>
No comments:
Post a Comment