Schema location during development

This should cover W3C XML Schema, Relax NG and DTD related problems.
Grismar
Posts: 2
Joined: Fri May 04, 2012 12:16 pm

Schema location during development

Post by Grismar »

Hi,

I have to do some work on schema's and documents developed by someone else at another location. From my location, the schemalocations are not accessible (they're on an internal network).

What is the best way to work on these documents, being able to validate them, without network access to the schemalocation?

I can think of a few workarounds:
- redirect requests to the schemalocation to a local server and host the xsd from there;
- temporarily replace the schemalocations with local locations and change them back when delivering the results;

Neither is very satisfying though and I was wondering if oXygen offered some way to deal with this problem internally? Or am I missing some obvious way to deal with this problem that is not particular to oXygen?

Any hints or suggestions appreciated,
Grismar.
Costin
Posts: 833
Joined: Mon Dec 05, 2011 6:04 pm

Re: Schema location during development

Post by Costin »

Hello,

When having remote DTDs/schemas, it is good practice to create a local copy of them and use an XML catalog to redirect the remote URIs/systemIDs to the local copy.

Documentation regarding the use of XML catalogs can be found in the Oxygen user manual:
Working with XML Catalogs

e.g. XML Catalog file with different types of mappings inside it:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system systemId="http://www.docbook.org/xml/4.4/docbookx.dtd"
uri="frameworks/docbook/4.4/dtd/docbookx.dtd"/>
<uri name="http://www.oasis-open.org/docbook/xml/5.0/rng/docbook.rng"
uri="frameworks/docbook/5.0/rng/docbookxi.rng"/>
<uri name="http://www.w3.org/2004/10/xml.xsd" uri="xml.xsd"/>
<systemSuffix systemIdSuffix="docbookx.dtd"
uri="frameworks/docbook/dtd/docbookx.dtd"/>
<uriSuffix uriSuffix="docbook.xsl"
uri="frameworks/docbook/xsl/fo/docbook.xsl"/>
</catalog>
You could also redirect whole sets of URIs/systemIDs by using a rewriting entry in your catalog file. More detailed information about rewriting the entries is available in the OASIS specification, at the following link:
http://www.oasis-open.org/committees/en ... #s.rewrite

For your convenience, here is an example of rewrites - based on the above:

Code: Select all


   <rewriteSystem systemIdStartString="="http://www.docbook.org/xml/4.4/" rewritePrefix="frameworks/docbook/4.4/dtd/"/>
<rewriteURI uriStartString="http://www.oasis-open.org/docbook/xml/5.0/rng/" rewritePrefix="frameworks/docbook/5.0/rng/" />
In Oxygen you can add XML catalogs in Options > Preferences, XML > XML Catalog.

Let us know if you need additional assistance.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
Grismar
Posts: 2
Joined: Fri May 04, 2012 12:16 pm

Re: Schema location during development

Post by Grismar »

I will read the relevant manual entry, thank you for that. From the first cursory glance, this does appear to be what I was looking for.

Greetings,
Grismar.
Post Reply