Click here to Skip to main content
15,607,524 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

I want to remove the closing tag of xml using dom.How to remove the closing tag ?

For Eg,

<pre lang="xml"><tittle>
        <name>xxxx</name>
  </tittle>

In the above example i need to remove
</tittle>
Posted
Updated 2-Jan-14 17:50pm
v4
Comments
Ron Beyer 3-Jan-14 0:01am    
You may need to expand on what you are trying to do. Just removing the closing tag will create a malformed Xml document. I'm not sure that the DOM methods will allow you to create a malformed document, you may have to do it using basic string operations.
jai_mca 3-Jan-14 0:09am    
No,by the above example i am just explaining the thing i want to do.after removal of the tag i need to write some values and i will close the tag..that will be the final output.
Ron Beyer 3-Jan-14 8:54am    
Why not just add the values? The DOM takes care of that, you can add content inside without having to mangle the document.

1 solution

If you are using the XML DOM Document model then you should not (and cannot) remove the closing tag.

As Ron Beyer has said - just add the values you require to the appropriate node (which can be the root)

Here are some links to demonstrate further...
http://msdn.microsoft.com/en-us/library/aa468547.aspx[^]

http://www.w3schools.com/dom/[^]

An alternative is the XMLWriter class

http://www.dotnetperls.com/xmlwriter[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900