[Swift-commit] r2985 - in provenancedb: . validator

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Tue Jun 30 07:37:11 CDT 2009


Author: benc
Date: 2009-06-30 07:37:10 -0500 (Tue, 30 Jun 2009)
New Revision: 2985

Added:
   provenancedb/validator/
   provenancedb/validator/V.java
   provenancedb/validator/run
Log:
small java code to validate an OPM against the opm schema

Added: provenancedb/validator/V.java
===================================================================
--- provenancedb/validator/V.java	                        (rev 0)
+++ provenancedb/validator/V.java	2009-06-30 12:37:10 UTC (rev 2985)
@@ -0,0 +1,35 @@
+import org.openprovenance.model.v101A.*;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.ArrayList;
+import org.apache.xmlbeans.*;
+
+public class V {
+
+public static void main(String args[]) throws Exception {
+
+ XmlOptions options = new XmlOptions();
+                Collection errors = new ArrayList();
+                options.setErrorListener(errors);
+                options.setValidateOnSet();
+                options.setLoadLineNumbers();
+
+  OpmGraphDocument opmGraph = OpmGraphDocument.Factory.parse(new File(args[0]), options);
+
+  System.out.println("result of validation = "+opmGraph.validate(options));
+
+         System.out.println("Validation errors:");
+                        Iterator i = errors.iterator();
+                        while(i.hasNext()) {
+                                XmlError error = (XmlError) i.next();
+                                System.out.println(error.toString());
+                        }
+                        System.exit(3);
+
+
+
+}
+}
+

Added: provenancedb/validator/run
===================================================================
--- provenancedb/validator/run	                        (rev 0)
+++ provenancedb/validator/run	2009-06-30 12:37:10 UTC (rev 2985)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+export CLASSPATH=/Users/benc/work/cog/modules/swift/lib/xbean.jar
+export CLASSPATH=/Users/benc/work/cog/modules/swift/lib/jsr173_1.0_api.jar:$CLASSPATH
+
+java org.apache.xmlbeans.impl.tool.SchemaCompiler v1.01.a.xsd
+
+export CLASSPATH=./xmltypes.jar:$CLASSPATH
+
+javac V.java
+
+export CLASSPATH=.:$CLASSPATH
+
+java V ../tests/provenancedb/opm.xml
+


Property changes on: provenancedb/validator/run
___________________________________________________________________
Name: svn:executable
   + *




More information about the Swift-commit mailing list