Referencing xsds inside jars?
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 4
- Joined: Tue Mar 21, 2006 9:58 pm
Referencing xsds inside jars?
We would prefer to store many of our xsds inside jars, but must be able to reference them in xs:import statements from other xsds. Is there some way to make this work for example by using XML catalogs (i.e. is it possible to set up a mapping so that 'schemaLocation='http://myurl/myxsd.xsd'/>' will resolve to for example myjar.jar!myxsd.xsd)? If not, would it be possible to replace/extend the XML editor's 'entity resolver' in order to look inside jar, or provide some other way of accessing xsds inside jars?
Thanks, John
Thanks, John
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Hi John,
Maybe this sample would help:
1) I created a jar file called "jsp.jar" in the file system path:. The jar contains a directory called "jsp" and inside it a schema called "jspxsd.xsd".
2)The catalog file looks like this:
I went to Options->Preferences->XML Catalog and added my catalog to the list.
3)The schema file looks like this:
When validated, the schema will resolve the "schemaLocation" reference through the custom catalog above (I checked both in Eclipse and the standalone version).
Here are some samples of using the "jar" protocol:
Local access:
Remote access:
As you can see you prepend the "jar:" protocol to the URL, then at the end of the URL you append "!/" and the append the path through the jar archive to the resource.
You can also check that you created the right URL by trying to open it in Firefox (IE does not seem to handle the "jar" protocol) . Setting the XML Catalog in Oxygen to verbose would also help.
Regards, Radu
Maybe this sample would help:
1) I created a jar file called "jsp.jar" in the file system path:
Code: Select all
file:/C:/workspace/eXml/frameworks/jsp/xsd/
2)The catalog file looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system systemId="http://java.sun.com/dtd/jspxml.xsd"
uri="jar:file:/C:/workspace/eXml/frameworks/jsp/xsd/jsp.jar!/jsp/jspxsd.xsd"/>
</catalog>
3)The schema file looks like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import schemaLocation="http://java.sun.com/dtd/jspxml.xsd" namespace="http://www.w3.org/2001/XMLSchema"/>
</xs:schema>
Here are some samples of using the "jar" protocol:
Local access:
Code: Select all
jar:file:/E:/local/folder/thepackage/thepackage.jar!/thepackage/images/blueball.gif
Code: Select all
jar:http://www.oxygenxml.com/thepackage.jar!/thepackage/blueball.gif
You can also check that you created the right URL by trying to open it in Firefox (IE does not seem to handle the "jar" protocol) . Setting the XML Catalog in Oxygen to verbose would also help.
Regards, Radu
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service