Discussion:
using jar urls in external-noNamespaceSchemaLocation
Dave Brosius
2008-02-09 07:14:56 UTC
Permalink
I am trying to validate against an xsd file that is jar'ed up with my
program that is deployed thru jnlp. Included in the jnlp are the jars
xml-apis.jar and xercesImpl.jar. I do



System.out.println((null !=
PatchAnimIO.class.getResourceAsStream(PATCHANIMDOC_SCHEMA)) ? "loaded" :
"null");
System.out.println(PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).getPath());
reader.setProperty(http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation,
PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).getPath());

When run thru jnlp, it dumps to the console

loaded
http://patchanim.sourceforge.net/jnlp/patchanim-0.3.0.jar!/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
[Warning] :2:73: schema_reference.4: Failed to read schema document
'http://patchanim.sourceforge.net/jnlp/patchanim
0.3.0.jar!/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd', because 1) could
not find the document


So this shows that the xsd is where i said it was, but yet, setProperty
seems like it doesn't know how to load it?


Any ideas?

dave
Michael Glavassevich
2008-02-09 14:53:09 UTC
Permalink
I thought jar URLs need to be prefixed with "jar:". Loading
"jar:http://patchanim.sourceforge.net/jnlp/patchanim-0.3.0.jar!/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd"
seems to work.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
Post by Dave Brosius
I am trying to validate against an xsd file that is jar'ed up with my
program that is deployed thru jnlp. Included in the jnlp are the jars
xml-apis.jar and xercesImpl.jar. I do
System.out.println((null !=
"null");
System.out.println(PatchAnimDocument.class.
getResource(PATCHANIMDOC_SCHEMA).getPath());
reader.setProperty(http://apache.org/xml/properties/schema/external-
noNamespaceSchemaLocation,
PatchAnimDocument.class.
getResource(PATCHANIMDOC_SCHEMA).getPath());
When run thru jnlp, it dumps to the console
loaded
http://patchanim.sourceforge.net/jnlp/patchanim-0.3.0.jar!
/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
[Warning] :2:73: schema_reference.4: Failed to read schema document
'http://patchanim.sourceforge.net/jnlp/patchanim
0.3.0.jar!/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd', because 1) could
not find the document
So this shows that the xsd is where i said it was, but yet, setProperty
seems like it doesn't know how to load it?
Any ideas?
dave
---------------------------------------------------------------------
Dave Brosius
2008-02-09 15:24:14 UTC
Permalink
AH!

thank you

i was using

reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).getPath());

when

reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
PatchAnimDocument.class.getResource(PATCHANIMDOC_SCHEMA).toString());

was what i needed


----- Original Message -----
From: "Michael Glavassevich" <***@ca.ibm.com>
To: <j-***@xerces.apache.org>
Sent: Saturday, February 09, 2008 9:53 AM
Subject: Re: using jar urls in external-noNamespaceSchemaLocation
Post by Michael Glavassevich
I thought jar URLs need to be prefixed with "jar:". Loading
"jar:http://patchanim.sourceforge.net/jnlp/patchanim-0.3.0.jar!/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd"
seems to work.
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
Post by Dave Brosius
I am trying to validate against an xsd file that is jar'ed up with my
program that is deployed thru jnlp. Included in the jnlp are the jars
xml-apis.jar and xercesImpl.jar. I do
System.out.println((null !=
"null");
System.out.println(PatchAnimDocument.class.
getResource(PATCHANIMDOC_SCHEMA).getPath());
reader.setProperty(http://apache.org/xml/properties/schema/external-
noNamespaceSchemaLocation,
PatchAnimDocument.class.
getResource(PATCHANIMDOC_SCHEMA).getPath());
When run thru jnlp, it dumps to the console
loaded
http://patchanim.sourceforge.net/jnlp/patchanim-0.3.0.jar!
/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd
[Warning] :2:73: schema_reference.4: Failed to read schema document
'http://patchanim.sourceforge.net/jnlp/patchanim
0.3.0.jar!/com/mebigfatguy/patchanim/io/PatchAnimDoc.xsd', because 1)
could
Post by Dave Brosius
not find the document
So this shows that the xsd is where i said it was, but yet, setProperty
seems like it doesn't know how to load it?
Any ideas?
dave
---------------------------------------------------------------------
---------------------------------------------------------------------
Loading...