Re: Re: Validating in 1.5

Elliotte Harold <[email protected]> Fri, 29 Oct 2004 11:22:07 -0400
Newsgroups gmane.text.xml.relaxng.general
Message-ID <[email protected]>
Thanks. That looks like what I need, but it doesn't seem to be working:

[elharo@stallion elharo]$ java 
-Xbootclasspath/p:jing.jar:isorelax.jar:iso-relax-tiger.jar Relax 
greeting.rng greeting.xml
This implementation does not support RELAX NG.
http://relaxng.org/ns/structure/1.0
java.lang.IllegalArgumentException: http://relaxng.org/ns/structure/1.0
         at 
javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:186)
         at Relax.main(Relax.java:19)


Relax is my own class. I tried this on both classpath and bootclasspath. 
The line it's dying on is just loading the RELAX NG schema factory. Up 
to that point the code is:

import javax.xml.*;
import javax.xml.validation.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import java.io.*;
import org.xml.sax.*;

public class Relax implements ErrorHandler {

   public static void main(String[] args) {

     if (args.length < 2) {
       System.out.println("Usage: java Relax schema.rng file.xml");
       return;
     }

     Schema schema;
     try {
       SchemaFactory factory = 
SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);
       schema = factory.newSchema(new File(args[1]));
     }
     // ...

The web page says, "this release is designed to work with Tiger beta 1, 
and it probably won't work with the official Tiger release (as the 
validation API is still not finialized)" Has anyone gotten this to work 
with the final 1.5 yet? Or are there any other JAR files I'm missing?


-- 
Elliotte Rusty Harold  [email protected]
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim