Xquery in XML file with namespace
338519Apr 18 2003 — edited Nov 18 2005Hi
I have two questions:
1. I'm trying to use Xquery (jxqi- Oracle) to perform query in a XML file that contains namespace but I don't be getting. Without namespace, the query is executed correctly!
What's the problem?
2. Is it possible to store this XML file in a field XMLtype and validate it with these two XMLSchema files (videolib.xsd and dc.xsd, the last used by videolib.xsd)?
P.S.: Don't have errors in XMLSchema and Xml file. It's validated by XMLSpy 4.2
XQuery
=====================
<videolib>
{
FOR $r IN document("videolib.xml")/videolib/city
RETURN
$r
}
</videolib>
videolib.xsd
=====================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.dsc.ufpb.br/~alexscr"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.dsc.ufpb.br/~alexscr"
xmlns:dc="http://purl.org/dc/elements/1.1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://purl.org/dc/elements/1.1" schemaLocation="dc.xsd"/>
<xs:element name="videolib">
<xs:complexType>
<xs:all>
<xs:element ref="dc:title" minOccurs="0"/>
<xs:element ref="dc:creator" minOccurs="0"/>
.
. Dublin Core Elements
.
<xs:element ref="dc:right" minOccurs="0"/>
<xs:element name="city" type="xs:string"/>
<xs:element name="country" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
dc.xsd
======================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://purl.org/dc/elements/1.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1"
elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="title" type="xs:string"/>
<xs:element name="creator" type="xs:string"/>
.
. all types are string
.
<xs:element name="coverage" type="xs:string"/>
<xs:element name="right" type="xs:string"/>
</xs:schema>
videolib.xml
======================
<?xml version="1.0" encoding="UTF-8"?>
<videolib xmlns="http://www.dsc.ufpb.br/~alexscr" xmlns:dc="http://purl.org/dc/elements/1.1"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://www.dsc.ufpb.br/~alexscr videolib.xsd">
<dc:title>Homem Aranha - O filme</dc:title>
<dc:creator>Alex Sandro</dc:creator>
<dc:subject>Um ficção altamente recomendada</dc:subject>
. . .
<dc:coverage>Nordeste</dc:coverage>
<dc:right>copyright UFCG</dc:right>
<city>Campina Grande</cicty>
<country>Cláudio Baptista</country>
</videolib>
Thank's in advance!