Problems with XML schema and XML catalogs
Posted: Sun Mar 27, 2005 9:37 am
Hi--I have been working for several days to get XML catalog support to work, with no success. Research on the Internet, on the oXygen support forum, and several books on XML and XML schema have turned up nothing that works. I am aware of the support article at http://www.oxygenxml.com/forum/ftopic690.html. See the files at the end of this message for details.
oXygen 5.1 validates file (1), below, which names the location of the schema file explicitly (see the line marked "<!-- 1 -->"). oXygen evaluates file (2) as invalid, with the following mystifying message:
The only difference is the schema location "hint" string at <!-- 2 -->. These work in conjunction with files (3), (4), and (5).
Things that I have tried that didn't help:
* (at <!-- 3 -->, on two different lines) Adding "/" at the end of each string.
* (at <!-- 4 -->, on three different lines) Changing "file:///" to "file:/", or vice versa.
* I also tried pointing to categories-rewrite-catalog.xml by adding its pathname as a separate catalog document through the XML Catalog pane of the Preferences dialog.
I originally got this mysterious error message on a more complicated schema, but then I developed the schema and test files shown here to try to debug the situation. This error message is so out-of-place that I'm wondering whether the problem is in the Xerxes parser.
The only reason I'm bothering with namespaces and XML catalogs is to make it possible for XML documents written under a given schema to be validated without having to use xsi:noNamespaceSchemaLocation and forcing the user to substitute the physical location of the schema document in every XML document they receive. Is this the right approach, or is using namespace is more trouble than it's worth?
Thanks for any help you can give me on this matter.
--Gregg Williams (files are listed below)
[/code]
oXygen 5.1 validates file (1), below, which names the location of the schema file explicitly (see the line marked "<!-- 1 -->"). oXygen evaluates file (2) as invalid, with the following mystifying message:
Code: Select all
F Open quote is expected for attribute "frameborder" associated with an element
type "frameset". categories1.xsd http://infoml.org/s/categories1.xsd 5:38
The only difference is the schema location "hint" string at <!-- 2 -->. These work in conjunction with files (3), (4), and (5).
Things that I have tried that didn't help:
* (at <!-- 3 -->, on two different lines) Adding "/" at the end of each string.
* (at <!-- 4 -->, on three different lines) Changing "file:///" to "file:/", or vice versa.
* I also tried pointing to categories-rewrite-catalog.xml by adding its pathname as a separate catalog document through the XML Catalog pane of the Preferences dialog.
I originally got this mysterious error message on a more complicated schema, but then I developed the schema and test files shown here to try to debug the situation. This error message is so out-of-place that I'm wondering whether the problem is in the Xerxes parser.
The only reason I'm bothering with namespaces and XML catalogs is to make it possible for XML documents written under a given schema to be validated without having to use xsi:noNamespaceSchemaLocation and forcing the user to substitute the physical location of the schema document in every XML document they receive. Is this the right approach, or is using namespace is more trouble than it's worth?
Thanks for any help you can give me on this matter.
--Gregg Williams (files are listed below)
Code: Select all
***** NOTE: Strings of the form "<!-- (1, 2, 3, or 4) -->" are used *****
***** to mark locations in the XML; they must be removed *****
***** for the XML to be valid. *****
***** begin (1) E:\xml\experiments\auto-recognition-of-schemas\test-document1.xml (WORKS) *****
<?xml version="1.0" encoding="UTF-8"?>
<categories
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://infoml.org/categories1
file:///E:/xml/experiments/auto-recognition-of-schemas/categories1.xsd" <!-- 1 -->
xmlns="http://infoml.org/categories1">
<category>foo</category>
<category>bar</category>
</categories>
***** begin (2) E:\xml\experiments\auto-recognition-of-schemas\test-document2.xml (DOESN'T WORK) *****
<?xml version="1.0" encoding="UTF-8"?>
<categories
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://infoml.org/categories1 <!-- 3 -->
http://infoml.org/s/categories1.xsd" <!-- 2 --> <!-- 3 -->
xmlns="http://infoml.org/categories1">
<category>foo</category>
<category>bar</category>
</categories>
***** begin (3) E:\xml\experiments\auto-recognition-of-schemas\categories1.xsd *****
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://infoml.org/categories1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://infoml.org/categories1"
elementFormDefault="qualified"
attributeFormDefault="qualified"
>
<xsd:element name="categories">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="category" maxOccurs="unbounded"
type="categoryType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="categoryType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
***** begin (4) E:\xml\experiments\auto-recognition-of-schemas\categories-rewrite-catalog.xml *****
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteSystem
systemIdStartString="http://infoml.org/s"
rewritePrefix="file:/E:/xml/experiments/auto-recognition-of-schemas"/> <!-- 4 -->
</catalog>
***** begin (5) C:\Program Files\Oxygen 5.1\frameworks\catalog.xml *****
<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<nextCatalog catalog="file:///E:/xml/infoml085alpha/infoml-rewrite-catalog.xml"/> <!-- 4 -->
<nextCatalog catalog="file:///E:/xml/experiments/auto-recognition-of-schemas/categories-rewrite-catalog.xml"/> <!-- 4 -->
<nextCatalog catalog="docbook/catalog.xml"/>
<nextCatalog catalog="tei/dtd/teicatalog.xml"/>
<nextCatalog catalog="xhtml/dtd/xhtmlcatalog.xml"/>
<nextCatalog catalog="svg/dtd/svgcatalog.xml"/>
<nextCatalog catalog="jsp/xsd/jspcatalog.xml"/>
</catalog>
***** end *****