Ant integration with XML schemas
This should cover W3C XML Schema, Relax NG and DTD related problems.
-
- Posts: 25
- Joined: Wed Apr 15, 2015 8:27 am
Ant integration with XML schemas
Hello,
we have developed an rng file with embedded rules of Relaxng and schematron.
But we want to integrate both the schemas(relaxng and schematron) in to single ant build file.
We have already found a jar file (JING.jar) which integrates relaxNG rules with ant environment and (ant-schematron.jar) file which validates only schematron rules.,
but we want a build or jar file which validates both the schema rules of an XML file simultaneously.
We neither couldn't find such kind of jar file or couldn't integrate both the schemas in to a single build file.
Is there a way to validate an xml file with embedded schema rules(Relaxng and schematron) through ant build file.
Thank you
Regards
Sai
we have developed an rng file with embedded rules of Relaxng and schematron.
But we want to integrate both the schemas(relaxng and schematron) in to single ant build file.
We have already found a jar file (JING.jar) which integrates relaxNG rules with ant environment and (ant-schematron.jar) file which validates only schematron rules.,
but we want a build or jar file which validates both the schema rules of an XML file simultaneously.
We neither couldn't find such kind of jar file or couldn't integrate both the schemas in to a single build file.
Is there a way to validate an xml file with embedded schema rules(Relaxng and schematron) through ant build file.
Thank you
Regards
Sai
-
- Posts: 9424
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Ant integration with XML schemas
Hi Sai,
When you validate an XML with a Relax NG with embedded Schematron rules, you actually need to perform two separate validations. So you would probably need to do something like:
1) Validate the XML with the Relax NG schema using Jing.
2) Extract from the Relax NG schema the Schematron rules to an external temporary Schematron file by applying an XSLT stylesheet over the RNG schema. You can find such a stylesheet here:
OXYGEN_INSTALL_DIR\frameworks\schematron\impl\RNG2Schtrn.xsl
3) Use that temporary created Schematron file to validate the XML document.
Regards,
Radu
When you validate an XML with a Relax NG with embedded Schematron rules, you actually need to perform two separate validations. So you would probably need to do something like:
1) Validate the XML with the Relax NG schema using Jing.
2) Extract from the Relax NG schema the Schematron rules to an external temporary Schematron file by applying an XSLT stylesheet over the RNG schema. You can find such a stylesheet here:
OXYGEN_INSTALL_DIR\frameworks\schematron\impl\RNG2Schtrn.xsl
3) Use that temporary created Schematron file to validate the XML document.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 25
- Joined: Wed Apr 15, 2015 8:27 am
Re: Ant integration with XML schemas
Hi Radu,
Thanks for the solution.
We have a doubt if we could run the xml schema(relaxNG + schematron) validations through command line arguments instead of oXygen XML editor GUI.
Thank you
Sai
Thanks for the solution.
We have a doubt if we could run the xml schema(relaxNG + schematron) validations through command line arguments instead of oXygen XML editor GUI.
Thank you
Sai
-
- Posts: 25
- Joined: Wed Apr 15, 2015 8:27 am
Re: Ant integration with XML schemas
According to this solution given by Radu
but when we ran the ant build file after adding ant-schematron.jar file to the environment, we got the following error
build.xml
error:
could you please help us to resolve this issue.
Thank you
Sai
We have used the RNG2Schtrn.xsl to generate a schematron file.Hi Sai,
When you validate an XML with a Relax NG with embedded Schematron rules, you actually need to perform two separate validations. So you would probably need to do something like:
1) Validate the XML with the Relax NG schema using Jing.
2) Extract from the Relax NG schema the Schematron rules to an external temporary Schematron file by applying an XSLT stylesheet over the RNG schema. You can find such a stylesheet here:
OXYGEN_INSTALL_DIR\frameworks\schematron\impl\RNG2Schtrn.xsl
3) Use that temporary created Schematron file to validate the XML document.
Regards,
Radu
but when we ran the ant build file after adding ant-schematron.jar file to the environment, we got the following error
build.xml
Code: Select all
<taskdef name="schematron"
classname="com.schematron.ant.SchematronTask"
classpath="lib\ant-schematron.jar" />
<target name="validate" description="Test with a Fileset">
<schematron schema="sch/sample.sch" failonerror="false">
<fileset dir="xml" includes="*.xml" />
</schematron>
</target>
saxonhe.jar and ant-schematron.jar are added to the respective local ant environment path, but still we are getting this error.java.lang.NoClassDefFoundError: net/sf/saxon/TransformerFactoryImpl
could you please help us to resolve this issue.
Thank you
Sai
-
- Posts: 9424
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Ant integration with XML schemas
Hi Sai,
Your taskdef seems to refer a single JAR library. Maybe it should also refer to the Saxon 9 libraries.
I'm not sure if you are running the task with fork="true" or not. Because if you fork it, it will definitely not use the JAR libraries from the parent ANT process.
So maybe you should give all the necessary libraries to the task:
Regards,
Radu
Your taskdef seems to refer a single JAR library. Maybe it should also refer to the Saxon 9 libraries.
I'm not sure if you are running the task with fork="true" or not. Because if you fork it, it will definitely not use the JAR libraries from the parent ANT process.
So maybe you should give all the necessary libraries to the task:
Code: Select all
<path id="libraries">
<fileset dir="lib/saxon/">
<include name="*.jar"/>
</fileset>
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="schematron"
classname="com.schematron.ant.SchematronTask"
classpathref="libraries" />
...............
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 25
- Joined: Wed Apr 15, 2015 8:27 am
Re: Ant integration with XML schemas
Hi Radu,
Thanks for the solution.
Is it possible to run the xml schema(relaxNG + schematron) validation files through command line arguments instead of oXygen XML editor GUI?
Thank you
Sai
Thanks for the solution.
Is it possible to run the xml schema(relaxNG + schematron) validation files through command line arguments instead of oXygen XML editor GUI?
Thank you
Sai
-
- Posts: 9424
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Ant integration with XML schemas
Hi Sai,
If you mean that you want to call from the command line the "Validate" action which is done inside Oxygen, then no.
If you want to run an ANT script (the script you are building) from the command line, of course, this is possible.
Regards,
Radu
If you mean that you want to call from the command line the "Validate" action which is done inside Oxygen, then no.
If you want to run an ANT script (the script you are building) from the command line, of course, this is possible.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service