Query from root element : node « XQuery « XML






Query from root element



File: Data.xml
<?xml version="1.0"?>
<Books>
 <Book>A</Book>
 <Book>B</Book>
 <Book>C</Book>
</Books>

File: Query.xquery
doc("Data.xml")/Books/Book

Output:

<?xml version="1.0" encoding="UTF-8"?>
<Book>A</Book>
<Book>B</Book>
<Book>C</Book>

 








Related examples in the same category

1.Select element by level
2.XQuery and element