Setting root node


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Setting root node

  1. #1
    madhu Guest

    Setting root node


    i have an xml document something like this:
    <getlist><lists><list/><list/></lists></getlist>,
    how do i make another xml document with <lists> as my root node(document
    Element),can somebody help me out??

  2. #2
    SameProblem Guest

    Re: Setting root node


    "madhu" <maddie_maddie@hotmail.com> wrote:
    >
    >i have an xml document something like this:
    ><getlist><lists><list/><list/></lists></getlist>,
    >how do i make another xml document with <lists> as my root node(document
    >Element),can somebody help me out??

    I had the same problem. There is no way to create a new dom directly.
    In the next example domData would contain the values: <getlist><lists><list/><list/></lists></getlist>

    Dim ndDataNode As DomDocument
    Dim ndNewDataNode As MSXML.IXMLDOMNode
    Dim domData As DOMDocument

    Set ndNewDataNode = domData.childNodes(0)
    For i = 0 To ndNewDataNode.childNodes.length - 1
    Set ndClone = ndNewDataNode.childNodes(i).cloneNode(True)
    If ndDataNode.selectSingleNode(ndClone.nodeName) Is nothing Then _
    ndDataNode.appendChild ndClone
    Next i

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center