Trying to use custom datatype library in RELAX NG

This should cover W3C XML Schema, Relax NG and DTD related problems.
Posts: 1

Trying to use custom datatype library in RELAX NG

Thu Mar 12, 2009 11:03 pm

I'm trying to make use of a datatype library I have defined in an XML Schema document in Oxygen for Eclipse.

Here's a portion of my RELAX NG schema where I try to import the custom library:

Code: Select all

<element name="foo">
  <data type="myCustomType" datatypeLibrary="" />

Here's the schema itself (in my-datatypes.xsd in the same directory):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs=""

    <xs:complexType name="myCustomType">
        <xs:attribute name="id" type="xs:positiveInteger" use="required" />
        <xs:attribute name="name" type="xs:string" use="optional" />

I know that Oxygen can find this schema because I created an XML Catalog to point to this local version. If I right click on the URI in the datatypeLibrary attribute and select "Open File at Caret", the .xsd file is opened. I've tried changing the local resource that the XML Catalog points to and Oxygen opens up the correct file each time. So that seems fine.

However, Oxygen seems to keep telling me my RELAX NG document is invalid:
[oNVDL] datatype library "" not recognized

Can anyone give any clues as to where I'm going wrong? :)
Posts: 4144

Re: Trying to use custom datatype library in RELAX NG

Fri Mar 13, 2009 3:51 pm


In RELAX NG a data type library is loaded from an external library file not from an XML Schema. Oxygen uses the Jing validator which requires a Java library that implements the data types, that is a jar file in the classpath of the application. You have to create Java classes that implement org.relaxng.datatype.Datatype, org.relaxng.datatype.DatatypeLibrary and org.relaxng.datatype.DatatypeLibraryFactory and include them in a jar that you copy to [Oxygen-install-folder]/lib.


Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 1 guest