Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    replacing nodes with XQuery

    alright lets say we have example.xml
    Code:
    <users>
    
    <userID>1
    <name>Steve</name>
    </userID>
    
    <userID>2
    <name>Dave</name>
    </userID>
    
    <userID>3
    <name>Walt</name>
    </userID>
    
    <userID>4
    <name>Brodie</name>
    </userID>
    
    </users>
    will this function allow me to change the name node, based on the userID?
    Code:
    function changeName(name){
      replace node doc("example.xml")/users/userID[userID]/name 
      with "<name>" + name + "</name>"
    }

  • #2
    Moderator
    Join Date
    May 2002
    Location
    Hayward, CA
    Posts
    1,453
    Thanks
    1
    Thanked 21 Times in 19 Posts
    What language is this?
    "The first step to confirming there is a bug in someone else's work is confirming there are no bugs in your own."
    June 30, 2001
    author, Verbosio prototype XML Editor
    author, JavaScript Developer's Dictionary
    https://alexvincent.us/blog

  • #3
    New Coder
    Join Date
    Aug 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Alex Vincent View Post
    What language is this?
    XQuery


  •  

    Posting Permissions

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