different results using TRANG directly and from within oXygen

Hello, We patched Trang in Oxygen to fix this problem of correct namespace prefixes added to element names. You can apply the patch in Ant too by adding oxygen.jar in front of trang.jar to the classpath of your Ant task. Regards, Sorin Theun Fleer wrote:
hi
How is TRANG being called from <oXygen/>? When I convert a (simplified) RELAX NG Schema directly with TRANG using
java -jar trang.jar -I rng -O dtd myschema.rng myschema.dtd
the resulting DTD is not valid (regarding namespaces with "fixed prefixes")
I use this call (using ANT) to automate the process of converting RNG-schemas to DTDs (and XSDs) But when I convert the same myschema.rng from within <oXygen/> using Tools > Trang Converter... the result is a perfect DTD, valid and just how I want it to be. What's causing the differences? And how can I use TRANG from ANT in the same way as <oXygen/>?
groet Theun Fleer Daidalos, NL

Hi Sorin thank you for the very quick reply! This kind of support is only one of the reasons I like oxygen this much :-) We do not use classpath for ant, but macrodefs (and a copy of trang located in lib next to build.xml) in my build.xml we have the following macrodef: <macrodef name="trang2dtd" description="use trang to generate DTD. Input attributes are 'rng' for the input rngfile 'dtd' for the resulting dtdfile"> <attribute name="rng" default=""/> <attribute name="dtd" default=""/> <sequential> <echo message="trang: @{rng}"/> <java jar="lib/trang.jar" failonerror="true" maxmemory="128m" fork="true"> <arg value="-I"/> <arg value="rng"/> <arg value="-O"/> <arg value="dtd"/> <arg value="@{rng}"/> <arg value="@{dtd}"/> </java> </sequential> </macrodef> Do you know by any chance how to change this? Probably I should read the ANT-manual... :-) groet Theun _____ Van: oxygen-user-bounces@oxygenxml.com namens Sorin Ristache Verzonden: do 29-5-2008 15:30 Aan: oxygen-user@oxygenxml.com Onderwerp: Re: [oXygen-user] different results using TRANG directly and fromwithin oXygen Hello, We patched Trang in Oxygen to fix this problem of correct namespace prefixes added to element names. You can apply the patch in Ant too by adding oxygen.jar in front of trang.jar to the classpath of your Ant task. Regards, Sorin Theun Fleer wrote:
hi
How is TRANG being called from <oXygen/>? When I convert a (simplified) RELAX NG Schema directly with TRANG using
java -jar trang.jar -I rng -O dtd myschema.rng myschema.dtd
the resulting DTD is not valid (regarding namespaces with "fixed prefixes")
I use this call (using ANT) to automate the process of converting RNG-schemas to DTDs (and XSDs) But when I convert the same myschema.rng from within <oXygen/> using Tools > Trang Converter... the result is a perfect DTD, valid and just how I want it to be. What's causing the differences? And how can I use TRANG from ANT in the same way as <oXygen/>?
groet Theun Fleer Daidalos, NL
Drs. T. Fleer Consultant GSM: +31 (0)6 40 58 50 27 http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hello, You can set a classpath where you can control the order of the jar files instead of the jar attribute which specifies only one jar file: <sequential> <echo message="trang: @{rng}"/> <java classname="com.thaiopensource.relaxng.translate.Driver" failonerror="true" maxmemory="128m" fork="true"> <arg value="-I"/> <arg value="rng"/> <arg value="-O"/> <arg value="dtd"/> <arg value="@{rng}"/> <arg value="@{dtd}"/> <classpath> <pathelement location="lib/oxygen.jar"/> <pathelement location="lib/trang.jar"/> </classpath> </java> </sequential> Regards, Sorin Theun Fleer wrote:
Hi Sorin
thank you for the very quick reply! This kind of support is only one of the reasons I like oxygen this much :-)
We do not use classpath for ant, but macrodefs (and a copy of trang located in lib next to build.xml)
in my build.xml we have the following macrodef: <macrodef name="trang2dtd" description="use trang to generate DTD. Input attributes are 'rng' for the input rngfile 'dtd' for the resulting dtdfile"> <attribute name="rng" default=""/> <attribute name="dtd" default=""/> <sequential> <echo message="trang: @{rng}"/> <java jar="lib/trang.jar" failonerror="true" maxmemory="128m" fork="true"> <arg value="-I"/> <arg value="rng"/> <arg value="-O"/> <arg value="dtd"/> <arg value="@{rng}"/> <arg value="@{dtd}"/> </java> </sequential> </macrodef>
Do you know by any chance how to change this? Probably I should read the ANT-manual... :-)
groet Theun
_____
Van: oxygen-user-bounces@oxygenxml.com namens Sorin Ristache Verzonden: do 29-5-2008 15:30 Aan: oxygen-user@oxygenxml.com Onderwerp: Re: [oXygen-user] different results using TRANG directly and fromwithin oXygen
Hello,
We patched Trang in Oxygen to fix this problem of correct namespace prefixes added to element names. You can apply the patch in Ant too by adding oxygen.jar in front of trang.jar to the classpath of your Ant task.
Regards, Sorin
Theun Fleer wrote:
hi
How is TRANG being called from <oXygen/>? When I convert a (simplified) RELAX NG Schema directly with TRANG using
java -jar trang.jar -I rng -O dtd myschema.rng myschema.dtd
the resulting DTD is not valid (regarding namespaces with "fixed prefixes")
I use this call (using ANT) to automate the process of converting RNG-schemas to DTDs (and XSDs) But when I convert the same myschema.rng from within <oXygen/> using Tools > Trang Converter... the result is a perfect DTD, valid and just how I want it to be. What's causing the differences? And how can I use TRANG from ANT in the same way as <oXygen/>?
groet Theun Fleer Daidalos, NL
Drs. T. Fleer Consultant GSM: +31 (0)6 40 58 50 27
http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
------------------------------------------------------------------------
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

hi Sorin ah, thanks...but when I use your solution, I get the following messages: [echo] trang: tmp/be-jur-com.xsrng from lib C:\Program Files\Oxygen\Oxygen XML Editor 9.0/lib [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xni/grammars/XMLGrammarPool [java] at com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator.createXMLReader(Unknow n Source) [java] at com.thaiopensource.relaxng.parse.sax.SAXParseable.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.ParseInputFormat.load(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: org.apache.xerces.xni.grammars.XMLGrammarPool ... etc Is the classname com.thaiopensource.relaxng.translate.Driver (for TRANG) correct? Because when I comment the line <pathelement location="lib/oxygen.jar"/> it runs but results in an incorrect DTD. groet Theun -----Oorspronkelijk bericht----- Van: oxygen-user-bounces@oxygenxml.com [mailto:oxygen-user-bounces@oxygenxml.com] Namens Sorin Ristache Verzonden: donderdag 29 mei 2008 16:15 Aan: oxygen-user@oxygenxml.com Onderwerp: Re: [oXygen-user] different results using TRANG directlyand fromwithin oXygen Hello, You can set a classpath where you can control the order of the jar files instead of the jar attribute which specifies only one jar file: <sequential> <echo message="trang: @{rng}"/> <java classname="com.thaiopensource.relaxng.translate.Driver" failonerror="true" maxmemory="128m" fork="true"> <arg value="-I"/> <arg value="rng"/> <arg value="-O"/> <arg value="dtd"/> <arg value="@{rng}"/> <arg value="@{dtd}"/> <classpath> <pathelement location="lib/oxygen.jar"/> <pathelement location="lib/trang.jar"/> </classpath> </java> </sequential> Regards, Sorin Theun Fleer wrote:
Hi Sorin
thank you for the very quick reply! This kind of support is only one of the reasons I like oxygen this much :-)
We do not use classpath for ant, but macrodefs (and a copy of trang located in lib next to build.xml)
in my build.xml we have the following macrodef: <macrodef name="trang2dtd" description="use trang to generate DTD. Input attributes are 'rng' for the input rngfile 'dtd' for the resulting dtdfile"> <attribute name="rng" default=""/> <attribute name="dtd" default=""/> <sequential> <echo message="trang: @{rng}"/> <java jar="lib/trang.jar" failonerror="true" maxmemory="128m" fork="true"> <arg value="-I"/> <arg value="rng"/> <arg value="-O"/> <arg value="dtd"/> <arg value="@{rng}"/> <arg value="@{dtd}"/> </java> </sequential> </macrodef>
Do you know by any chance how to change this? Probably I should read the ANT-manual... :-)
groet Theun
_____
Van: oxygen-user-bounces@oxygenxml.com namens Sorin Ristache Verzonden: do 29-5-2008 15:30 Aan: oxygen-user@oxygenxml.com Onderwerp: Re: [oXygen-user] different results using TRANG directly and fromwithin oXygen
Hello,
We patched Trang in Oxygen to fix this problem of correct namespace prefixes added to element names. You can apply the patch in Ant too by
adding oxygen.jar in front of trang.jar to the classpath of your Ant task.
Regards, Sorin
Theun Fleer wrote:
hi
How is TRANG being called from <oXygen/>? When I convert a (simplified) RELAX NG Schema directly with TRANG using
java -jar trang.jar -I rng -O dtd myschema.rng myschema.dtd
the resulting DTD is not valid (regarding namespaces with "fixed prefixes")
I use this call (using ANT) to automate the process of converting RNG-schemas to DTDs (and XSDs) But when I convert the same myschema.rng from within <oXygen/> using Tools > Trang Converter... the result is a perfect DTD, valid and just how I want it to be. What's causing the differences? And how can I use TRANG from ANT in the same way as <oXygen/>?
groet Theun Fleer Daidalos, NL
Drs. T. Fleer Consultant GSM: +31 (0)6 40 58 50 27
http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
---------------------------------------------------------------------- --
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user
oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Yes, the Trang class name is correct. oxygen.jar includes some Xerces patches too so you have to add lib/xercesImpl.jar too to the classpath. I think you will need to add log4j.jar too to avoid such NoClassDefFoundError errors: <classpath> <pathelement location="lib/oxygen.jar"/> <pathelement location="lib/xercesImpl.jar"/> <pathelement location="lib/log4j.jar"/> <pathelement location="lib/trang.jar"/> </classpath> Regards, Sorin Theun Fleer wrote:
hi Sorin
ah, thanks...but when I use your solution, I get the following messages: [echo] trang: tmp/be-jur-com.xsrng from lib C:\Program Files\Oxygen\Oxygen XML Editor 9.0/lib [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xni/grammars/XMLGrammarPool [java] at com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator.createXMLReader(Unknow n Source) [java] at com.thaiopensource.relaxng.parse.sax.SAXParseable.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.ParseInputFormat.load(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: org.apache.xerces.xni.grammars.XMLGrammarPool ... etc
Is the classname com.thaiopensource.relaxng.translate.Driver (for TRANG) correct? Because when I comment the line <pathelement location="lib/oxygen.jar"/> it runs but results in an incorrect DTD.
groet Theun

hi Sorin now I get the following error messages: [java] log4j:WARN No appenders could be found for logger (ro.sync.util.v). [java] log4j:WARN Please initialize the log4j system properly. [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xml/resolver/helpers/Debug [java] at ro.sync.xml.parser.ParserCreator.A(Unknown Source) [java] at ro.sync.xml.parser.ParserCreator.newXRNoValid(Unknown Source) [java] at com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator.createXMLReader(Unknown Source) [java] at com.thaiopensource.relaxng.parse.sax.SAXParseable.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.ParseInputFormat.load(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: org.apache.xml.resolver.helpers.Debug ...etc... Any ideas why the log4j is not initialized properly? groet Theun _____ Van: oxygen-user-bounces@oxygenxml.com namens Sorin Ristache Verzonden: vr 30-5-2008 13:44 Aan: oxygen-user@oxygenxml.com Onderwerp: Re: [oXygen-user] different results using TRANG directlyand fromwithinoXygen Yes, the Trang class name is correct. oxygen.jar includes some Xerces patches too so you have to add lib/xercesImpl.jar too to the classpath. I think you will need to add log4j.jar too to avoid such NoClassDefFoundError errors: <classpath> <pathelement location="lib/oxygen.jar"/> <pathelement location="lib/xercesImpl.jar"/> <pathelement location="lib/log4j.jar"/> <pathelement location="lib/trang.jar"/> </classpath> Regards, Sorin Theun Fleer wrote:
hi Sorin
ah, thanks...but when I use your solution, I get the following messages: [echo] trang: tmp/be-jur-com.xsrng from lib C:\Program Files\Oxygen\Oxygen XML Editor 9.0/lib [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xni/grammars/XMLGrammarPool [java] at com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator.createXMLReader(Unknow n Source) [java] at com.thaiopensource.relaxng.parse.sax.SAXParseable.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.ParseInputFormat.load(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: org.apache.xerces.xni.grammars.XMLGrammarPool ... etc
Is the classname com.thaiopensource.relaxng.translate.Driver (for TRANG) correct? Because when I comment the line <pathelement location="lib/oxygen.jar"/> it runs but results in an incorrect DTD.
groet Theun
Drs. T. Fleer Consultant GSM: +31 (0)6 40 58 50 27 http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hello, The log4j system needs a set of initialization properties. You need to add the attached file called log4j.properties to the same lib folder where oxygen.jar, trang.jar, etc are located and to use the following classpath element in your Ant task: <classpath> <pathelement location="lib/oxygen.jar"/> <pathelement location="lib/xercesImpl.jar"/> <pathelement location="lib/log4j.jar"/> <pathelement location="lib/resolver.jar"/> <pathelement location="lib/trang.jar"/> <pathelement location="lib/"/> </classpath> Regards, Sorin Theun Fleer wrote:
hi Sorin now I get the following error messages: [java] log4j:WARN No appenders could be found for logger (ro.sync.util.v). [java] log4j:WARN Please initialize the log4j system properly. [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xml/resolver/helpers/Debug [java] at ro.sync.xml.parser.ParserCreator.A(Unknown Source) [java] at ro.sync.xml.parser.ParserCreator.newXRNoValid(Unknown Source) [java] at com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator.createXMLReader(Unknown Source) [java] at com.thaiopensource.relaxng.parse.sax.SAXParseable.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.ParseInputFormat.load(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: org.apache.xml.resolver.helpers.Debug ...etc... Any ideas why the log4j is not initialized properly? groet Theun
log4j.rootCategory= error, R log4j.appender.R=org.apache.log4j.ConsoleAppender log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%r %p [ %t ] %c - %m%n

hi Sorin thanks a lot! works like a charm now! Just for the record: we also generate XSDs from the same RELAX schemas. Is it wise to use the same jars in combination with TRANG for the conversion to XSDs? In other words: did you fix some bugs in that conversion too? :-) I do not notice any diffs from the XSDs from TRANG directly and XSDs generated using oXygen. But I could have missed something... just to be sure. groet Theun _____ Van: oxygen-user-bounces@oxygenxml.com namens Sorin Ristache Verzonden: di 3-6-2008 14:14 Aan: oxygen-user@oxygenxml.com Onderwerp: Re: [oXygen-user] different results using TRANG directly and fromwithin oXygen Hello, The log4j system needs a set of initialization properties. You need to add the attached file called log4j.properties to the same lib folder where oxygen.jar, trang.jar, etc are located and to use the following classpath element in your Ant task: <classpath> <pathelement location="lib/oxygen.jar"/> <pathelement location="lib/xercesImpl.jar"/> <pathelement location="lib/log4j.jar"/> <pathelement location="lib/resolver.jar"/> <pathelement location="lib/trang.jar"/> <pathelement location="lib/"/> </classpath> Regards, Sorin Theun Fleer wrote:
hi Sorin now I get the following error messages: [java] log4j:WARN No appenders could be found for logger (ro.sync.util.v). [java] log4j:WARN Please initialize the log4j system properly. [java] Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xml/resolver/helpers/Debug [java] at ro.sync.xml.parser.ParserCreator.A(Unknown Source) [java] at ro.sync.xml.parser.ParserCreator.newXRNoValid(Unknown Source) [java] at com.thaiopensource.xml.sax.Jaxp11XMLReaderCreator.createXMLReader(Unknown Source) [java] at com.thaiopensource.relaxng.parse.sax.SAXParseable.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.SchemaBuilderImpl.parse(Unknown Source) [java] at com.thaiopensource.relaxng.input.parse.ParseInputFormat.load(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.doMain(Unknown Source) [java] at com.thaiopensource.relaxng.translate.Driver.main(Unknown Source) [java] Caused by: java.lang.ClassNotFoundException: org.apache.xml.resolver.helpers.Debug ...etc... Any ideas why the log4j is not initialized properly? groet Theun
Drs. T. Fleer Consultant GSM: +31 (0)6 40 58 50 27 http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend.

No patches for conversion to XSD. The output of command line Trang is the same as the output of Trang embedded in Oxygen. Regards, Sorin Theun Fleer wrote:
hi Sorin
thanks a lot! works like a charm now!
Just for the record: we also generate XSDs from the same RELAX schemas. Is it wise to use the same jars in combination with TRANG for the conversion to XSDs? In other words: did you fix some bugs in that conversion too? :-)
I do not notice any diffs from the XSDs from TRANG directly and XSDs generated using oXygen. But I could have missed something... just to be sure.
groet Theun
participants (2)
-
Sorin Ristache
-
Theun Fleer