"...in case a document author (human or not) created a document with a particular schema in view, and warrants that some or all of the document conforms to that schema, the schemaLocation and noNamespaceSchemaLocation [attributes] (in the XML Schema instance namespace, that is, http://www.w3.org/2001/XMLSchema-instance) (hereafter xsi:schemaLocation and xsi:noNamespaceSchemaLocation) are provided. The first records the author's warrant with pairs of URI references (one for the namespace name, and one for a hint as to the location of a schema document defining names for that namespace name). The second similarly provides a URI reference as a hint as to the location of a schema document with no targetNamespace [attribute]."
Left unsaid is the fact that lists in XML are whitespace-separated.
Bob
Radhakrishnan J wrote:
Any answers to my questions in POST#6 in this thread ??
Thanks, Radhakrishnan
-----Original Message----- From: Bob Foster [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 2:59 AM To: [EMAIL PROTECTED] Subject: Re: Problems setting the external schema Location feature
Didn't notice the slash when cut and pasting. Should be, e.g.,
String location = "http://www.xyz.net/oagis file:///D:/ASAP/Test/Test/xyz/Origination/Standalone/GetLoan.xsd";
Bob Foster
Bob Foster wrote:
Looks like a different problem. I'm pretty sure you need to specify a namespace, URI pair in a schemaLocation, like you did in your document.
E.g.,
String location =
"http://www.xyz.net/oagis file://D:/ASAP/Test/Test/xyz/Origination/Standalone/GetLoan.xsd";
Bob Foster http://xmlbuddy.com/
Radhakrishnan J wrote:
I'm trying to achieve the same thing. It doesn't seem to work for me too. XML document looks like:
<?xml version="1.0" encoding="UTF-8"?> <!--Sample XML file generated by XMLSPY v5 rel. 4 U (http://www.xmlspy.com)--> <GetLoan xmlns="http://www.xyz.net/oagis" xmlns:oa="http://www.openapplications.org/oagis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.xyz.net/oagis
file:///D:/ASAP_2_15/application/data/BOD/xyz/Origination/BODs/GetLoan.xsd"
revision="0.0.0">
<oa:ApplicationArea>
<oa:CreationDateTime>2001-12-17T09:30:47-05:00</oa:CreationDateTime>
</oa:ApplicationArea>
<DataArea>
<oa:Get>
<oa:ReturnCriteria>
<oa:SelectExpression>String</oa:SelectExpression>
</oa:ReturnCriteria>
</oa:Get>
<Loan/>
</DataArea>
</GetLoan>
Herez what my parsing code looks like:
DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/namespaces", true);
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
String location =
"file://D:/ASAP/Test/Test/xyz/Origination/Standalone/GetLoan.xsd";
parser.setProperty(
"http://apache.org/xml/properties/schema/external-schemaLocation",
location);
ErrorChecker errors = new ErrorChecker();
parser.setErrorHandler(errors);
parser.parse("GetLoan1.xml");
++++++++++++++++++++++++++++++++++++++++
Parsing error: cvc-elt.1: Cannot find the declaration of element 'GetLoan'.
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
element 'GetLoan'.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source) at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source) at
org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Un
known Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source) at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at
org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRoot
ElementHook(Unknown Source) at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source) at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at BodValidate.main(BodValidate.java:25) ++++++++++++++++++++++++++++++++++++++++
Parsing problem: schema_reference.4: Failed to read schema document
'file:///D:/ASAP_2_15/application/data/BOD/xyz/Origination/BODs/GetLoan.xsd'
, because 1) could not find the document; 2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
Parsing problem: schema_reference.4: Failed to read schema document
'file:///D:/ASAP_2_15/application/data/BOD/xyz/Origination/BODs/GetLoan.xsd'
, because 1) could not find the document; 2) the document could not be read;
3) the root element of the document is not <xsd:schema>.
From the trace it seems like the *external-schemaLocation* propertyis not
being used. The other question that I had was that, the 'GetLoan.xsd' schema
refers to umpteen other schemas through <include>s and <import>s. Should the
*external-schemaLocation* property include a comma separated list of the
file URLs for ALL the schema documents referred to directly or indirectly ?
Thanks, Radhakrishnan
-----Original Message----- From: Bob Foster [mailto:[EMAIL PROTECTED] Sent: Thursday, December 30, 2004 8:32 AM To: [EMAIL PROTECTED] Subject: Re: Problems setting the external schema Location feature
What you have specified as an argument is pretty clearly not a URI. It doesn't begin with a scheme. It's hard to tell from reading it what the correct URL should be, but the form must be:
jar:file:/path-to-jar-file!/path-within-jar-file
Just guessing, yours would be:
jar:file:/home/peter/.dpml/main/dpml/test/jars/dpml-test-testschema.jar!/net
/dpml/test/testschema/ConfigurableB.xschema
What did you think the
/home/peter/metro/svn/development/main/metro/composition/test/
at the beginning would accomplish?
Bob Foster
Peter Neubauer wrote:
Hi,
trying to set the feature on a 2.6.2 SAXParser (validation enabled etc.):
m_parser.setErrorHandler(handler);
m_parser
.setProperty(
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
,
"/home/peter/metro/svn/development/main/metro/composition/test/file:/home/pe
ter/.dpml/main/dpml/test/jars/dpml-test-testschema.jar!/net/dpml/test/testsc
hema/ConfigurableB.xschema" );
m_parser.parse( new InputSource( new ByteArrayInputStream( xml
.getBytes() ) ) );
with a path to the schema that sits inside a .jar file it seems that the schema is not found, since I get an error saying that
the
root element cannot be found:
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'configuration'.
What kind of schema location is supported by the feature?
Thanks for help
/peter
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]