PDA

View Full Version : Multiple namespaces


blinks
10-22-2009, 03:31 AM
I have an XSD schema which supports the following instance -

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="info:fedora/fedora-system:def/relations-external#" xmlns:xsi="http://www.w3.org/2001/XMLSchema">
<rdf:description rdf:about="info:fedora/RT:200">
<rel:isMemberOf rdf:resource="info:fedora/RT:146" />
</rdf:description>
</rdf:RDF>

I need it to support another namespace, viz -

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="info:fedora/fedora-system:def/relations-external#" xmlns:xsi="http://www.w3.org/2001/XMLSchema">
<rdf:description rdf:about="info:fedora/RT:200">
<rel:isMemberOf rdf:resource="info:fedora/RT:146" />
<oai:itemID>"RT:200" />
</rdf:description>
</rdf:RDF>

but am having difficulty getting getting the namespace instance correct - it keeps being set to "rel" (or rdf, depending on how I change the schema) rather than "oai".

The XSD schema (without my changes) is -

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rel="info:fedora/fedora-system:def/relations-external#">

<!-- the root element for RELS-EXT-->
<xsd:element name="RDF" type="RDFType"/>

<xsd:complexType name="RDFType">
<xsd:sequence>
<xsd:element name="description" type="descriptionType" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="descriptionType" about="">
<xsd:sequence>
<xsd:attribute name="about" />
<xsd:element name="isMemberOf">
<xsd:attribute name="resource" />
</xsd:element>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>

I'd appreciate any suggestions; I'm a relative newbie at XSD schemas.

oesxyl
10-22-2009, 03:55 PM
I have an XSD schema which supports the following instance -

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="info:fedora/fedora-system:def/relations-external#" xmlns:xsi="http://www.w3.org/2001/XMLSchema">
<rdf:description rdf:about="info:fedora/RT:200">
<rel:isMemberOf rdf:resource="info:fedora/RT:146" />
</rdf:description>
</rdf:RDF>
is rdf: Description not rdf: description, a qname in the subject is not exactly what you want, beleave me, use full uri instead.

I need it to support another namespace, viz -

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rel="info:fedora/fedora-system:def/relations-external#" xmlns:xsi="http://www.w3.org/2001/XMLSchema"
xmlns:oai="...your oai uri here..">
<rdf:description rdf:about="info:fedora/RT:200">
<rel:isMemberOf rdf:resource="info:fedora/RT:146" />
<oai:itemID>"RT:200" />
</rdf:description>
</rdf:RDF>
put the oai namespace in the root elment, yellow part is probably a typo, :)

but am having difficulty getting getting the namespace instance correct - it keeps being set to "rel" (or rdf, depending on how I change the schema) rather than "oai".

The XSD schema (without my changes) is -
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rel="info:fedora/fedora-system:def/relations-external#">

<!-- the root element for RELS-EXT-->
<xsd:element name="RDF" type="RDFType"/>

<xsd:complexType name="RDFType">
<xsd:sequence>
<xsd:element name="description" type="descriptionType" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="descriptionType" about="">
<xsd:sequence>
<xsd:attribute name="about" />
<xsd:element name="isMemberOf">
<xsd:attribute name="resource" />
</xsd:element>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>

I'd appreciate any suggestions; I'm a relative newbie at XSD schemas.
a suggestion, use relaxng instead of xsd.

http://relaxng.org/

best regards