-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support XML catalogs in Apache Ant Task #40
Comments
Theoretically this is pretty straight forward but: |
Alright, I'll lean back and enjoy the show. 🍸 🏖 |
Can you please check if |
The next SNAPSHOT (after 14:41 UTC) should do the trick - please try than. <schematron schematronFile="test.sch"
expectSuccess="true"
schematronProcessingEngine="pure">
<fileset dir=".">
<include name="test.xml" />
</fileset>
<xmlcatalog>
<dtd publicId="-//bla//DTD XML test//EN" location="test.dtd"/>
</xmlcatalog>
</schematron> |
build.xml <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="check">
<loadproperties srcfile="test.properties"/>
<!-- Create path -->
<path id="phsch.path">
<pathelement location="ph-schematron-ant-task-4.2.3-20170505.144759-8-jar-with-dependencies.jar"/>
<pathelement location="resolver.jar"/>
</path>
<xmlcatalog id="dita.catalog">
<catalogpath path="../../.dita/dita-ot/catalog-dita.xml"/>
</xmlcatalog>
<!-- Define <schematron> task -->
<taskdef name="schematron" classname="com.helger.schematron.ant.Schematron" classpathref="phsch.path" />
<target name="check">
<schematron schematronFile="test.sch" expectSuccess="true">
<fileset dir=".">
<include name="*.dita" />
</fileset>
<xmlcatalog refid="dita.catalog"/>
</schematron>
</target>
</project> Output
|
So
It's none of my business ;) |
I'll check that again, but I just pointed it to the DITA default. Could you please have a look at the syntax of my build.xml? Should this work? |
Looks good to me. I made the experience that the Java XML parser is quite strict... Maybe you can post the respective part of .dita/dita-ot/catalog-dita.xml(7:5) |
This is the file catalog.xml I'll switch the machine and try again. Thank you for the work and have a nice weekend. |
Seems like the base path is not correct. |
tl;dr: It works with the resolver.jar from the oXygen XML Test Filestest.dita <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic">
<title></title>
<body>
<p></p>
</body>
</topic> test.sch <?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
xmlns:sqf="http://www.schematron-quickfix.com/validator/process">
<sch:pattern>
<sch:rule context="*[contains(@class, ' topic/topic ')]">
<sch:assert test="buddy">Topics should have buddys, not bodys</sch:assert>
</sch:rule>
</sch:pattern>
</sch:schema> Scenario 1: With resolver.jarbuild.xml with resolver.jar <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="check">
<loadproperties srcfile="test.properties"/>
<path id="phsch.path">
<pathelement location="ph-schematron-ant-task-4.2.3-20170505.144759-8-jar-with-dependencies.jar"/>
<pathelement location="resolver.jar"/>
</path>
<xmlcatalog id="dita.catalog">
<catalogpath>
<pathelement location="org.oasis-open.dita.v1_3/catalog.xml"/>
</catalogpath>
</xmlcatalog>
<taskdef name="schematron" classname="com.helger.schematron.ant.Schematron" classpathref="phsch.path"/>
<target name="check">
<schematron schematronFile="test.sch" expectSuccess="true">
<xmlcatalog refid="dita.catalog"/>
<fileset dir=".">
<include name="*.dita"/>
</fileset>
</schematron>
</target>
</project> Output
Scenario 2: With ant-apache-resolver-1.9.7.jarbuild.xml with ant-apache-resolver-1.9.7.jar <?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="check">
<loadproperties srcfile="test.properties"/>
<path id="phsch.path">
<pathelement location="ph-schematron-ant-task-4.2.3-20170505.144759-8-jar-with-dependencies.jar"/>
<pathelement location="ant-apache-resolver-1.9.7.jar"/>
</path>
<xmlcatalog id="dita.catalog">
<catalogpath>
<pathelement location="org.oasis-open.dita.v1_3/catalog.xml"/>
</catalogpath>
</xmlcatalog>
<taskdef name="schematron" classname="com.helger.schematron.ant.Schematron" classpathref="phsch.path"/>
<target name="check">
<schematron schematronFile="test.sch" expectSuccess="true">
<xmlcatalog refid="dita.catalog"/>
<fileset dir=".">
<include name="*.dita"/>
</fileset>
</schematron>
</target>
</project> Output
@phax great work, I'll close this issue, because this is probably not an issue in your code. |
I added another test with a couple of directories but it all works fine. |
It would be nice, if ph-schematron would support XML catalogs. It would be perfect, if it would use the common principle from the
<xslt>
task.This would be very important to, e.g., work with DITA XML files, see grammar here: org.oasis-open.dita.v1_3
The text was updated successfully, but these errors were encountered: