Results 1 to 2 of 2

Thread: XML How to set attribute from a nodelist

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2012
    Posts
    37

    XML How to set attribute from a nodelist

    I have a node list created that produces a list of nodes that have an attribute named "ObjectRef" and where its value is > 25

    EG
    Set ObjNodeList = xmlDoc.documentElement.selectNodes("//PremiereData/*[@ObjectID>='23']/descendant::*[@ObjectRef>='25']")

    I need to update the value for "ObjectRef" for every node in the nodelist. Sometimes this node has this attribute only and other nodes have an attribute named "IndexID" also. If so, "ObjectRef" is always the second attribute. These nodes selected can be 2nd, 3rd or 4th descendants.

    I am trying the following Xpath but it does not work.
    Code:
    For I2=objnodelist.length-1 to 0 step -1   'Have to go backwards, the values are sequential
          Set root = root.selectSingleNode("//" & ObjNodeList.Item(I2).nodeName & "/descendant::*[@ObjectRef>='25']")
          root.setattribute "ObjectRef" "nn" + n1
    next I2
    Thanks in advance
    Last edited by mhnvb; Aug 18th, 2014 at 12:02 AM.

  2. #2

    Thread Starter
    Member
    Join Date
    Apr 2012
    Posts
    37

    Re: XML How to set attribute from a nodelist

    OK,
    This fixed it
    Set root = root.selectSingleNode("//" & ObjNodeList.Item(I2).nodeName & "[@ObjectRef>='25']"

    Thanks for looking

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width