checkin for alpha release attempt
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
<artifactId>Mustang-CLI</artifactId>
|
<artifactId>Mustang-CLI</artifactId>
|
||||||
<name>Mustang commandline tool</name>
|
<name>Mustang commandline tool</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.9.0-alpha1</version>
|
<version>1.9.0-alpha1-SNAPSHOT</version>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<!-- for jargs -->
|
<!-- for jargs -->
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>validator</artifactId>
|
<artifactId>validator</artifactId>
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>1.9.0-alpha1</version>
|
||||||
<!-- prototypes of new mustangproject versions can be installed by referring to them and installed to the local repo from a jar file with
|
<!-- prototypes of new mustangproject versions can be installed by referring to them and installed to the local repo from a jar file with
|
||||||
mvn install:install-file -Dfile=mustang-1.5.4-SNAPSHOT.jar -DgroupId=org.mustangproject.ZUGFeRD -DartifactId=mustang -Dversion=1.5.4 -Dpackaging=jar -DgeneratePom=true
|
mvn install:install-file -Dfile=mustang-1.5.4-SNAPSHOT.jar -DgroupId=org.mustangproject.ZUGFeRD -DartifactId=mustang -Dversion=1.5.4 -Dpackaging=jar -DgeneratePom=true
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.mustangproject</groupId>
|
<groupId>org.mustangproject</groupId>
|
||||||
<artifactId>library</artifactId>
|
<artifactId>library</artifactId>
|
||||||
<version>1.9.0-alpha1</version>
|
<version>1.9.0-alpha1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>Library to write and read FacturX and ZUGFeRD e-invoices. </name>
|
<name>Library to write and read FacturX and ZUGFeRD e-invoices. </name>
|
||||||
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML.
|
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs. To write files, a provided PDF/A will be combined with generated or provided XML.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
<name>Library to validate Factur-X/ZUGFeRD 1.0 and 2.1 as well as XRechnung e-invoices.</name>
|
<name>Library to validate Factur-X/ZUGFeRD 1.0 and 2.1 as well as XRechnung e-invoices.</name>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.9.0-alpha1</version>
|
<version>1.9.0-alpha1-SNAPSHOT</version>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<!-- for jargs -->
|
<!-- for jargs -->
|
||||||
|
|||||||
@@ -25,20 +25,37 @@ public abstract class Validator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//abstract method
|
//abstract method
|
||||||
|
|
||||||
|
/***
|
||||||
|
* prepare validation
|
||||||
|
* @param filename the filename of the xml file to be examined
|
||||||
|
* @throws IrrecoverableValidationError when any fatal errors arise, e.g. when the source file can not be found
|
||||||
|
*/
|
||||||
public abstract void setFilename(String filename) throws IrrecoverableValidationError;
|
public abstract void setFilename(String filename) throws IrrecoverableValidationError;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* perform the validation
|
||||||
|
* @throws IrrecoverableValidationError any fatal errors, e.g. when the source file can not be found
|
||||||
|
*/
|
||||||
public abstract void validate() throws IrrecoverableValidationError;
|
public abstract void validate() throws IrrecoverableValidationError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get validation result
|
||||||
|
* @return validation result as xml string
|
||||||
|
*/
|
||||||
public String getXMLResult() {
|
public String getXMLResult() {
|
||||||
return context.getXMLResult();
|
return context.getXMLResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* validates a schema, which can only be needed in XML validation - and in pdf validation for additional data
|
* validates a schema, which can only be needed in XML validation - and in pdf validation for additional data
|
||||||
* @param xmlRawData
|
* @param xmlRawData the XML to be validated
|
||||||
* @param schemaPath
|
* @param schemaPath the filename of the schema file
|
||||||
|
* @param section the error message type code
|
||||||
|
* @param part whether the error message occurs in the pdf or xml part
|
||||||
|
* @throws IrrecoverableValidationError when any fatal errors arise, e.g. when the source file can not be found
|
||||||
*/
|
*/
|
||||||
protected void validateSchema(byte[] xmlRawData, String schemaPath,int section, EPart part) throws IrrecoverableValidationError {
|
protected void validateSchema(byte[] xmlRawData, String schemaPath, int section, EPart part) throws IrrecoverableValidationError {
|
||||||
URL schemaFile = ClassLoader.getSystemResource("schema/" + schemaPath);
|
URL schemaFile = ClassLoader.getSystemResource("schema/" + schemaPath);
|
||||||
Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData));
|
Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData));
|
||||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ public class XMLValidator extends Validator {
|
|||||||
super(ctx);
|
super(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* set source file
|
||||||
|
* @param name
|
||||||
|
* @throws IrrecoverableValidationError
|
||||||
|
*/
|
||||||
public void setFilename(String name) throws IrrecoverableValidationError { // from XML Filename
|
public void setFilename(String name) throws IrrecoverableValidationError { // from XML Filename
|
||||||
filename = name;
|
filename = name;
|
||||||
// file existence must have been checked before
|
// file existence must have been checked before
|
||||||
@@ -69,10 +74,20 @@ public class XMLValidator extends Validator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* manually set the xml content
|
||||||
|
* @param xml the xml to be checked
|
||||||
|
*/
|
||||||
public void setStringContent(String xml) {
|
public void setStringContent(String xml) {
|
||||||
zfXML = xml;
|
zfXML = xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* whether uri1 has the same meaning like uri1 (it has, if it only differs in the fragment, i.e. uri1#1==uri1#2 )
|
||||||
|
* @param uri1
|
||||||
|
* @param uri2
|
||||||
|
* @return true if semantically identical
|
||||||
|
*/
|
||||||
public static boolean matchesURI(String uri1, String uri2) {
|
public static boolean matchesURI(String uri1, String uri2) {
|
||||||
return (uri1.equals(uri2) || uri1.startsWith(uri2 + "#"));
|
return (uri1.equals(uri2) || uri1.startsWith(uri2 + "#"));
|
||||||
}
|
}
|
||||||
@@ -85,13 +100,10 @@ public class XMLValidator extends Validator {
|
|||||||
disableNotices = true;
|
disableNotices = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
*
|
* perform validation
|
||||||
* @param xmlString
|
* @throws IrrecoverableValidationError if any fatal errors occur, e.g. source file can not be read
|
||||||
* @param overrideProfileCheck
|
|
||||||
* if set to true, all ZF2 files will be checked against EN16931
|
|
||||||
* schematron, since no other schematron is available
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws IrrecoverableValidationError {
|
public void validate() throws IrrecoverableValidationError {
|
||||||
@@ -315,6 +327,14 @@ public class XMLValidator extends Validator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***
|
||||||
|
* validate using a xslt file generated from a schematron in the build preparation of this software
|
||||||
|
* @param xml the xml to be checked
|
||||||
|
* @param xsltFilename the filename of the intermediate XSLT file
|
||||||
|
* @param section the error type code, if one arises
|
||||||
|
* @param severity how serious a error should be treated - may only be notice
|
||||||
|
* @throws IrrecoverableValidationError if anything happened that prevents further checks
|
||||||
|
*/
|
||||||
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity severity) throws IrrecoverableValidationError {
|
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity severity) throws IrrecoverableValidationError {
|
||||||
ISchematronResource aResSCH = null;
|
ISchematronResource aResSCH = null;
|
||||||
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
|
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
|
||||||
|
|||||||
Reference in New Issue
Block a user