checkin for alpha release attempt
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<artifactId>Mustang-CLI</artifactId>
|
||||
<name>Mustang commandline tool</name>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.9.0-alpha1</version>
|
||||
<version>1.9.0-alpha1-SNAPSHOT</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<!-- for jargs -->
|
||||
@@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<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
|
||||
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>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>library</artifactId>
|
||||
<version>1.9.0-alpha1</version>
|
||||
<version>1.9.0-alpha1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<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.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<name>Library to validate Factur-X/ZUGFeRD 1.0 and 2.1 as well as XRechnung e-invoices.</name>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
<version>1.9.0-alpha1</version>
|
||||
<version>1.9.0-alpha1-SNAPSHOT</version>
|
||||
<repositories>
|
||||
<repository>
|
||||
<!-- for jargs -->
|
||||
|
||||
@@ -26,19 +26,36 @@ public abstract class Validator {
|
||||
|
||||
//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;
|
||||
|
||||
/***
|
||||
* perform the validation
|
||||
* @throws IrrecoverableValidationError any fatal errors, e.g. when the source file can not be found
|
||||
*/
|
||||
public abstract void validate() throws IrrecoverableValidationError;
|
||||
|
||||
/**
|
||||
* get validation result
|
||||
* @return validation result as xml string
|
||||
*/
|
||||
public String getXMLResult() {
|
||||
return context.getXMLResult();
|
||||
}
|
||||
|
||||
/***
|
||||
* validates a schema, which can only be needed in XML validation - and in pdf validation for additional data
|
||||
* @param xmlRawData
|
||||
* @param schemaPath
|
||||
* @param xmlRawData the XML to be validated
|
||||
* @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);
|
||||
Source xmlData = new StreamSource(new ByteArrayInputStream(xmlRawData));
|
||||
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||
|
||||
@@ -51,6 +51,11 @@ public class XMLValidator extends Validator {
|
||||
super(ctx);
|
||||
}
|
||||
|
||||
/***
|
||||
* set source file
|
||||
* @param name
|
||||
* @throws IrrecoverableValidationError
|
||||
*/
|
||||
public void setFilename(String name) throws IrrecoverableValidationError { // from XML Filename
|
||||
filename = name;
|
||||
// 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) {
|
||||
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) {
|
||||
return (uri1.equals(uri2) || uri1.startsWith(uri2 + "#"));
|
||||
}
|
||||
@@ -85,13 +100,10 @@ public class XMLValidator extends Validator {
|
||||
disableNotices = true;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* @param xmlString
|
||||
* @param overrideProfileCheck
|
||||
* if set to true, all ZF2 files will be checked against EN16931
|
||||
* schematron, since no other schematron is available
|
||||
* @return
|
||||
* perform validation
|
||||
* @throws IrrecoverableValidationError if any fatal errors occur, e.g. source file can not be read
|
||||
*/
|
||||
@Override
|
||||
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 {
|
||||
ISchematronResource aResSCH = null;
|
||||
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
|
||||
|
||||
Reference in New Issue
Block a user