File: Data.xml
<prod:car xmlns:prod="http://java2s.com/prod">
<prod:id>0002</prod:id>
<prod:name language="en">name 2</prod:name>
</prod:car>
File: Query.xquery
declare namespace prod = "http://java2s.com/prod";
for $car in doc("Data.xml")/prod:car
return $car/prod:name
Output:
<?xml version="1.0" encoding="UTF-8"?>
<prod:name xmlns:prod="http://java2s.com/prod" language="en">name 2</prod:name>
|