[
Lists Home |
Date Index |
Thread Index
]
> 2.) A RELAX NG can dynamically learn how to validate a type library by
> dereferencing the namespace URI. I've heard there are Java interfaces
> type library authors can implement so arbitrary RELAX NG validators can
> support them. In this case there should be no problem as long as the
dataype
> library is discoverable and implements the correct interfaces.
It doesn't actually dereference the namespace URI in the sense of
retrieving it. The way it works is:
- There's an (unofficial) standard API that provides an interface
org.relaxng.datatype.DatatypeLibraryFactory; this has a method
createDatatypeLibrary(x) that says "give me an implementation of the
datatypeLibrary with URI x", which may succeed or fail.
- An implementation must provide a class that implements this interface.
Let's suppose it's com.example.MyDatatypeLibraryFactory. The class files
must be collected into a jar file and the jar file must also contain a
text file META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory
which contains a single line "com.example.MyDatatypeLibraryFactory".
- Users must put the jar files for the datatype libraries they want to
use on their classpath.
- When a validator encounters a schema that uses datatype library with
URI X, it reads the files on its classpath called
META-INF/services/org.relaxng.datatype.DatatypeLibraryFactory to
discover the names of the implementing classes. It then instantiates
each in turn calling its createDatatypeLibrary method until it finds one
that can provide an implementation of the required datatype library.
This is a pretty standard pattern in the Java world. How would you do
this sort of thing in .NET?
It doesn't support automatic downloading of datatype library
implementations. I guess you do this by allowing the namespace URI to
point to an RDDL document that somehow identifies the JAR file providing
the implementation, download that and then run it in a sandbox. As far
as I know, no implementations yet support this sort of thing.
James
|