Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes XML and Related Technologies and the fly likes schema and namespaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "schema and namespaces" Watch "schema and namespaces" New topic
Author

schema and namespaces

Manuel Palacio
Ranch Hand

Joined: Oct 16, 2000
Posts: 45
Hi,
I am trying to learn how to use XML Schema but I am having trouble with namespaces.
Having one XML doc with 2 namespaces like:
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns"
xmlns :pcr="http://www.pcr.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/02/22-rdf-syntax-ns channel1.xsd">
<rdf escription>
<pcr :publication>
<pcr:from>2001-12-12</pcr:from>
</pcr :publication>
</rdf escription>
</rdf:RDF>

How can I have 1 single schema that validates this document? I tried:
<?xml version="1.0"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns"
xmlns :pcr="http://www.pcr.com"
elementFormDefault="qualified">
<xsd:element name="RDF" type="channel"/>
<xsd:complexType name="channel">
<xsd:sequence>
<xsd:element name="Description" type="pcr :publication"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="publication">
<xsd:sequence>
<xsd:element name="from" type="xsd:date"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
using Xerces 1.4 but it did not work. Could someone tell me how to write a schema with multiple namespaces correctly?
Thanks
[This message has been edited by Manuel Palacio (edited July 31, 2001).]


<a href="http://www.newinstance.net" target="_blank" rel="nofollow">http://www.newinstance.net</a>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: schema and namespaces