Results 1 to 3 of 3
  1. #1

    add a container by providing XPATH

    How can we add a container with its elements and a single element in the XML by providing XPATH of the container and the element.
    I tried in in the following way. But this way it added the element one level up under the parent Container.

    Parentobj.AddChildElementByName "C","Valuable

    I wanted to add element <D> under Element <C>. But it added under element <D>.
    I want to add a Complete container with its subelements and values and a single element by providing XPATH.

    Please advice

  2. #2
    Join Date
    Jan 2007
    Pittsburgh, PA

    Re: add a container by providing XPATH

    Set doc = XMLUtil.CreateXML()
    doc.CreateDocument "a"
    Set root = doc.GetRootElement()
    root.AddChildElementByName "b",""
    root.ChildElements().Item(1).AddChildElementByName "c",""
    root.ChildElements().Item(1).ChildElements().Item( 1).AddChildElementByName "d",""
    Print doc.tostring

  3. #3
    Senior Member
    Join Date
    Feb 2008
    Los Angeles, CA, USA

    Re: add a container by providing XPATH

    Lets first work on the technical lingo...

    For XML, its root element, element-node, child element, parent element. And attributes and value if you want to go one step further. Container and subelements are confusing.

    Now paste your code that you tried.

    For reference, visit these sites if you havent yet:

    <u>Basic XML DOM</u>




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 04:09 PM.

Copyright BetaSoft Inc.