logo       

Re: Problems setting the external schema Location feature: msg#00103

Subject: Re: Problems setting the external schema Location feature
Oh, yeah, about the reference. What you should have done is open http://www.w3.org/TR/xmlschema-1/ and painstakingly search for 'schemalocation'. You would have eventually encountered this paragraph in 4.3.2:

"...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:bob@xxxxxxxxxx]
Sent: Friday, December 31, 2004 2:59 AM
To: xerces-j-user@xxxxxxxxxxxxxx
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* property is 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:bob@xxxxxxxxxx]
Sent: Thursday, December 30, 2004 8:32 AM
To: xerces-j-user@xxxxxxxxxxxxxx
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: xerces-j-user-unsubscribe@xxxxxxxxxxxxxx
For additional commands, e-mail: xerces-j-user-help@xxxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe