How to remove "dangling" element tags?

Results 1 to 2 of 2

Thread: How to remove "dangling" element tags?

  1. #1
    Join Date
    Dec 1969

    Default How to remove "dangling" element tags?

    I&#039;m using the XmlDocument object in my ASP.NET application to store files/folders hierarchy. I can make everything work the way I want, except one thing. Here&#039;s the problem: If a folder element contains only ONE file element, and I use folderNode.removeChild(fileNode) to remove that file, the folder element&#039;s end tag &#060;/folder&#062; remains (i.e. gets left behind) in the XmlDocument. Then when I save the document object to an file, it&#039;s very messy to look at, especially since there may be many folders and files in the hierachy.<BR><BR>Here is a step-through of the operation and its problem:<BR><BR>Original XmlDocument:<BR><BR>&lt;folder name="folder 1" /&gt;<BR><BR>After INSERTING a file:<BR><BR>&lt;folder name="folder 1"&gt;<BR> &lt;file name="file 1" /&gt;<BR>&lt;/folder&gt;<BR><BR>After REMOVING that file:<BR><BR>&lt;folder name="folder 1"&gt;&lt;/folder&gt;<BR><BR>Why not this? :<BR><BR>&lt;folder /&gt;<BR><BR>Is there some kind of "RemoveEndTag()" function to clean up this mess?

  2. #2
    Join Date
    Dec 1969

    Default I don't think you can..

    .. control that.<BR><BR>But, functionally they are the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts