javaxsdschemasaxoncatalog

Issues with Saxon schema validation during transform


Edited per comments to not use images. Had not considered it being a negative for some users.

We are developing an application in which we create some XML files (S1000D data modules) that are extracted from a "composite" set of data. Once the files are extracted from the composite, we are validating them. We are running into an issue where the schema is being reported as invalid:

Loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/crew.xsd
Loading schema document http://www.w3.org/1999/xlink
Finished loading schema document http://www.w3.org/1999/xlink
Loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/rdf.xsd
Loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/dc.xsd
Finished loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/dc.xsd
Finished loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/rdf.xsd
Finished loading schema document file:/C:/GitRepos/Flight-Publishing-GUI/schemas/S1000D_4-2/xml_schema_flat/crew.xsd
Error on line 948 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT
Error on line 3578 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT3
Error on line 3703 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT1
Error on line 1222 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT4
Error on line 1139 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT
Error on line 1185 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT
Error on line 5507 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT0
Error on line 5552 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT2
Error on line 5651 of crew.xsd:
   Unknown type Q{http://www.w3.org/1999/xlink}XLINKATT0
Warning 
   Errors were found in the schema
Warning 
   Validation will continue without the schema at
  http://www.s1000d.org/S1000D_4-2/xml_schema_flat/crew.xsd

Content of crew.xsd in the area of line 948 in crew.xsd:

<xs:complexType name="dmRefElemType">
    <xs:sequence>
        <xs:element ref="dmRefIdent"/>
        <xs:element minOccurs="0" ref="dmRefAddressItems"/>
        <xs:element minOccurs="0" ref="behavior"/>
    </xs:sequence>
    <xs:attribute ref="referredFragment"/>
    <xs:attribute ref="applicRefId"/>
    <xs:attribute ref="id"/>
    <xs:attributeGroup ref="changeAttGroup"/>
    <xs:attributeGroup ref="securityAttGroup"/>
    <xs:attributeGroup ref="authorityAttGroup"/>
    <xs:attributeGroup ref="xlink:XLINKATT"/>
</xs:complexType>

When I review the schema I can find all of the referenced 'Unknown type' items. Oxygen has no issues with it and validates files using it. We are using a catalog file to point to the local 'schema' folder where all the S1000D V4.2 schemas are being stored (to include the xlink.xsd). The catalog.xml looks like:

<!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"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog catalog.xsd"
          prefer="system">
  <rewriteSystem systemIdStartString="http://www.s1000d.org/" rewritePrefix="schemas/" />
  <rewriteURI uriStartString="http://www.s1000d.org/" rewritePrefix="schemas/" />
</catalog>

When running this XSL from Oxygen, these errors did not occur. It was not until building the Java application to use them that it appeared. We provide the catalog to Saxon like this:

Processor xsl_proc = new Processor(config);
xsl_proc.setCatalogFiles("catalog.xml");

Hoping that someone has any ideas as to how to get this resolved.


Solution

  • Got a solution. I think it may have been an oversight, or simply did not realize it was needed. I edited the catalog file to also handle the 'xlink' uri:

    <!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"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="urn:oasis:names:tc:entity:xmlns:xml:catalog catalog.xsd"
              prefer="system">
      <rewriteSystem systemIdStartString="http://www.s1000d.org/" rewritePrefix="schemas/" />
      <rewriteURI uriStartString="http://www.s1000d.org/" rewritePrefix="schemas/" />
      <uri name="http://www.w3.org/1999/xlink" uri="schemas/S1000D_4-2/xml_schema_flat/xlink.xsd"/>
    </catalog>
    

    Everything ran through and validation was performed. Thanks to everyone who took time to look and provide feedback.