Git Product home page Git Product logo

probatron4j's People

Contributors

cngkaygusuz avatar

Watchers

 avatar  avatar

probatron4j's Issues

Probatron fails to find a document(), I think

What steps will reproduce the problem?
1. /Library/Java/Home/bin/java -jar /Users/syd/bin/probatron.jar -r1 -n1
sourceFile.xml rulesFile.sch 2> /dev/null | xmllint --format - | egrep -i debug
2. [See attached files sourceFile.xml, rulesFile.sch, dataFile.xml]

What is the expected output? What do you see instead?
[See attached file resultsFile.txt]

What version of the product are you using? On what operating system?
Probatron4J on Mac OS X 10.5.8 running the following java:
|java version "1.5.0_20"
|Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_20-b02-315)
|Java HotSpot(TM) Client VM (build 1.5.0_20-141, mixed mode, sharing)


Please provide any additional information below.
See postings to the schematron-love-in mailing list
(https://lists.sourceforge.net/lists/listinfo/schematron-love-in) of today
with subject 'canonical method to say "pointing to a <foo>"'.

Original issue reported on code.google.com by [email protected] on 10 Sep 2009 at 11:30

Attachments:

Multiple phases

User has requested allowing specification of multiple phases per run.

Original issue reported on code.google.com by [email protected] on 20 Oct 2009 at 8:01

Enhance the code to be more usable from the Java code

IMHO, the current version of Probatron4J is specifically designed for
command line usages. It is not very usable from the java code.

The expectations that I have from Probatron4J is -  
  Should take a xml document and schematron schema, validate the document
against schema and return result in the form of an object. 
The object (say ValidationResult) should have a method which tells whether
validation is successful and another method to return list of error messages.

I tried to use the SchematronSchema class to do the validation for me.
The problems that I faced are -
1. The SchematronSchema.validateCandidate(URL url) method takes URL of the
candidate xml document. This is useful if the xml to be verified is a file
or URL. However, in the java code, the xml is likely to be in the form of a
String or stream. There is no way to convert string to URL, without
writting the string to a file and its a bad solution.

SchematronSchema has a validateCandidate(InputStream is) method, but it is
private.

2. After validation, validateCandidate() method returns ValidationReport
object which holds the bytes for the complete report XML. There is no class
in probatron jar which helps to retrieve error messages from this report XML.

Solutions that I propose - 
1. Make SchematronSchema.validateCandidate(InputStream is) method public,
so that xml which is in the form of String can be passed for validation. We
can also create a overloaded method which takes string.

2. Provide a mechanism to get the validation result in the form of a object
with the list of error messages. 
To do this, we need to create a Document object from the result stream and
then apply the XPath '//failed-assert/text/text()' to get the error messages.


I am using 0.7.1 version of Probatron4J.

Please let me know your opinion. I can provide the patch for the required
changes.

Original issue reported on code.google.com by [email protected] on 16 Sep 2009 at 4:26

Probatron changes system property 'javax.xml.transform.TransformerFactory'

Hi,

At line 59, of the Utils.java, it changes the system property 
'javax.xml.transform.TransformerFactory'

 System.setProperty( PROPERTY_TRAX_IMPLEMENTATION, SAXON_TRAX_CLASS );

It creates problem when the system uses another impl. TransformerFactory.

It is unexpected behavior and creates side-effect

Kind regards

Original issue reported on code.google.com by [email protected] on 11 Mar 2014 at 10:01

File included in schema via <include> not found

What steps will reproduce the problem?

1. Schema (testSchema.sch) contains:

<schema xmlns="http://purl.oclc.org/dsdl/schematron">
  <include href="testSchema-include.sch"></include>
  <pattern name="...">...</pattern>
</schema>


2. Included schema contains

<pattern name="..." xmlns="http://purl.oclc.org/dsdl/schematron">...</pattern>

3. Run probatron:

java -jar "probatron.jar" testDocument.xml testSchema.sch 

4. Try again with absolute file path in the @href attribute (both
"file:/C:/..." and "file:///C:/...")


What is the expected output? What do you see instead?

Error message appears:

Recoverable error on line 359 
  FODC0002: java.net.MalformedURLException

Unable to open referenced included file: testSchema-include.sch
Unable to locate id attribute: testSchema-include.sch

Then the output of just the <pattern> in the main schema appears.


What version of the product are you using? On what operating system?

Probatron4j 0.7.1
Java 1.6.0_03
Windows XP Professional SP 2


The schema was successfully compiled with Saxon using the standard
iso_dsdl_include.xsl stylesheet


Original issue reported on code.google.com by [email protected] on 28 Jul 2009 at 8:31

using schematron with external files for validation - FileNotFoundException

I'm using probatron programatically in a jar, with the schematron file
included. Inside the schematron, I'm using a reference to another file that
contains a list of accepted values :

<iso:report test="document('./annex.xml')...>

When running probatron from the command line, with the schematron and
include file in the same folder, I have no issues at all.

However, when I try to use it programatically, the schematron.sch and
annex.xml files are located in :

src/main/resources/sch/

After the build, the classes folder structure is as follows :

bar/foo/myClass.class
sch/schematron.sch
sch/annex.xml

Within the code, I use the following to set the schemadoc :

    URL schemaLocation =
SumehrValidator.class.getResource(SCHEMATRON_FILE_NAME);
    theSession.setSchemaDoc(schemaLocation.toString());

Now, when I perform theSession.doValidation(filename), I get a
FileNotFoundException :

Recoverable error on line 1011 
  FODC0002: java.io.FileNotFoundException:
  C:\eclipse\workspace\bar\foo\annex.xml (The system cannot find
  the file specified)

As the included file is in the same directory as the schematron file, is
there a way to prevent the system from looking in the jar's root folder ?


Original issue reported on code.google.com by [email protected] on 28 Apr 2010 at 9:42

Not support Schema-Aware XSLT Processor ?

What steps will reproduce the problem?
1. Schema (spatialObservation.sch) contains
    <xsl:import-schema
        schema-location="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
    <xsl:import-schema
        schema-location="http://schemas.opengis.net/om/2.0/observation.xsd"/>
2. Run probatron:
  java -jar probatron.jar spatial_observation1.xml spatialObservation.sch
3.

What is the expected output? What do you see instead?
   probatron only support Basic XSLT Processor  ?

Error at xsl:import-schema on line 34 column 87
  XTSE1650: To use xsl:import-schema, you need the schema-aware version of Saxon from
  http://www.saxonica.com/

What version of the product are you using? On what operating system?
Java jdk1.6.0_20
Windows XP Professional 

Please provide any additional information below.
Exception in thread "main" java.lang.RuntimeException: Cannot instantiate XSLT 
transformer, or tra
formation failure: Failed to compile stylesheet. 3 errors detected.
        at org.probatron.SchematronSchema.validateCandidate(Unknown Source)
        at org.probatron.SchematronSchema.validateCandidate(Unknown Source)
        at org.probatron.Session.doValidation(Unknown Source)
        at org.probatron.Driver.main(Unknown Source)
Caused by: javax.xml.transform.TransformerConfigurationException: Failed to 
compile stylesheet. 3

Original issue reported on code.google.com by [email protected] on 6 Apr 2014 at 2:52

Attachments:

Sample schematron validation code

Hello,

I need to validate an xml file using a xslt transformer and of course a 
schematron schema. When I try to run probatron.jar without my custom xslt file, 
it gives me that error :

Error at xsl:stylesheet on line 297 column 31
  XTSE0010: Element xsl:stylesheet must not appear directly within xsl:stylesheet
FATAL Failed to compile stylesheet. 27 errors detected.
Exception in thread "main" java.lang.RuntimeException: Cannot instantiate XSLT 
transformer, or trans
formation failure: Failed to compile stylesheet. 27 errors detected.
        at org.probatron.SchematronSchema.validateCandidate(Unknown Source)
        at org.probatron.SchematronSchema.validateCandidate(Unknown Source)
        at org.probatron.Session.doValidation(Unknown Source)
        at org.probatron.Driver.main(Unknown Source)
Caused by: javax.xml.transform.TransformerConfigurationException: Failed to 
compile stylesheet. 27 e
rrors detected.
        at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:176)
        at net.sf.saxon.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:139)
        at net.sf.saxon.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:91)
        ... 4 more

I also need to run validation through java code, I have tried some samples but 
I couldn't manage to run validation for my local xml and schema from code. Can 
you please show me a snippet to run validation. Thanks in advance.


Original issue reported on code.google.com by [email protected] on 14 Aug 2013 at 7:04

Rule assert not running

i have a schematron file and xml file. 
What is the expected output? What do you see instead?
i need to see schematron error but not found

What version of the product are you using? On what operating system?
0.7.4

Please provide any additional information below.
at the schema there is a rule 
<assert test="not(gl-cor:documentNumber) or gl-cor:documentType">error</assert>

the first entry detail have that condition buth probatron not found it.

Original issue reported on code.google.com by [email protected] on 16 Dec 2014 at 11:44

Attachments:

FATAL java.lang.IllegalArgumentException: Cannot register a prefix or Namespace

tried to run

java -jar probatron.jar 
https://www.seegrid.csiro.au/subversion/GeoSciML/branches/3.0.0/instances/TB4_GS
C_WaterAnalytical_isotopes_swe.xml 
https://www.seegrid.csiro.au/subversion/GeoSciML/branches/3.0.0/schematron/GeoSc
iML_v3_Testbed_4.sch

and got

FATAL java.lang.IllegalArgumentException: Cannot register a prefix or Namespace
name that has already been registered
java.lang.IllegalArgumentException: Cannot register a prefix or Namespace name 
that has already been registered
        at org.probatron.NamespacePrefixMappings.registerMapping(Unknown Source)

        at org.probatron.LocationMapHandler.startElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle
ment(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.
emptyElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scan
StartElement(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l$FragmentContentDriver.next(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(U
nknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next
(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp
l.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(U
nknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
        at org.probatron.ValidationReport.annotateWithLocators(Unknown Source)
        at org.probatron.Session.doValidation(Unknown Source)
        at org.probatron.Driver.main(Unknown Source)
Exception in thread "main" java.lang.RuntimeException: Cannot register a prefix
or Namespace name that has already been registered
        at org.probatron.ValidationReport.annotateWithLocators(Unknown Source)
        at org.probatron.Session.doValidation(Unknown Source)
        at org.probatron.Driver.main(Unknown Source)

Original issue reported on code.google.com by [email protected] on 14 Aug 2012 at 3:20

Default URL base?

currently is app folder; probably should be schema document (spec?)


Original issue reported on code.google.com by [email protected] on 10 Nov 2009 at 3:55

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.