GithubHelp home page GithubHelp logo

schematron / ant-schematron Goto Github PK

View Code? Open in Web Editor NEW
3.0 7.0 0.0 5.69 MB

Ant task for running Schematron

License: MIT License

HTML 36.97% CSS 0.15% XSLT 41.56% Java 7.24% Rich Text Format 14.08%
schematron apache-ant

ant-schematron's Introduction

Ant task for running Schematron

The schematron-ant.jar task allows ISO Schematron validation and reporting from an ANT script.

License

The MIT License

Copyright (c) 2008 Rick Jelliffe, Topologi Pty. Ltd, Allette Systems

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ant-schematron's People

Contributors

rjelliffe avatar tgraham-antenna avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ant-schematron's Issues

Schematron from ant doesn't respect class path definitions for file

Moved from Schematron/schematron#13

What steps will reproduce the problem?
1. Running the schematron task without saxon defined in the system classpath

See 
http://stackoverflow.com/questions/23132201/setting-ant-classpath-in-build-xml 
for someone [else]'s description of and proposed solution to the problem.

This is an issue when you can't define the classpath for saxon ahead of running 
an ant script.

Using XML Catalog with "doctyped" xml files

From Schematron/schematron#9 (also has attachments):

Hi, 

I ran "google.code.schematron\trunk\ant-schematron\test\ant\build.xml" with 
target "ant test-resolver-1"

Everything is fine from the original declared target : 
<!-- Resolver -->
<target name="test-resolver-1" description="Simple test">
    <taskdef name="schematron" classname="com.schematron.ant.SchematronTask" classpath="../lib/*.jar"/>
    <schematron schema="../schemas/test.sch" file="../xml/test1.xml" failonerror="false"
    debugmode="true"  resolver="org.apache.xml.resolver.tools.CatalogResolver"

    classpath="../lib/resolver.jar" 
    catalog="xxx.xml" 

    fileNameParameter="XXX"  fileDirParameter="ABC"/>
</target>

but this target defines an non existent catalog (xxx.xml).

SO I defined a catalog.xml file which contains : 
<public publicId="-//DOG//EN" 
uri="file:///C:/google.code.schematron/trunk/ant-schematron/test/ant/dog.dtd"/>

It points to dod.dtd with absolute uri (file is located at the same level as 
the build.xml file).

See attached files.

I then added the following doctype to test1.xml : 
<!DOCTYPE Dog PUBLIC "-//DOG//EN" "dog.dtd">

And when running "ant test-resolver-1"
I get the following error : 
test-resolver-1:
[schematron] Error
[schematron] java.io.FileNotFoundException:
[schematron] C:\google.code.schematron\trunk\ant-schematron\test\xml\dog.dtd 
[schematron] DEBUG: error
[schematron] Could not validate document 
C:\google.code.schematron\trunk\ant-sche
xml\test1.xml
[schematron] java.io.FileNotFoundException: 
C:\google.code.schematron\trunk\ant-s
st\xml\dog.dtd (Le fichier spécifié est introuvable)
BUILD FAILED

It seems dog.dtd file is being searched in "../xml" folder, which indicates the 
catalog resolver didn't work.

In oXygen, I added the catalog.xml files in catalog list, and I can 
successfully validate test1.xml. 
Note that I need to add catalog/@prefer="public" in catalog.xml so it works.


Configuration : 

* OS : windows 7 Pro

* JAVA : java version "1.6.0_20"

* ANT : Apache Ant(TM) version 1.8.2 compiled on December 20 2010
(I define ANT_HOME variable)

* SCHEMATRON : I get the whole test files from mercurial repo on 2011-08-30, 
the ant-schematron/test/lib folder contains : 
ant-schematron.jar
resolver.jar
saxon8.jar
saxon9.jar
saxon9.jar.old
saxon9he.jar

* SAXON : saxon9he.jar is in my CLASSPATH. If not I get an ANT error message. 
Version is : Saxon-HE 9.2.1.1J from Saxonica

I know saxon need a few options to be fixed so it work with a catalog : 

-r "Use URIResolver class" has to be set to 
"org.apache.xml.resolver.tools.CatalogResolver" which seems to be parameted by 
schematron/@resolver attribute

But also :
-x "Use specified SAX parser for source" has to be set to 
"file:org.apache.xml.resolver.tools.ResolvingXMLReader"

-y "Use specified SAX parser for stylesheet" also has to be set to 
"file:org.apache.xml.resolver.tools.ResolvingXMLReader"

But I don't see any attributes to set these parameters in the pdf doc  ("Using 
Schematron for Ant.pdf"). 
By the way, in this PDF, i think there is a mistake at parameter 
"xml.catalog.files" which should be "catalog" (attribute to schematron element)


Any help welcome !
(maybe I should post this on another place, but I can't find where ?)

Best Regards,
Matthieu

Original issue reported on code.google.com by [email protected] on 1 Sep 2011 at 9:53

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.