Question: How to add elements and attributes with XQuery in XML data?
Answer: Consider the example "bookmart.xml".I write an expression to return litle and lang elements both. for $a in doc("bookmart.xml")/bookstore/book/title order by $a return $a
Output: <title lang="en">Jungle Book</title> <title lang="en">The Book of the Thousand Nights and a Night</title> <title lang="en">XPath and XPointer</title> <title lang="en">XML Programing</title>
Now, I will told you how to add elements and attributes in XML document by using XQuery.
Question:
How to add elements and attributes with XQuery in XML data? Answer:
Consider the example "bookmart.xml".I write an expression to return litle and lang elements both. for $a in doc("bookmart.xml")/bookstore/book/title order by $a return $a
Output: <title lang="en">Jungle Book</title> <title lang="en">The Book of the Thousand Nights and a Night</title> <title lang="en">XPath and XPointer</title> <title lang="en">XML Programing</title>
Now, I will told you how to add elements and attributes in XML document by using XQuery. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
There should not be any Spelling Mistakes.
There should not be any Gramatical Errors.
Answers must not contain any bad words.
Answers should not be the repeat of same answer, already approved.