on XML catalogs and XSD
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 2
- Joined: Wed Nov 17, 2004 2:20 pm
on XML catalogs and XSD
Hi, I'd really appreciate any help on integrating my existing XML schema into Oxygen's XML catalog, so I can use the nifty validation and content-assist features. I'm using Oxygen v5 as an eclipse plugin.
I have an XML document with the following header:
I have an XSD document that defines the schema on the local file system under H:\workspace\src\com\xyz\build\schema\databean.xsd
The schema is correct, and the document validates correctly when performed manually.
My understanding of Oxygen is that I need to define my mapping from a schema reference to a physical location in an OASIS XML Catalog. I've created a catalog file as follows:
My understanding is that the SYSTEM ID passed to the catalog will be the trailing end of the schemaLocation attribute com/xyz/build/schema/databean.xsd (is my understanding correct?), and I am trying to tell the catalog to rewrite it as file:///H:/workspace/src/com/xyz/build/schema/databean.xsd.
This should then enable the XML parser to locate the schema, and therefore validate the document.
Needless to say, it doesn't work. Instead, I get an inline error saying 'cvc-elt.1: Cannot find the declaration of element 'databean'.
Can anyone spot the mistake I've made? Anyone with more experience able to point me in the right direction?
I have configured Eclipse to use the custom XML catalog, and have restarted Eclipse after making the changes.
thanks
mike
I have an XML document with the following header:
Code: Select all
<databean
xmlns="http://www.xyz.com/databean"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xyz.com/databean
com/xyz/build/schema/databean.xsd">
The schema is correct, and the document validates correctly when performed manually.
My understanding of Oxygen is that I need to define my mapping from a schema reference to a physical location in an OASIS XML Catalog. I've created a catalog file as follows:
Code: Select all
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer='public'>
<rewriteSystem
systemIdStartString="com/xyz/build/schema"
rewritePrefix="file:///H:/workspace/src/com/xyz/build/schema"/>
</catalog>
This should then enable the XML parser to locate the schema, and therefore validate the document.
Needless to say, it doesn't work. Instead, I get an inline error saying 'cvc-elt.1: Cannot find the declaration of element 'databean'.
Can anyone spot the mistake I've made? Anyone with more experience able to point me in the right direction?
I have configured Eclipse to use the custom XML catalog, and have restarted Eclipse after making the changes.
thanks
mike
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi Mark,
The problem is that the you have specified the schema using a relative location. The XML Catalog acts as an entity resolver for the parser and the parser will resolve the relative location before calling the catalog to resolve that. So instead of getting com/xyz/build/schema/databean.xsd the catalog will receive file:/pathToXML/com/xyz/build/schema/databean.xsd and that does not start with com/xyz/build/schema/databean.xsd so it will not bew rewritten.
The solution is to use an absolute location when you specify your schema in the instance document and eventually also make the schema available at that location http://xyz/com/schema/databean.xsd for instance so that tools that do not have XML Catalog support or an XML Catalog is not configured will be able to access the schema.
Hope that helps,
George
The problem is that the you have specified the schema using a relative location. The XML Catalog acts as an entity resolver for the parser and the parser will resolve the relative location before calling the catalog to resolve that. So instead of getting com/xyz/build/schema/databean.xsd the catalog will receive file:/pathToXML/com/xyz/build/schema/databean.xsd and that does not start with com/xyz/build/schema/databean.xsd so it will not bew rewritten.
The solution is to use an absolute location when you specify your schema in the instance document and eventually also make the schema available at that location http://xyz/com/schema/databean.xsd for instance so that tools that do not have XML Catalog support or an XML Catalog is not configured will be able to access the schema.
Hope that helps,
George
-
- Posts: 2
- Joined: Wed Nov 17, 2004 2:20 pm
Thanks George!
Your advice has done the trick. I always thought the schema location system we were using was slightly dodgy..
To summarise for others, the following works:
with an XML catalog entry looking like this:
This maps the parser's request for http://www.xyz.com/databean.xsd to H:\workspace\src\com\xyz\schema\databean.xsd
Thanks again and kind regards
Mike
Your advice has done the trick. I always thought the schema location system we were using was slightly dodgy..
To summarise for others, the following works:
Code: Select all
<databean
xmlns="http://www.xyz.com/databean"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.xyz.com/databean
http://www.xyz.com/databean.xsd">
Code: Select all
<rewriteSystem
systemIdStartString="http://www.xyz.com"
rewritePrefix="file:///H:/workspace/src/com/xyz/schema"/>
Thanks again and kind regards
Mike
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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