Combine Multiple RelaxNG Schemas

Questions about XML that are not covered by the other forums should go here.
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Combine Multiple RelaxNG Schemas

Post by kruncher »

Hi guys,

I have a large selection of RelaxNG schemas files. There is one root most file which is called "selector.rng", and this includes the various other RelaxNG modules.

Is there a utility that will combine all of these schemas into a single file?

Many thanks!
Lea Hayes
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Combine Multiple RelaxNG Schemas

Post by george »

Hello,

The latest version of Jing can get you a serialization of the simplified parsed schema. To get the latest Jing you can either

checkout the project from
http://code.google.com/p/jing-trang/source/checkout
and run ant

or

you can get a compiled jar that I posted here
http://code.google.com/p/jing-trang/iss ... l?id=79#c6

Then you can invoke it with something like

java -jar jing.jar -s selector.rng

Best Regards,
George
George Cristian Bina
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Re: Combine Multiple RelaxNG Schemas

Post by kruncher »

Thanks George, that is fantastic!

I have a couple of Schematron bits that get lost, but this isn't too much of a problem because I can just drop those back in manually.

Thanks again!
Lea Hayes
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Re: Combine Multiple RelaxNG Schemas

Post by kruncher »

Hi George,

I have another question regarding Jing and Trang.

I created the following Windows batch file using your advise, and this has been working great. In a Java project I have added the "jing.jar" and "trang.jar" into the build path. Do you know how I can replicate the following functionality in Java?

java -jar jing.jar -s rng\selector.rng > extensions.standalone.rng
java -jar trang.jar extensions.standalone.rng extensions.rnc

Essentially I would like to add two buttons to my program. One which combines RelaxNG schema into a single file, and another which does the same but also converts to RelaxNG Compact.

Many thanks,
Lea Hayes
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Combine Multiple RelaxNG Schemas

Post by george »

When you run from command line specifying a jar you actually invoke the main method of the class specified as main class in the jar manifest file. For Jing the main class us com.thaiopensource.relaxng.util.Driver while for Trang it is com.thaiopensource.relaxng.translate.Driver.
You can either invoke these methods or you can look how they are implemented and extract code from them create your class.

Best Regards,
George
George Cristian Bina
kruncher
Posts: 26
Joined: Tue Mar 31, 2009 5:47 pm

Re: Combine Multiple RelaxNG Schemas

Post by kruncher »

Thanks again for your help!
Post Reply