[jdom-interest] Do schemas work with JDOM?
Fishman, Rick
Rick_Fishman at ctilogistx.com
Tue Jan 23 07:08:52 PST 2001
I appreciate the help. I don't want to wear out my welcome (maybe I should
be posting this to W3C?) but one more thing... maybe I'm missing something.
I have now changed my xml and its schema as found below. I am getting a
JDOMException indicating that it can't find the schema:
org.jdom.JDOMException: General Schema Error: Grammar with uri :
x-schema:http://localhost/ReadTestSchema.xsd , can not found.: Error on line
2 of document file:/C:/JavaProjects/JDomTest/ReadTest.xml: General Schema
Error: Grammar with uri : x-schema:http://localhost/ReadTestSchema.xsd , can
not found.
I am running this from a Java application that is using JDOM to try and
parse the XML file. The schema (ReadTestSchema.xsd) is located in my
inetput/wwwroot directory that is my default web site on my box and that web
site is definitely accessible. This of course is an IIS web server. I also
copied the schema to an Apache web server on the Internet and tried it using
that URL but had the same problem. Is there something else I need to do to
allow JDOM to find the schema? I'm loading the XML file from disk (not thru
http) - maybe that's a problem?
I know I'm missing something really basic here so I'm prepared to be
embarrassed <grin>...
Here is my xml:
<?xml version="1.0"?>
<RICKSDOC xmlns="x-schema:http://www.codeblazers.com/ReadTestSchema.xsd">
<ROUTE ID="1">
<TRIP ID="1">
<STOP ID="1" />
</TRIP>
</ROUTE>
</RICKSDOC>
Here is my schema:
<xsd:schema xmlns:xsd="http://www.w3.org/2000/08/XMLSchema">
<xsd:complexType name="RICKSDOC">
<xsd:element name="ROUTE" type="ROUTE"/>
</xsd:complexType>
<xsd:complexType name="ROUTE">
<xsd:element name="TRIP" type="TRIP"/>
<xsd:attribute name="ID" type="xsd:unsignedLong"/>
</xsd:complexType>
<xsd:complexType name="TRIP">
<xsd:element name="STOP" type="STOP"/>
<xsd:attribute name="ID" type="xsd:unsignedLong"/>
</xsd:complexType>
<xsd:complexType name="STOP">
<xsd:attribute name="ID" type="xsd:unsignedLong"/>
</xsd:complexType>
</xsd:schema>
-----Original Message-----
From: Michael Brennan [mailto:Michael_Brennan at Allegis.com]
Sent: Monday, January 22, 2001 5:23 PM
To: Fishman, Rick; JDOM Interest (E-mail)
Subject: RE: [jdom-interest] Do schemas work with JDOM?
Your schema is in XDR, which is a Microsoft proprietary format. I doubt that
any of the Java validating parsers understand XDR.
You should try using XML Schema Definition language (XSD):
http://www.w3.org/XML/Schema
More information about the jdom-interest
mailing list