no message

This commit is contained in:
Jochen Staerk
2020-05-31 18:26:46 +02:00
parent c6a37d02c1
commit 4760554eb3
234 changed files with 1047328 additions and 351 deletions

View File

@@ -0,0 +1,5 @@
package org.mustangproject.library.extended;
public enum EPart {
fx, xr, pdf, none
}

View File

@@ -0,0 +1,5 @@
package org.mustangproject.library.extended;
public enum ESeverity {
notice, warning, error, fatal, exception
}

View File

@@ -0,0 +1,13 @@
package org.mustangproject.library.extended;
public class IrrecoverableValidationError extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public IrrecoverableValidationError(String message) {
super(message);
}
}

View File

@@ -0,0 +1,94 @@
package org.mustangproject.library.extended;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sanityinc.jargs.CmdLineParser;
import com.sanityinc.jargs.CmdLineParser.Option;
public class Main {
static final ClassLoader cl = Main.class.getClassLoader();
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class.getCanonicalName()); // log output is
// ignored for the
// time being
public void run(String[] args) {
/***
* prerequisite is a mvn generate-resources
*/
CmdLineParser parser = new CmdLineParser();
Option<String> actionOption = parser.addStringOption('a', "action");
Option<String> filenameOption = parser.addStringOption('f', "Filename");
Option<Boolean> licenseOption = parser.addBooleanOption('l', "license");
Option<Boolean> helpOption = parser.addBooleanOption('h', "help");
Option<String> logAppendOption = parser.addStringOption("logAppend");
boolean optionsRecognized = false;
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
System.exit(-2);
}
Boolean helpRequested = parser.getOptionValue(helpOption);
if (parser.getOptionValue(licenseOption) != null) {
optionsRecognized = true;
System.out.println("Copyright 2018 Jochen Stärk\n" + "\n"
+ "Licensed under the Apache License, Version 2.0 (the \"License\");\n"
+ "you may not use this file except in compliance with the License.\n"
+ "You may obtain a copy of the License at\n" + "\n"
+ " http://www.apache.org/licenses/LICENSE-2.0\n" + "\n"
+ "Unless required by applicable law or agreed to in writing, software\n"
+ "distributed under the License is distributed on an \"AS IS\" BASIS,\n"
+ "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+ "See the License for the specific language governing permissions and\n"
+ "limitations under the License.\n\n\n\n\n"
+ "This software is embedding the PDF/A validator VeraPDF, "
+ "http://verapdf.org/, which is available under GPL and MPL licenses.");
System.exit(0);
}
String filename = parser.getOptionValue(filenameOption);
String action = parser.getOptionValue(actionOption);
File logdir = new File("log");
if (!logdir.exists() || !logdir.isDirectory() || !logdir.canWrite()) {
System.err.println("Need writable subdirectory 'log' for log files.");
}
if ((action != null) && (action.equals("validate"))) {
ZUGFeRDValidator zfv=new ZUGFeRDValidator();
zfv.setLogAppend(parser.getOptionValue(logAppendOption));
System.out.println(zfv.validate(filename));
optionsRecognized = !zfv.hasOptionsError();
if (!zfv.wasCompletelyValid()) {
System.exit(-1);
}
}
if ((!optionsRecognized) || (helpRequested != null && helpRequested.booleanValue())) {
System.out.println(
"usage: --action validate -f <ZUGFeRD PDF Filename.pdf>|<ZUGFeRD XML Filename.xml> [-l (shows license)][--logAppend \"String to be appended to validation result log\"]");
System.exit(-1);
}
}
public static void main(String[] args) {
new Main().run(args);
}
}

View File

@@ -0,0 +1,343 @@
package org.mustangproject.library.extended;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.mustangproject.ZUGFeRD.ZUGFeRDImporter;
import org.riversun.bigdoc.bin.BigFileSearcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.verapdf.core.VeraPDFException;
import org.verapdf.features.FeatureExtractorConfig;
import org.verapdf.features.FeatureFactory;
import org.verapdf.metadata.fixer.FixerFactory;
import org.verapdf.metadata.fixer.MetadataFixerConfig;
import org.verapdf.pdfa.VeraGreenfieldFoundryProvider;
import org.verapdf.pdfa.validation.validators.ValidatorConfig;
import org.verapdf.pdfa.validation.validators.ValidatorFactory;
import org.verapdf.processor.BatchProcessor;
import org.verapdf.processor.FormatOption;
import org.verapdf.processor.ProcessorConfig;
import org.verapdf.processor.ProcessorFactory;
import org.verapdf.processor.TaskType;
import org.verapdf.processor.plugins.PluginsCollectionConfig;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class PDFValidator extends Validator {
public PDFValidator(ValidationContext ctx) {
super(ctx);
// TODO Auto-generated constructor stub
}
private static final Logger LOGGER = LoggerFactory.getLogger(PDFValidator.class.getCanonicalName()); // log output
// is
private String pdfFilename;
private String pdfReport;
private String Signature;
private String zfXML = null;
protected static boolean stringArrayContains(String[] arr, String targetValue) {
return Arrays.asList(arr).contains(targetValue);
}
public void validate() throws IrrecoverableValidationError {
zfXML = null;
File file = new File(pdfFilename);
// file existence must have been checked before
BigFileSearcher searcher = new BigFileSearcher();
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
if (searcher.indexOf(file, pdfSignature) != 0) {
context.addResultItem(
new ValidationResultItem(ESeverity.fatal, "Not a PDF file "+pdfFilename).setSection(20).setPart(EPart.pdf));
}
long startPDFTime = Calendar.getInstance().getTimeInMillis();
// Step 1 Validate PDF
VeraGreenfieldFoundryProvider.initialise();
// Default validator config
ValidatorConfig validatorConfig = ValidatorFactory.defaultConfig();
// Default features config
FeatureExtractorConfig featureConfig = FeatureFactory.defaultConfig();
// Default plugins config
PluginsCollectionConfig pluginsConfig = PluginsCollectionConfig.defaultConfig();
// Default fixer config
MetadataFixerConfig fixerConfig = FixerFactory.defaultConfig();
// Tasks configuring
EnumSet tasks = EnumSet.noneOf(TaskType.class);
tasks.add(TaskType.VALIDATE);
// tasks.add(TaskType.EXTRACT_FEATURES);
// tasks.add(TaskType.FIX_METADATA);
// Creating processor config
ProcessorConfig processorConfig = ProcessorFactory.fromValues(validatorConfig, featureConfig, pluginsConfig,
fixerConfig, tasks);
// Creating processor and output stream.
ByteArrayOutputStream reportStream = new ByteArrayOutputStream();
try (BatchProcessor processor = ProcessorFactory.fileBatchProcessor(processorConfig)) {
// Generating list of files for processing
List<File> files = new ArrayList<>();
files.add(new File(pdfFilename));
// starting the processor
processor.process(files, ProcessorFactory.getHandler(FormatOption.MRR, true, reportStream, 100,
processorConfig.getValidatorConfig().isRecordPasses()));
pdfReport = reportStream.toString("utf-8").replaceAll("<\\?xml version=\"1\\.0\" encoding=\"utf-8\"\\?>",
"");
} catch (VeraPDFException e) {
ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(6)
.setPart(EPart.pdf);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
} catch (IOException excep) {
context.addResultItem(new ValidationResultItem(ESeverity.exception, excep.getMessage()).setSection(7)
.setPart(EPart.pdf).setStacktrace(excep.getStackTrace().toString()));
}
// step 2 validate XMP
ZUGFeRDImporter zi = new ZUGFeRDImporter(pdfFilename);
String xmp = zi.getXMP();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document docXMP;
if (xmp.length() == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "Invalid XMP Metadata not found")
.setSection(17).setPart(EPart.pdf));
}
/*
* checking for sth like <zf:ConformanceLevel>EXTENDED</zf:ConformanceLevel>
* <zf:DocumentType>INVOICE</zf:DocumentType>
* <zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>
* <zf:Version>1.0</zf:Version>
*/
try {
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xmp));
docXMP = builder.parse(is);
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object XPath xpath = xpathFactory.newXPath(); XPathExpression
XPath xpath = xpathFactory.newXPath();
// xpath.compile("//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/[local-name()=\"ID\"]");
// evaluate expression result on XML document ndList = (NodeList)
// get the first element
XPathExpression xpr = xpath.compile(
"//*[local-name()=\"ConformanceLevel\"]|//*[local-name()=\"Description\"]/@ConformanceLevel");
NodeList nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
if (nodes.getLength() == 0) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: ConformanceLevel not found")
.setSection(11).setPart(EPart.pdf));
}
boolean conformanceLevelValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
String[] valueArray = { "BASIC WL", "BASIC", "MINIMUM", "EN 16931", "COMFORT", "CIUS", "EXTENDED" };
if (stringArrayContains(valueArray, nodes.item(i).getTextContent())) {
conformanceLevelValid=true;
}
}
if (!conformanceLevelValid) {
context.addResultItem(new ValidationResultItem(ESeverity.error,
"XMP Metadata: ConformanceLevel contains invalid value").setSection(12).setPart(EPart.pdf));
}
xpr = xpath.compile("//*[local-name()=\"DocumentType\"]|//*[local-name()=\"Description\"]/@DocumentType");
nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
if (nodes.getLength() == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "XMP Metadata: DocumentType not found")
.setSection(13).setPart(EPart.pdf));
}
boolean documentTypeValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
if (nodes.item(i).getTextContent().equals("INVOICE")) {
documentTypeValid=true;
}
}
if (!documentTypeValid) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: DocumentType invalid")
.setSection(14).setPart(EPart.pdf));
}
xpr = xpath.compile(
"//*[local-name()=\"DocumentFileName\"]|//*[local-name()=\"Description\"]/@DocumentFileName");
nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
if (nodes.getLength() == 0) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: DocumentFileName not found")
.setSection(21).setPart(EPart.pdf));
}
boolean documentFilenameValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
String[] valueArray = { "factur-x.xml", "ZUGFeRD-invoice.xml", "zugferd-invoice.xml" };
if (stringArrayContains(valueArray, nodes.item(i).getTextContent())) {
documentFilenameValid=true;
}
// e.g. ZUGFeRD-invoice.xml
}
if (!documentFilenameValid) {
context.addResultItem(new ValidationResultItem(ESeverity.error,
"XMP Metadata: DocumentFileName contains invalid value").setSection(19).setPart(EPart.pdf));
}
xpr = xpath.compile("//*[local-name()=\"Version\"]|//*[local-name()=\"Description\"]/@Version");
nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
// get all child nodes
// NodeList nodes = element.getChildNodes();
// expr.evaluate(docXMP, XPathConstants.NODESET);
// print the text content of each child
if (nodes.getLength() == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "XMP Metadata: Version not found")
.setSection(15).setPart(EPart.pdf));
}
boolean versionValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
String[] valueArray = { "1.0", "2p0" };
if (stringArrayContains(valueArray, nodes.item(i).getTextContent())) {
versionValid=true;
} // e.g. 1.0
}
if (!versionValid) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: Version contains invalid value")
.setSection(16).setPart(EPart.pdf));
}
} catch (SAXException e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} catch (ParserConfigurationException e) {
LOGGER.error(e.getMessage(), e);
} catch (XPathExpressionException e) {
LOGGER.error(e.getMessage(), e);
}
zfXML = zi.getUTF8();
// step 3 find signatures
try {
byte[] symtraxSignature = "Symtrax".getBytes("UTF-8");
byte[] mustangSignature = "via mustangproject".getBytes("UTF-8");
byte[] facturxpythonSignature = "by Alexis de Lattre".getBytes("UTF-8");
byte[] intarsysSignature = "intarsys ".getBytes("UTF-8");
byte[] konikSignature = "Konik".getBytes("UTF-8");
byte[] pdfMachineSignature = "pdfMachine from Broadgun Software".getBytes("UTF-8");
if (searcher.indexOf(file, symtraxSignature) != -1) {
Signature = "Symtrax";
} else if (searcher.indexOf(file, mustangSignature) != -1) {
Signature = "Mustang";
} else if (searcher.indexOf(file, facturxpythonSignature) != -1) {
Signature = "Factur/X Python";
} else if (searcher.indexOf(file, intarsysSignature) != -1) {
Signature = "Intarsys";
} else if (searcher.indexOf(file, konikSignature) != -1) {
Signature = "Konik";
} else if (searcher.indexOf(file, pdfMachineSignature) != -1) {
Signature = "pdfMachine";
}
context.setSignature(Signature);
} catch (UnsupportedEncodingException e) {
LOGGER.error(e.getMessage(), e);
}
// step 4:validate additional data
HashMap<String, byte[]> additionalData=zi.getAdditionalData();
for (String filename : additionalData.keySet()) {
// validating xml in byte[] additionalData.get(filename)
LOGGER.info("validating additionalData " + filename);
validateSchema(additionalData.get(filename), "ad/basic/additional_data_base_schema.xsd", 2, EPart.pdf);
}
//end
long endTime = Calendar.getInstance().getTimeInMillis();
if (!pdfReport.contains("validationReports compliant=\"1\"")) {
context.setInvalid();
}
if (!pdfReport.contains("PDF/A-3")) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "Not a PDF/A-3").setSection(23).setPart(EPart.pdf));
}
context.addCustomXML(pdfReport + "<info><signature>"
+ ((context.getSignature() != null) ? context.getSignature() : "unknown")
+ "</signature><duration unit='ms'>" + (endTime - startPDFTime) + "</duration></info>");
}
@Override
public void setFilename(String filename) throws IrrecoverableValidationError {
this.pdfFilename = filename;
}
public String getRawXML() {
return zfXML;
}
public String getSignature() {
return Signature;
}
}

View File

@@ -0,0 +1,84 @@
package org.mustangproject.library.extended;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class SchematronPipeline {
static final ClassLoader cl = SchematronPipeline.class.getClassLoader();
private static final TransformerFactory factory = getTransformerFactory();
private static final String xslExt = ".xsl"; //$NON-NLS-1$
private static final String resourcePath = "iso-schematron-xslt2/"; //$NON-NLS-1$
private static final String isoDsdlXsl = resourcePath + "iso_dsdl_include" + xslExt; //$NON-NLS-1$
private static final String isoExpXsl = resourcePath + "iso_abstract_expand" + xslExt; //$NON-NLS-1$
private static final String isoSvrlXsl = resourcePath + "iso_svrl_for_xslt2" + xslExt; //$NON-NLS-1$
private static final Templates cachedIsoDsdXsl = createCachedTransform(isoDsdlXsl);
private static final Templates cachedExpXsl = createCachedTransform(isoExpXsl);
private static final Templates cachedIsoSvrlXsl = createCachedTransform(isoSvrlXsl);
private static TransformerFactory getTransformerFactory() {
TransformerFactory fact = TransformerFactory.newInstance();
fact.setURIResolver(new ClasspathResourceURIResolver());
return fact;
}
static Templates createCachedTransform(final String transName) {
try {
return factory.newTemplates(new StreamSource(cl.getResourceAsStream(transName)));
} catch (TransformerConfigurationException excep) {
throw new IllegalStateException("Policy Schematron transformer XSL " + transName + " not found.", excep); //$NON-NLS-1$ //$NON-NLS-2$
}
}
public static void processSchematron(InputStream schematronSource, OutputStream xslDest)
throws TransformerException, IOException {
File isoDsdResult = createTempFileResult(cachedIsoDsdXsl.newTransformer(), new StreamSource(schematronSource),
"IsoDsd"); //$NON-NLS-1$
File isoExpResult = createTempFileResult(cachedExpXsl.newTransformer(), new StreamSource(isoDsdResult),
"ExpXsl"); //$NON-NLS-1$
cachedIsoSvrlXsl.newTransformer().transform(new StreamSource(isoExpResult), new StreamResult(xslDest));
isoDsdResult.delete();
isoExpResult.delete();
}
private static File createTempFileResult(final Transformer transformer, final StreamSource toTransform,
final String suffix) throws TransformerException, IOException {
File result = File.createTempFile("ZUV_", suffix); //$NON-NLS-1$
result.deleteOnExit();
try (FileOutputStream fos = new FileOutputStream(result)) {
transformer.transform(toTransform, new StreamResult(fos));
}
return result;
}
private static class ClasspathResourceURIResolver implements URIResolver {
ClasspathResourceURIResolver() {
// Do nothing, just prevents synthetic access warning.
}
@Override
public Source resolve(String href, String base) throws TransformerException {
return new StreamSource(cl.getResourceAsStream(resourcePath + href));
}
}
public static void applySchematronXsl(final InputStream xmlFile,
final OutputStream policyReport) throws TransformerException {
Transformer transformer = factory.newTransformer(new StreamSource(cl.getResourceAsStream(resourcePath+"ZUGFeRDSchematronStylesheetXSLT1.xsl")));
transformer.transform(new StreamSource(xmlFile), new StreamResult(policyReport));
}
}

View File

@@ -0,0 +1,146 @@
package org.mustangproject.library.extended;
import java.util.ArrayList;
import java.util.Vector;
import org.slf4j.Logger;
public class ValidationContext {
protected Vector<ValidationResultItem> results;
protected String customXML = "";
private String version = null;
private String profile = null;
private String signature = null;
private boolean isValid = true;
protected Logger logger;
private String filename;
public ValidationContext(Logger log) {
logger = log;
results = new Vector<ValidationResultItem>();
}
public void addResultItem(ValidationResultItem vr) throws IrrecoverableValidationError {
results.add(vr);
if ((vr.getSeverity() == ESeverity.fatal) || (vr.getSeverity() == ESeverity.exception)
|| (vr.getSeverity() == ESeverity.error)) {
isValid = false;
}
if (logger != null) {
if ((vr.getSeverity() == ESeverity.fatal) || (vr.getSeverity() == ESeverity.exception)) {
logger.error("Fatal Error " + vr.getSection() + ": " + vr.getMessage());
} else if ((vr.getSeverity() == ESeverity.error)) {
logger.error("Error " + vr.getSection() + ": " + vr.getMessage());
} else if (vr.getSeverity() == ESeverity.warning) {
logger.warn("Warning " + vr.getSection() + ": " + vr.getMessage());
} else if (vr.getSeverity() == ESeverity.notice) {
logger.info("Notice " + vr.getSection() + ": " + vr.getMessage());
}
}
if ((vr.getSeverity() == ESeverity.fatal) || (vr.getSeverity() == ESeverity.exception)) {
throw new IrrecoverableValidationError(vr.getMessage());
}
}
public void clearCustomXML() {
customXML = "";
}
public void addCustomXML(String XML) {
customXML += XML;
}
public String getCustomXML() {
return customXML;
}
public ValidationContext setVersion(String version) {
this.version = version;
return this;
}
public ValidationContext setProfile(String profile) {
this.profile = profile;
return this;
}
public ValidationContext setSignature(String signature) {
this.signature = signature;
return this;
}
public String getVersion() {
return version;
}
public String getProfile() {
return profile;
}
public String getSignature() {
return signature;
}
public boolean isValid() {
return isValid;
}
public void clear() {
results.clear();
isValid = true;
clearCustomXML();
version = null;
profile = null;
signature = null;
}
public String getXMLResult() {
String res = getCustomXML();
if (results.size() > 0) {
res += "<messages>";
}
for (ValidationResultItem validationResultItem : results) {
// xml and pdf are handled in their respective sections
res += validationResultItem.getXMLOnce() + "\n";
}
if (results.size() > 0) {
res += "</messages>";
}
res += "<summary status='" + (isValid ? "valid" : "invalid") + "'/>";
return res;
}
/***
*
* @return the unique error types as comma separated string
*/
public String getCSVResult() {
ArrayList<String> errorcodes = new ArrayList<String>();
for (ValidationResultItem validationResultItem : results) {
String errorCodeStr=Integer.toString(validationResultItem.getSection());
errorcodes.add(errorCodeStr);
}
return String.join(",", errorcodes);
}
public void setInvalid() {
isValid = false;
}
public void setFilename(String filename) {
this.filename=filename;
}
public String getFilename() {
if (filename==null) {
return "";
} else {
return filename;
}
}
}

View File

@@ -0,0 +1,114 @@
package org.mustangproject.library.extended;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ValidationResultItem {
private static final Logger LOGGER = LoggerFactory.getLogger(ValidationResultItem.class.getCanonicalName()); // log output is
// ignored for the
// time being
protected String message, location=null;
protected int section =-1;
private ESeverity severity=ESeverity.error;
private String criterion=null;
private String stacktrace=null;
private boolean hasBeenOutputted=false;
private EPart part;
private XMLTools xt;
public ValidationResultItem(ESeverity sev, String msg) {
setSeverity(sev);
setMessage(msg);
xt=new XMLTools();
}
public ValidationResultItem setMessage(String msg) {
message=msg;
return this;
}
public ValidationResultItem setSection(int sec) {
section=sec;
return this;
}
public ValidationResultItem setLocation(String loc) {
location=loc;
return this;
}
public ValidationResultItem setPart(EPart loc) {
part=loc;
return this;
}
public EPart getPart() {
return part;
}
public ValidationResultItem setSeverity(ESeverity sev) {
severity=sev;
return this;
}
public ValidationResultItem setStacktrace(String stack) {
stacktrace=stack;
return this;
}
public String getXML() {
String tagname="error";
if (severity==ESeverity.exception) {
tagname="exception";
} else if (severity==ESeverity.warning) {
tagname="warning";
} else if (severity==ESeverity.notice) {
tagname="notice";
}
String additionalAttributes="";
String additionalContents="";
if (section!=-1) {
additionalAttributes+=" type=\""+section+"\"";
}
if (location!=null) {
additionalAttributes+=" location=\""+xt.escapeAttributeEntities(location)+"\"";
}
if (criterion!=null) {
additionalAttributes+=" criterion=\""+xt.escapeAttributeEntities(criterion)+"\"";
}
if (stacktrace!=null) {
additionalContents+="<stacktrace>"+xt.escapeAttributeEntities(stacktrace)+"</stacktrace>";
}
hasBeenOutputted=true;
return "<"+tagname+additionalAttributes+">"+xt.escapeElementEntities(message+additionalContents)+"</"+tagname+">";
}
public String getXMLOnce() {
if (!hasBeenOutputted) {
return getXML();
} else {
return "";
}
}
public ValidationResultItem setCriterion(String test) {
criterion = test;
return this;
}
public ESeverity getSeverity() {
return severity;
}
public int getSection() {
return section;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,60 @@
package org.mustangproject.library.extended;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URL;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
//abstract class
public abstract class Validator {
private static final Logger LOGGER = LoggerFactory.getLogger(Validator.class.getCanonicalName()); // log output
protected ValidationContext context;
public Validator(ValidationContext ctx){
this.context=ctx;
}
//abstract method
public abstract void setFilename(String filename) throws IrrecoverableValidationError;
public abstract void validate() throws IrrecoverableValidationError;
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
*/
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);
try {
Schema schema = schemaFactory.newSchema(schemaFile);
javax.xml.validation.Validator validator = schema.newValidator();
validator.validate(xmlData);
} catch (SAXException e) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "schema validation fails:" + e)
.setSection(section).setPart(part));
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
}

View File

@@ -0,0 +1,14 @@
package org.mustangproject.library.extended;
import org.dom4j.io.XMLWriter;
public class XMLTools extends XMLWriter {
public String escapeAttributeEntities(String s) {
return super.escapeAttributeEntities(s);
}
public String escapeElementEntities(String s) {
return super.escapeElementEntities(s);
}
}

View File

@@ -0,0 +1,417 @@
package org.mustangproject.library.extended;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Calendar;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.helger.schematron.svrl.jaxb.FailedAssert;
import com.helger.schematron.svrl.jaxb.FiredRule;
import com.helger.schematron.svrl.jaxb.SchematronOutputType;
import com.helger.schematron.ISchematronResource;
import com.helger.schematron.xslt.SchematronResourceXSLT;
import com.helger.schematron.svrl.SVRLHelper;
import org.xml.sax.InputSource;
public class XMLValidator extends Validator {
public XMLValidator(ValidationContext ctx) {
super(ctx);
}
private static final Logger LOGGER = LoggerFactory.getLogger(XMLValidator.class.getCanonicalName()); // log output
// is
// ignored for the
// time being
protected String zfXML = "";
protected String filename = "";
int firedRules = 0;
int failedRules = 0;
ISchematronResource aResSCH = null;
public void setFilename(String name) throws IrrecoverableValidationError { // from XML Filename
filename = name;
// file existence must have been checked before
try {
zfXML = new String(Files.readAllBytes(Paths.get(name)));
} catch (IOException e) {
ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(9)
.setPart(EPart.fx);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
}
}
public void setStringContent(String xml) {
zfXML = xml;
}
public static boolean matchesURI(String uri1, String uri2) {
return (uri1.equals(uri2) || uri1.startsWith(uri2 + "#"));
}
/***
*
* @param xmlString
* @param overrideProfileCheck
* if set to true, all ZF2 files will be checked against EN16931
* schematron, since no other schematron is available
* @return
*/
@Override
public void validate() throws IrrecoverableValidationError {
long startXMLTime = Calendar.getInstance().getTimeInMillis();
firedRules = 0;
failedRules = 0;
ByteArrayInputStream xmlByteInputStream = new ByteArrayInputStream(zfXML.getBytes(StandardCharsets.UTF_8));
if (zfXML.isEmpty()) {
ValidationResultItem res = new ValidationResultItem(ESeverity.exception,
"XML data not found in " + filename
+ ": did you specify a pdf or xml file and does the xml file contain an embedded XML file?")
.setSection(3);
context.addResultItem(res);
} else {
// final ISchematronResource aResSCH =
// SchematronResourceSCH.fromFile (new File("ZUGFeRD_1p0.scmt"));
// ... DOES work but is highly deprecated (and rightly so) because
// it takes 30-40min,
try {
/***
* private static final String VALID_SCHEMATRON = "test-sch/valid01.sch";
* private static final String VALID_XMLINSTANCE = "test-xml/valid01.xml";
*
* @Test public void testWriteValid () throws Exception { final Document aDoc =
* SchematronResourceSCH.fromClassPath (VALID_SCHEMATRON)
* .applySchematronValidation (new ClassPathResource (VALID_XMLINSTANCE));
*
*/
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true); // otherwise we can not act namespace independently, i.e. use
// document.getElementsByTagNameNS("*",...
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(xmlByteInputStream);
Element root = doc.getDocumentElement();
NodeList ndList;
// rootNode = document.getDocumentElement();
// ApplicableSupplyChainTradeSettlement
// Create XPathFactory object
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object
XPath xpath = xpathFactory.newXPath();
XPathExpression expr = xpath.compile(
"//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/*[local-name()=\"ID\"]/text()");
// evaluate expression result on XML document
ndList = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
for (int bookingIndex = 0; bookingIndex < ndList.getLength(); bookingIndex++) {
Node booking = ndList.item(bookingIndex);
// if there is a attribute in the tag number:value
// urn:ferd:CrossIndustryDocument:invoice:1p0:extended
// setForeignReference(booking.getTextContent());
context.setProfile(booking.getNodeValue());
}
boolean isMiniumum = false;
boolean isBasic = false;
boolean isBasicWithoutLines = false;
boolean isEN16931 = false;
boolean isExtended = false;
String xsltFilename = null;
// urn:ferd:CrossIndustryDocument:invoice:1p0:extended,
// urn:ferd:CrossIndustryDocument:invoice:1p0:comfort,
// urn:ferd:CrossIndustryDocument:invoice:1p0:basic,
// urn:cen.eu:en16931:2017
// urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:basic
if (root.getNodeName().equalsIgnoreCase("rsm:CrossIndustryInvoice")) { // ZUGFeRD 2.0 or Factur-X
context.setVersion("2");
isMiniumum = context.getProfile().contains("minimum");
isBasic = context.getProfile().contains("basic");
isBasicWithoutLines = context.getProfile().contains("basicwl");
if (isBasicWithoutLines) {
isBasic = false;// basicwl also contains the string basic...
}
isEN16931 = matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:en16931")
|| matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017");
isExtended = context.getProfile().contains("extended");
if (isExtended) {
isEN16931 = false;// the uri for extended is urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p0:extended and thus contains en16931...
}
if (isMiniumum) {
LOGGER.debug("is Minimum");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/MINIMUM/FACTUR-X_MINIMUM.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_minimum.xsl";
} else if (isBasicWithoutLines) {
LOGGER.debug("is Basic/WL");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/BASIC-WL/FACTUR-X_BASIC-WL.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_basicwl.xsl";
} else if (isBasic) {
LOGGER.debug("is Basic");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/BASIC/FACTUR-X_BASIC.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_basic.xsl";
} else if (isEN16931) {
LOGGER.debug("is EN16931");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_en16931.xsl";
} else if (isExtended) {
LOGGER.debug("is EXTENDED");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/EXTENDED/FACTUR-X_EXTENDED.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_extended.xsl";
} /*
* ISchematronResource aResSCH = SchematronResourceXSLT.fromFile(new File(
* "/Users/jstaerk/workspace/ZUV/src/main/resources/ZUGFeRDSchematronStylesheet.xsl"
* ));
*/
// takes around 10 Seconds. //
// http://www.bentoweb.org/refs/TCDL2.0/tsdtf_schematron.html // explains that
// this xslt can be created using sth like
// saxon java net.sf.saxon.Transform -o tcdl2.0.tsdtf.sch.tmp.xsl -s
// tcdl2.0.tsdtf.sch iso_svrl.xsl
} else { // ZUGFeRD 1.0
context.setVersion("1");
//
if ((!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"))) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "Unsupported profile type")
.setSection(25).setPart(EPart.fx));
}
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf1/ZUGFeRD1p0.xsd", 18, EPart.fx);
xsltFilename = "/xslt/ZUGFeRD_1p0.xslt";
}
if (context.getVersion().equals("2")) {
if ((!matchesURI(context.getProfile(), "urn:factur-x.eu:1p0:minimum"))
&& (!matchesURI(context.getProfile(), "urn:zugferd.de:2p0:minimum"))
&& (!matchesURI(context.getProfile(), "urn:factur-x.eu:1p0:basicwl"))
&& (!matchesURI(context.getProfile(), "urn:zugferd.de:2p0:basicwl"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#compliant#urn:zugferd.de:2p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p0:extended"))) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "Unsupported profile type " + context.getProfile())
.setSection(25).setPart(EPart.fx));
}
} else /** v1 */ {//urn:ferd:invoice:rc:comfort
if ((!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"))) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "Unsupported profile type")
.setSection(25).setPart(EPart.fx));
}
}
// main schematron validation
validateSchematron(zfXML, xsltFilename, 4, ESeverity.error);
if (context.getVersion().equals("2")
&& isEN16931) {
//additionally validate against CEN
validateSchematron(zfXML, "/xslt/cii16931schematron/EN16931-CII-validation.xslt", 24, ESeverity.error);
validateXR(zfXML);
}
} catch (IrrecoverableValidationError er) {
throw er;
} catch (Exception e) {
ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(22)
.setPart(EPart.fx);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
}
}
long endTime = Calendar.getInstance().getTimeInMillis();
context.addCustomXML("<info><version>" + ((context.getVersion() != null) ? context.getVersion() : "invalid")
+ "</version><profile>" + ((context.getProfile() != null) ? context.getProfile() : "invalid") +
"</profile><validator version=\"" + Main.class.getPackage().getImplementationVersion() + "\"></validator><rules><fired>" + firedRules + "</fired><failed>" + failedRules + "</failed></rules>" + "<duration unit='ms'>" + (endTime - startXMLTime) + "</duration></info>");
}
protected String getXRValidationResult(String xml) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
TransformerFactory factory = TransformerFactory.newInstance();
try {
// Use the factory to create a template containing the xsl file
Templates template = factory.newTemplates(new StreamSource(
this.getClass().getResourceAsStream("/xslt/XRechnung-CII-validation.xsl")));
// Use the template to create a transformer
Transformer xformer = template.newTransformer();
// Prepare the input and output files
Source source = new StreamSource(new ByteArrayInputStream(xml.getBytes()));
Result result = new StreamResult(baos);
// Apply the xsl file to the source file and write the result
// to the output file
xformer.transform(source, result);
} catch (Exception ex) {
LOGGER.error(ex.getMessage(), ex);
}
return baos.toString();
}
public void validateXR(String xml) throws IrrecoverableValidationError {
/*
DocumentBuilderFactory docbfactory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = docbfactory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(getXRValidationResult(xml)));
Document docXMP = builder.parse(is);
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object XPath xpath = xpathFactory.newXPath(); XPathExpression
XPath xpath = xpathFactory.newXPath();
// xpath.compile("//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/[local-name()=\"ID\"]");
// evaluate expression result on XML document ndList = (NodeList)
// get the first element
XPathExpression xpr = xpath.compile(
"//*[local-name()=\"failed-assert\"]");
NodeList nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
for (int nodeIndex = 0; nodeIndex < nodes.getLength(); nodeIndex++) {
String loc=nodes.item(nodeIndex).getAttributes().getNamedItem("location").getTextContent();
NodeList failedSubNodes=nodes.item(nodeIndex).getChildNodes();
for (int failedSubNodeIndex = 0; failedSubNodeIndex < nodes.getLength(); failedSubNodeIndex++) {
if (failedSubNodes.item(failedSubNodeIndex).getNodeName().equals("svrl:text")) {
context.addResultItem(
new ValidationResultItem(ESeverity.warning, failedSubNodes.item(failedSubNodeIndex).getTextContent())
.setLocation(loc).setSection(27).setPart(EPart.xr));
}
}
}
} catch (Exception ex) {
LOGGER.error(ex.getMessage(), ex);
}
*/
validateSchematron(xml, "/xslt/XRechnung-CII-validation.xslt",27, ESeverity.notice);
}
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity severity) throws IrrecoverableValidationError {
ISchematronResource aResSCH = null;
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
if (aResSCH != null) {
if (!aResSCH.isValidSchematron()) {
throw new IllegalArgumentException(xsltFilename + " is invalid Schematron!");
}
SchematronOutputType sout;
try {
sout = aResSCH
.applySchematronValidationToSVRL(new StreamSource(new StringReader(xml)));
} catch (Exception e) {
throw new IrrecoverableValidationError(e.getMessage());
}
List<Object> failedAsserts = sout.getActivePatternAndFiredRuleAndFailedAssert();
if (failedAsserts.size() > 0) {
for (Object object : failedAsserts) {
if (object instanceof FailedAssert) {
FailedAssert failedAssert = (FailedAssert) object;
LOGGER.info("FailedAssert ", failedAssert);
context.addResultItem(new ValidationResultItem(severity, SVRLHelper.getAsString(failedAssert.getText()))
.setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section)
.setPart(EPart.fx));
failedRules++;
} else if (object instanceof FiredRule) {
firedRules++;
}
}
}
if (firedRules == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "No rules matched, XML to minimal?").setSection(26)
.setPart(EPart.fx));
}
// for (String currentString : sout.getText()) {
// schematronValidationString += "<output>" + currentString + "</output>";
// }
// schematronValidationString += new SVRLMarshaller ().getAsString (sout);
// returns the complete SVRL
}
}
public int getFiredRules() {
return firedRules;
}
public int getFailedRules() {
return failedRules;
}
}

View File

@@ -0,0 +1,292 @@
package org.mustangproject.library.extended;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.riversun.bigdoc.bin.BigFileSearcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXParseException;
//abstract class
public class ZUGFeRDValidator {
private static final Logger LOGGER = LoggerFactory.getLogger(ZUGFeRDValidator.class.getCanonicalName()); // log
// output
protected ValidationContext context = new ValidationContext(LOGGER);
protected String sha1Checksum;
protected boolean pdfValidity;
protected boolean displayXMLValidationOutput;
protected long startTime;
protected boolean optionsRecognized;
protected String Signature;
protected boolean wasCompletelyValid = false;
protected String logAppend=null;
/***
* within the validation it turned out something in the options was wrong, e.g.
* the file did not exist. recommendation to show the help text again. Should be
* false if XML or PDF file was found
*/
public boolean hasOptionsError() {
return !optionsRecognized;
}
public void setLogAppend(String tobeappended) {
logAppend = tobeappended;
}
/***
* in case the result was not valid the error code of the app will be set to -1
*
* @return
*/
public boolean wasCompletelyValid() {
return wasCompletelyValid;
}
/***
* performs a validation on the file filename
*
* @param filename
* @return
*/
public String validate(String filename) {
boolean xmlValidity;
context.clear();
StringBuffer finalStringResult = new StringBuffer();
SimpleDateFormat isoDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
Date date = new Date();
startTime = Calendar.getInstance().getTimeInMillis();
try {
Path path = Paths.get(filename);
context.setFilename(path.getFileName().toString());// set filename without path
} catch (NullPointerException ex) {
// ignore
}
finalStringResult
.append("<validation filename='" + context.getFilename() + "' datetime='" + isoDF.format(date) + "'>");
try {
if (filename == null) {
optionsRecognized = false;
context.addResultItem(new ValidationResultItem(ESeverity.fatal, "Filename not specified").setSection(10)
.setPart(EPart.pdf));
}
PDFValidator pdfv = new PDFValidator(context);
File file = new File(filename);
if (!file.exists()) {
context.addResultItem(
new ValidationResultItem(ESeverity.fatal, "File not found").setSection(1).setPart(EPart.pdf));
} else if (file.length() < 32) {
// with less then 32 bytes it can not even be a proper XML file
context.addResultItem(
new ValidationResultItem(ESeverity.fatal, "File too small").setSection(5).setPart(EPart.pdf));
} else {
BigFileSearcher searcher = new BigFileSearcher();
XMLValidator xv = new XMLValidator(context);
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
boolean isPDF = searcher.indexOf(file, pdfSignature) == 0;
if (isPDF) {
pdfv.setFilename(filename);
optionsRecognized = true;
try {
if (!file.exists()) {
context.addResultItem(
new ValidationResultItem(ESeverity.exception, "File " + filename + " not found")
.setSection(1));
}
} catch (IrrecoverableValidationError irx) {
// @todo log
}
finalStringResult.append("<pdf>");
optionsRecognized = true;
try {
pdfv.validate();
sha1Checksum = calcSHA1(file);
// Validate PDF
finalStringResult.append(pdfv.getXMLResult());
pdfValidity = context.isValid();
Signature = context.getSignature();
context.clear();// clear sets valid to true again
if (pdfv.getRawXML() != null) {
xv.setStringContent(pdfv.getRawXML());
displayXMLValidationOutput = true;
} else {
context.addResultItem(
new ValidationResultItem(ESeverity.exception, "XML could not be extracted")
.setSection(17));
}
} catch (IrrecoverableValidationError irx) {
// @todo log
}
finalStringResult.append("</pdf>\n");
context.clearCustomXML();
} else {
boolean isXML = false;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
Element root = doc.getDocumentElement();
isXML=true;//no exception so far
}
catch (Exception ex) {
// probably no xml file, sth like SAXParseException content not allowed in prolog
// ignore isXML is already false
// in the tests, this may error-out anyway
}
if (isXML) {
pdfValidity = true;
optionsRecognized = true;
xv.setFilename(filename);
if (file.exists()) {
sha1Checksum = calcSHA1(file);
}
displayXMLValidationOutput = true;
} else {
optionsRecognized = false;
context.addResultItem(new ValidationResultItem(ESeverity.exception,
"File does not look like PDF nor XML (contains neither %PDF nor <?xml)").setSection(8));
}
}
if ((optionsRecognized) && (displayXMLValidationOutput)) {
finalStringResult.append("<xml>");
try {
xv.validate();
} catch (IrrecoverableValidationError irx) {
// @todo log
}
finalStringResult.append(xv.getXMLResult());
finalStringResult.append("</xml>");
context.clearCustomXML();
}
if ((isPDF)&&(!pdfValidity)) {
context.setInvalid();
}
}
}
catch (IrrecoverableValidationError irx) {
// @todo log
} finally {
finalStringResult.append(context.getXMLResult());
finalStringResult.append("</validation>");
}
OutputFormat format = OutputFormat.createPrettyPrint();
StringWriter sw = new StringWriter();
org.dom4j.Document document = null;
try {
document = DocumentHelper.parseText(new String(finalStringResult));
} catch (DocumentException e1) {
LOGGER.error(e1.getMessage());
}
XMLWriter writer = new XMLWriter(sw, format);
try {
writer.write(document);
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
xmlValidity = context.isValid();
long duration = Calendar.getInstance().getTimeInMillis() - startTime;
String toBeAppended="";
if (logAppend!=null) {
toBeAppended=logAppend;
}
LOGGER.info("Parsed PDF:" + (pdfValidity ? "valid" : "invalid") + " XML:" + (xmlValidity ? "valid" : "invalid")
+ " Signature:" + Signature + " Checksum:" + sha1Checksum + " Profile:" + context.getProfile()
+ " Version:" + context.getVersion() + " Took:" + duration + "ms Errors:["+context.getCSVResult()+"] "+toBeAppended);
wasCompletelyValid = ((pdfValidity) && (xmlValidity));
return sw.toString();
}
/**
* Read the file and calculate the SHA-1 checksum
*
* @param file the file to read
* @return the hex representation of the SHA-1 using uppercase chars
* @throws FileNotFoundException if the file does not exist, is a directory
* rather than a regular file, or for some
* other reason cannot be opened for reading
* @throws IOException if an I/O error occurs
* @throws NoSuchAlgorithmException should never happen
*/
private static String calcSHA1(File file) {
MessageDigest sha1 = null;
try {
sha1 = MessageDigest.getInstance("SHA-1");
InputStream input = new FileInputStream(file);
byte[] buffer = new byte[8192];
int len = input.read(buffer);
while (len != -1) {
sha1.update(buffer, 0, len);
len = input.read(buffer);
}
input.close();
} catch (FileNotFoundException e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} catch (NoSuchAlgorithmException e) {
LOGGER.error(e.getMessage(), e);
}
if (sha1 == null) {
return "";
} else {
return new HexBinaryAdapter().marshal(sha1.digest());
}
}
}

View File

@@ -0,0 +1,5 @@
package org.mustangproject.validator;
public enum EPart {
fx, xr, pdf, none
}

View File

@@ -0,0 +1,5 @@
package org.mustangproject.validator;
public enum ESeverity {
notice, warning, error, fatal, exception
}

View File

@@ -0,0 +1,13 @@
package org.mustangproject.validator;
public class IrrecoverableValidationError extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public IrrecoverableValidationError(String message) {
super(message);
}
}

View File

@@ -0,0 +1,94 @@
package org.mustangproject.validator;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sanityinc.jargs.CmdLineParser;
import com.sanityinc.jargs.CmdLineParser.Option;
public class Main {
static final ClassLoader cl = Main.class.getClassLoader();
private static final Logger LOGGER = LoggerFactory.getLogger(Main.class.getCanonicalName()); // log output is
// ignored for the
// time being
public void run(String[] args) {
/***
* prerequisite is a mvn generate-resources
*/
CmdLineParser parser = new CmdLineParser();
Option<String> actionOption = parser.addStringOption('a', "action");
Option<String> filenameOption = parser.addStringOption('f', "Filename");
Option<Boolean> licenseOption = parser.addBooleanOption('l', "license");
Option<Boolean> helpOption = parser.addBooleanOption('h', "help");
Option<String> logAppendOption = parser.addStringOption("logAppend");
boolean optionsRecognized = false;
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
System.exit(-2);
}
Boolean helpRequested = parser.getOptionValue(helpOption);
if (parser.getOptionValue(licenseOption) != null) {
optionsRecognized = true;
System.out.println("Copyright 2018 Jochen Stärk\n" + "\n"
+ "Licensed under the Apache License, Version 2.0 (the \"License\");\n"
+ "you may not use this file except in compliance with the License.\n"
+ "You may obtain a copy of the License at\n" + "\n"
+ " http://www.apache.org/licenses/LICENSE-2.0\n" + "\n"
+ "Unless required by applicable law or agreed to in writing, software\n"
+ "distributed under the License is distributed on an \"AS IS\" BASIS,\n"
+ "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+ "See the License for the specific language governing permissions and\n"
+ "limitations under the License.\n\n\n\n\n"
+ "This software is embedding the PDF/A validator VeraPDF, "
+ "http://verapdf.org/, which is available under GPL and MPL licenses.");
System.exit(0);
}
String filename = parser.getOptionValue(filenameOption);
String action = parser.getOptionValue(actionOption);
File logdir = new File("log");
if (!logdir.exists() || !logdir.isDirectory() || !logdir.canWrite()) {
System.err.println("Need writable subdirectory 'log' for log files.");
}
if ((action != null) && (action.equals("validate"))) {
ZUGFeRDValidator zfv=new ZUGFeRDValidator();
zfv.setLogAppend(parser.getOptionValue(logAppendOption));
System.out.println(zfv.validate(filename));
optionsRecognized = !zfv.hasOptionsError();
if (!zfv.wasCompletelyValid()) {
System.exit(-1);
}
}
if ((!optionsRecognized) || (helpRequested != null && helpRequested.booleanValue())) {
System.out.println(
"usage: --action validate -f <ZUGFeRD PDF Filename.pdf>|<ZUGFeRD XML Filename.xml> [-l (shows license)][--logAppend \"String to be appended to validation result log\"]");
System.exit(-1);
}
}
public static void main(String[] args) {
new Main().run(args);
}
}

View File

@@ -0,0 +1,343 @@
package org.mustangproject.validator;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.mustangproject.ZUGFeRD.ZUGFeRDImporter;
import org.riversun.bigdoc.bin.BigFileSearcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.verapdf.core.VeraPDFException;
import org.verapdf.features.FeatureExtractorConfig;
import org.verapdf.features.FeatureFactory;
import org.verapdf.metadata.fixer.FixerFactory;
import org.verapdf.metadata.fixer.MetadataFixerConfig;
import org.verapdf.pdfa.VeraGreenfieldFoundryProvider;
import org.verapdf.pdfa.validation.validators.ValidatorConfig;
import org.verapdf.pdfa.validation.validators.ValidatorFactory;
import org.verapdf.processor.BatchProcessor;
import org.verapdf.processor.FormatOption;
import org.verapdf.processor.ProcessorConfig;
import org.verapdf.processor.ProcessorFactory;
import org.verapdf.processor.TaskType;
import org.verapdf.processor.plugins.PluginsCollectionConfig;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class PDFValidator extends Validator {
public PDFValidator(ValidationContext ctx) {
super(ctx);
// TODO Auto-generated constructor stub
}
private static final Logger LOGGER = LoggerFactory.getLogger(PDFValidator.class.getCanonicalName()); // log output
// is
private String pdfFilename;
private String pdfReport;
private String Signature;
private String zfXML = null;
protected static boolean stringArrayContains(String[] arr, String targetValue) {
return Arrays.asList(arr).contains(targetValue);
}
public void validate() throws IrrecoverableValidationError {
zfXML = null;
File file = new File(pdfFilename);
// file existence must have been checked before
BigFileSearcher searcher = new BigFileSearcher();
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
if (searcher.indexOf(file, pdfSignature) != 0) {
context.addResultItem(
new ValidationResultItem(ESeverity.fatal, "Not a PDF file "+pdfFilename).setSection(20).setPart(EPart.pdf));
}
long startPDFTime = Calendar.getInstance().getTimeInMillis();
// Step 1 Validate PDF
VeraGreenfieldFoundryProvider.initialise();
// Default validator config
ValidatorConfig validatorConfig = ValidatorFactory.defaultConfig();
// Default features config
FeatureExtractorConfig featureConfig = FeatureFactory.defaultConfig();
// Default plugins config
PluginsCollectionConfig pluginsConfig = PluginsCollectionConfig.defaultConfig();
// Default fixer config
MetadataFixerConfig fixerConfig = FixerFactory.defaultConfig();
// Tasks configuring
EnumSet tasks = EnumSet.noneOf(TaskType.class);
tasks.add(TaskType.VALIDATE);
// tasks.add(TaskType.EXTRACT_FEATURES);
// tasks.add(TaskType.FIX_METADATA);
// Creating processor config
ProcessorConfig processorConfig = ProcessorFactory.fromValues(validatorConfig, featureConfig, pluginsConfig,
fixerConfig, tasks);
// Creating processor and output stream.
ByteArrayOutputStream reportStream = new ByteArrayOutputStream();
try (BatchProcessor processor = ProcessorFactory.fileBatchProcessor(processorConfig)) {
// Generating list of files for processing
List<File> files = new ArrayList<>();
files.add(new File(pdfFilename));
// starting the processor
processor.process(files, ProcessorFactory.getHandler(FormatOption.MRR, true, reportStream, 100,
processorConfig.getValidatorConfig().isRecordPasses()));
pdfReport = reportStream.toString("utf-8").replaceAll("<\\?xml version=\"1\\.0\" encoding=\"utf-8\"\\?>",
"");
} catch (VeraPDFException e) {
ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(6)
.setPart(EPart.pdf);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
} catch (IOException excep) {
context.addResultItem(new ValidationResultItem(ESeverity.exception, excep.getMessage()).setSection(7)
.setPart(EPart.pdf).setStacktrace(excep.getStackTrace().toString()));
}
// step 2 validate XMP
ZUGFeRDImporter zi = new ZUGFeRDImporter(pdfFilename);
String xmp = zi.getXMP();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document docXMP;
if (xmp.length() == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "Invalid XMP Metadata not found")
.setSection(17).setPart(EPart.pdf));
}
/*
* checking for sth like <zf:ConformanceLevel>EXTENDED</zf:ConformanceLevel>
* <zf:DocumentType>INVOICE</zf:DocumentType>
* <zf:DocumentFileName>ZUGFeRD-invoice.xml</zf:DocumentFileName>
* <zf:Version>1.0</zf:Version>
*/
try {
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xmp));
docXMP = builder.parse(is);
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object XPath xpath = xpathFactory.newXPath(); XPathExpression
XPath xpath = xpathFactory.newXPath();
// xpath.compile("//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/[local-name()=\"ID\"]");
// evaluate expression result on XML document ndList = (NodeList)
// get the first element
XPathExpression xpr = xpath.compile(
"//*[local-name()=\"ConformanceLevel\"]|//*[local-name()=\"Description\"]/@ConformanceLevel");
NodeList nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
if (nodes.getLength() == 0) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: ConformanceLevel not found")
.setSection(11).setPart(EPart.pdf));
}
boolean conformanceLevelValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
String[] valueArray = { "BASIC WL", "BASIC", "MINIMUM", "EN 16931", "COMFORT", "CIUS", "EXTENDED" };
if (stringArrayContains(valueArray, nodes.item(i).getTextContent())) {
conformanceLevelValid=true;
}
}
if (!conformanceLevelValid) {
context.addResultItem(new ValidationResultItem(ESeverity.error,
"XMP Metadata: ConformanceLevel contains invalid value").setSection(12).setPart(EPart.pdf));
}
xpr = xpath.compile("//*[local-name()=\"DocumentType\"]|//*[local-name()=\"Description\"]/@DocumentType");
nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
if (nodes.getLength() == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "XMP Metadata: DocumentType not found")
.setSection(13).setPart(EPart.pdf));
}
boolean documentTypeValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
if (nodes.item(i).getTextContent().equals("INVOICE")) {
documentTypeValid=true;
}
}
if (!documentTypeValid) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: DocumentType invalid")
.setSection(14).setPart(EPart.pdf));
}
xpr = xpath.compile(
"//*[local-name()=\"DocumentFileName\"]|//*[local-name()=\"Description\"]/@DocumentFileName");
nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
if (nodes.getLength() == 0) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: DocumentFileName not found")
.setSection(21).setPart(EPart.pdf));
}
boolean documentFilenameValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
String[] valueArray = { "factur-x.xml", "ZUGFeRD-invoice.xml", "zugferd-invoice.xml" };
if (stringArrayContains(valueArray, nodes.item(i).getTextContent())) {
documentFilenameValid=true;
}
// e.g. ZUGFeRD-invoice.xml
}
if (!documentFilenameValid) {
context.addResultItem(new ValidationResultItem(ESeverity.error,
"XMP Metadata: DocumentFileName contains invalid value").setSection(19).setPart(EPart.pdf));
}
xpr = xpath.compile("//*[local-name()=\"Version\"]|//*[local-name()=\"Description\"]/@Version");
nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
// get all child nodes
// NodeList nodes = element.getChildNodes();
// expr.evaluate(docXMP, XPathConstants.NODESET);
// print the text content of each child
if (nodes.getLength() == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "XMP Metadata: Version not found")
.setSection(15).setPart(EPart.pdf));
}
boolean versionValid=false;
for (int i = 0; i < nodes.getLength(); i++) {
String[] valueArray = { "1.0", "2p0" };
if (stringArrayContains(valueArray, nodes.item(i).getTextContent())) {
versionValid=true;
} // e.g. 1.0
}
if (!versionValid) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "XMP Metadata: Version contains invalid value")
.setSection(16).setPart(EPart.pdf));
}
} catch (SAXException e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} catch (ParserConfigurationException e) {
LOGGER.error(e.getMessage(), e);
} catch (XPathExpressionException e) {
LOGGER.error(e.getMessage(), e);
}
zfXML = zi.getUTF8();
// step 3 find signatures
try {
byte[] symtraxSignature = "Symtrax".getBytes("UTF-8");
byte[] mustangSignature = "via mustangproject".getBytes("UTF-8");
byte[] facturxpythonSignature = "by Alexis de Lattre".getBytes("UTF-8");
byte[] intarsysSignature = "intarsys ".getBytes("UTF-8");
byte[] konikSignature = "Konik".getBytes("UTF-8");
byte[] pdfMachineSignature = "pdfMachine from Broadgun Software".getBytes("UTF-8");
if (searcher.indexOf(file, symtraxSignature) != -1) {
Signature = "Symtrax";
} else if (searcher.indexOf(file, mustangSignature) != -1) {
Signature = "Mustang";
} else if (searcher.indexOf(file, facturxpythonSignature) != -1) {
Signature = "Factur/X Python";
} else if (searcher.indexOf(file, intarsysSignature) != -1) {
Signature = "Intarsys";
} else if (searcher.indexOf(file, konikSignature) != -1) {
Signature = "Konik";
} else if (searcher.indexOf(file, pdfMachineSignature) != -1) {
Signature = "pdfMachine";
}
context.setSignature(Signature);
} catch (UnsupportedEncodingException e) {
LOGGER.error(e.getMessage(), e);
}
// step 4:validate additional data
HashMap<String, byte[]> additionalData=zi.getAdditionalData();
for (String filename : additionalData.keySet()) {
// validating xml in byte[] additionalData.get(filename)
LOGGER.info("validating additionalData " + filename);
validateSchema(additionalData.get(filename), "ad/basic/additional_data_base_schema.xsd", 2, EPart.pdf);
}
//end
long endTime = Calendar.getInstance().getTimeInMillis();
if (!pdfReport.contains("validationReports compliant=\"1\"")) {
context.setInvalid();
}
if (!pdfReport.contains("PDF/A-3")) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "Not a PDF/A-3").setSection(23).setPart(EPart.pdf));
}
context.addCustomXML(pdfReport + "<info><signature>"
+ ((context.getSignature() != null) ? context.getSignature() : "unknown")
+ "</signature><duration unit='ms'>" + (endTime - startPDFTime) + "</duration></info>");
}
@Override
public void setFilename(String filename) throws IrrecoverableValidationError {
this.pdfFilename = filename;
}
public String getRawXML() {
return zfXML;
}
public String getSignature() {
return Signature;
}
}

View File

@@ -0,0 +1,84 @@
package org.mustangproject.validator;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class SchematronPipeline {
static final ClassLoader cl = SchematronPipeline.class.getClassLoader();
private static final TransformerFactory factory = getTransformerFactory();
private static final String xslExt = ".xsl"; //$NON-NLS-1$
private static final String resourcePath = "iso-schematron-xslt2/"; //$NON-NLS-1$
private static final String isoDsdlXsl = resourcePath + "iso_dsdl_include" + xslExt; //$NON-NLS-1$
private static final String isoExpXsl = resourcePath + "iso_abstract_expand" + xslExt; //$NON-NLS-1$
private static final String isoSvrlXsl = resourcePath + "iso_svrl_for_xslt2" + xslExt; //$NON-NLS-1$
private static final Templates cachedIsoDsdXsl = createCachedTransform(isoDsdlXsl);
private static final Templates cachedExpXsl = createCachedTransform(isoExpXsl);
private static final Templates cachedIsoSvrlXsl = createCachedTransform(isoSvrlXsl);
private static TransformerFactory getTransformerFactory() {
TransformerFactory fact = TransformerFactory.newInstance();
fact.setURIResolver(new ClasspathResourceURIResolver());
return fact;
}
static Templates createCachedTransform(final String transName) {
try {
return factory.newTemplates(new StreamSource(cl.getResourceAsStream(transName)));
} catch (TransformerConfigurationException excep) {
throw new IllegalStateException("Policy Schematron transformer XSL " + transName + " not found.", excep); //$NON-NLS-1$ //$NON-NLS-2$
}
}
public static void processSchematron(InputStream schematronSource, OutputStream xslDest)
throws TransformerException, IOException {
File isoDsdResult = createTempFileResult(cachedIsoDsdXsl.newTransformer(), new StreamSource(schematronSource),
"IsoDsd"); //$NON-NLS-1$
File isoExpResult = createTempFileResult(cachedExpXsl.newTransformer(), new StreamSource(isoDsdResult),
"ExpXsl"); //$NON-NLS-1$
cachedIsoSvrlXsl.newTransformer().transform(new StreamSource(isoExpResult), new StreamResult(xslDest));
isoDsdResult.delete();
isoExpResult.delete();
}
private static File createTempFileResult(final Transformer transformer, final StreamSource toTransform,
final String suffix) throws TransformerException, IOException {
File result = File.createTempFile("ZUV_", suffix); //$NON-NLS-1$
result.deleteOnExit();
try (FileOutputStream fos = new FileOutputStream(result)) {
transformer.transform(toTransform, new StreamResult(fos));
}
return result;
}
private static class ClasspathResourceURIResolver implements URIResolver {
ClasspathResourceURIResolver() {
// Do nothing, just prevents synthetic access warning.
}
@Override
public Source resolve(String href, String base) throws TransformerException {
return new StreamSource(cl.getResourceAsStream(resourcePath + href));
}
}
public static void applySchematronXsl(final InputStream xmlFile,
final OutputStream policyReport) throws TransformerException {
Transformer transformer = factory.newTransformer(new StreamSource(cl.getResourceAsStream(resourcePath+"ZUGFeRDSchematronStylesheetXSLT1.xsl")));
transformer.transform(new StreamSource(xmlFile), new StreamResult(policyReport));
}
}

View File

@@ -0,0 +1,146 @@
package org.mustangproject.validator;
import java.util.ArrayList;
import java.util.Vector;
import org.slf4j.Logger;
public class ValidationContext {
protected Vector<ValidationResultItem> results;
protected String customXML = "";
private String version = null;
private String profile = null;
private String signature = null;
private boolean isValid = true;
protected Logger logger;
private String filename;
public ValidationContext(Logger log) {
logger = log;
results = new Vector<ValidationResultItem>();
}
public void addResultItem(ValidationResultItem vr) throws IrrecoverableValidationError {
results.add(vr);
if ((vr.getSeverity() == ESeverity.fatal) || (vr.getSeverity() == ESeverity.exception)
|| (vr.getSeverity() == ESeverity.error)) {
isValid = false;
}
if (logger != null) {
if ((vr.getSeverity() == ESeverity.fatal) || (vr.getSeverity() == ESeverity.exception)) {
logger.error("Fatal Error " + vr.getSection() + ": " + vr.getMessage());
} else if ((vr.getSeverity() == ESeverity.error)) {
logger.error("Error " + vr.getSection() + ": " + vr.getMessage());
} else if (vr.getSeverity() == ESeverity.warning) {
logger.warn("Warning " + vr.getSection() + ": " + vr.getMessage());
} else if (vr.getSeverity() == ESeverity.notice) {
logger.info("Notice " + vr.getSection() + ": " + vr.getMessage());
}
}
if ((vr.getSeverity() == ESeverity.fatal) || (vr.getSeverity() == ESeverity.exception)) {
throw new IrrecoverableValidationError(vr.getMessage());
}
}
public void clearCustomXML() {
customXML = "";
}
public void addCustomXML(String XML) {
customXML += XML;
}
public String getCustomXML() {
return customXML;
}
public ValidationContext setVersion(String version) {
this.version = version;
return this;
}
public ValidationContext setProfile(String profile) {
this.profile = profile;
return this;
}
public ValidationContext setSignature(String signature) {
this.signature = signature;
return this;
}
public String getVersion() {
return version;
}
public String getProfile() {
return profile;
}
public String getSignature() {
return signature;
}
public boolean isValid() {
return isValid;
}
public void clear() {
results.clear();
isValid = true;
clearCustomXML();
version = null;
profile = null;
signature = null;
}
public String getXMLResult() {
String res = getCustomXML();
if (results.size() > 0) {
res += "<messages>";
}
for (ValidationResultItem validationResultItem : results) {
// xml and pdf are handled in their respective sections
res += validationResultItem.getXMLOnce() + "\n";
}
if (results.size() > 0) {
res += "</messages>";
}
res += "<summary status='" + (isValid ? "valid" : "invalid") + "'/>";
return res;
}
/***
*
* @return the unique error types as comma separated string
*/
public String getCSVResult() {
ArrayList<String> errorcodes = new ArrayList<String>();
for (ValidationResultItem validationResultItem : results) {
String errorCodeStr=Integer.toString(validationResultItem.getSection());
errorcodes.add(errorCodeStr);
}
return String.join(",", errorcodes);
}
public void setInvalid() {
isValid = false;
}
public void setFilename(String filename) {
this.filename=filename;
}
public String getFilename() {
if (filename==null) {
return "";
} else {
return filename;
}
}
}

View File

@@ -0,0 +1,114 @@
package org.mustangproject.validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ValidationResultItem {
private static final Logger LOGGER = LoggerFactory.getLogger(ValidationResultItem.class.getCanonicalName()); // log output is
// ignored for the
// time being
protected String message, location=null;
protected int section =-1;
private ESeverity severity=ESeverity.error;
private String criterion=null;
private String stacktrace=null;
private boolean hasBeenOutputted=false;
private EPart part;
private XMLTools xt;
public ValidationResultItem(ESeverity sev, String msg) {
setSeverity(sev);
setMessage(msg);
xt=new XMLTools();
}
public ValidationResultItem setMessage(String msg) {
message=msg;
return this;
}
public ValidationResultItem setSection(int sec) {
section=sec;
return this;
}
public ValidationResultItem setLocation(String loc) {
location=loc;
return this;
}
public ValidationResultItem setPart(EPart loc) {
part=loc;
return this;
}
public EPart getPart() {
return part;
}
public ValidationResultItem setSeverity(ESeverity sev) {
severity=sev;
return this;
}
public ValidationResultItem setStacktrace(String stack) {
stacktrace=stack;
return this;
}
public String getXML() {
String tagname="error";
if (severity==ESeverity.exception) {
tagname="exception";
} else if (severity==ESeverity.warning) {
tagname="warning";
} else if (severity==ESeverity.notice) {
tagname="notice";
}
String additionalAttributes="";
String additionalContents="";
if (section!=-1) {
additionalAttributes+=" type=\""+section+"\"";
}
if (location!=null) {
additionalAttributes+=" location=\""+xt.escapeAttributeEntities(location)+"\"";
}
if (criterion!=null) {
additionalAttributes+=" criterion=\""+xt.escapeAttributeEntities(criterion)+"\"";
}
if (stacktrace!=null) {
additionalContents+="<stacktrace>"+xt.escapeAttributeEntities(stacktrace)+"</stacktrace>";
}
hasBeenOutputted=true;
return "<"+tagname+additionalAttributes+">"+xt.escapeElementEntities(message+additionalContents)+"</"+tagname+">";
}
public String getXMLOnce() {
if (!hasBeenOutputted) {
return getXML();
} else {
return "";
}
}
public ValidationResultItem setCriterion(String test) {
criterion = test;
return this;
}
public ESeverity getSeverity() {
return severity;
}
public int getSection() {
return section;
}
public String getMessage() {
return message;
}
}

View File

@@ -0,0 +1,60 @@
package org.mustangproject.validator;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.net.URL;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
//abstract class
public abstract class Validator {
private static final Logger LOGGER = LoggerFactory.getLogger(Validator.class.getCanonicalName()); // log output
protected ValidationContext context;
public Validator(ValidationContext ctx){
this.context=ctx;
}
//abstract method
public abstract void setFilename(String filename) throws IrrecoverableValidationError;
public abstract void validate() throws IrrecoverableValidationError;
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
*/
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);
try {
Schema schema = schemaFactory.newSchema(schemaFile);
javax.xml.validation.Validator validator = schema.newValidator();
validator.validate(xmlData);
} catch (SAXException e) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "schema validation fails:" + e)
.setSection(section).setPart(part));
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
}

View File

@@ -0,0 +1,14 @@
package org.mustangproject.validator;
import org.dom4j.io.XMLWriter;
public class XMLTools extends XMLWriter {
public String escapeAttributeEntities(String s) {
return super.escapeAttributeEntities(s);
}
public String escapeElementEntities(String s) {
return super.escapeElementEntities(s);
}
}

View File

@@ -0,0 +1,417 @@
package org.mustangproject.validator;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Calendar;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.helger.schematron.svrl.jaxb.FailedAssert;
import com.helger.schematron.svrl.jaxb.FiredRule;
import com.helger.schematron.svrl.jaxb.SchematronOutputType;
import com.helger.schematron.ISchematronResource;
import com.helger.schematron.xslt.SchematronResourceXSLT;
import com.helger.schematron.svrl.SVRLHelper;
import org.xml.sax.InputSource;
public class XMLValidator extends Validator {
public XMLValidator(ValidationContext ctx) {
super(ctx);
}
private static final Logger LOGGER = LoggerFactory.getLogger(XMLValidator.class.getCanonicalName()); // log output
// is
// ignored for the
// time being
protected String zfXML = "";
protected String filename = "";
int firedRules = 0;
int failedRules = 0;
ISchematronResource aResSCH = null;
public void setFilename(String name) throws IrrecoverableValidationError { // from XML Filename
filename = name;
// file existence must have been checked before
try {
zfXML = new String(Files.readAllBytes(Paths.get(name)));
} catch (IOException e) {
ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(9)
.setPart(EPart.fx);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
}
}
public void setStringContent(String xml) {
zfXML = xml;
}
public static boolean matchesURI(String uri1, String uri2) {
return (uri1.equals(uri2) || uri1.startsWith(uri2 + "#"));
}
/***
*
* @param xmlString
* @param overrideProfileCheck
* if set to true, all ZF2 files will be checked against EN16931
* schematron, since no other schematron is available
* @return
*/
@Override
public void validate() throws IrrecoverableValidationError {
long startXMLTime = Calendar.getInstance().getTimeInMillis();
firedRules = 0;
failedRules = 0;
ByteArrayInputStream xmlByteInputStream = new ByteArrayInputStream(zfXML.getBytes(StandardCharsets.UTF_8));
if (zfXML.isEmpty()) {
ValidationResultItem res = new ValidationResultItem(ESeverity.exception,
"XML data not found in " + filename
+ ": did you specify a pdf or xml file and does the xml file contain an embedded XML file?")
.setSection(3);
context.addResultItem(res);
} else {
// final ISchematronResource aResSCH =
// SchematronResourceSCH.fromFile (new File("ZUGFeRD_1p0.scmt"));
// ... DOES work but is highly deprecated (and rightly so) because
// it takes 30-40min,
try {
/***
* private static final String VALID_SCHEMATRON = "test-sch/valid01.sch";
* private static final String VALID_XMLINSTANCE = "test-xml/valid01.xml";
*
* @Test public void testWriteValid () throws Exception { final Document aDoc =
* SchematronResourceSCH.fromClassPath (VALID_SCHEMATRON)
* .applySchematronValidation (new ClassPathResource (VALID_XMLINSTANCE));
*
*/
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true); // otherwise we can not act namespace independently, i.e. use
// document.getElementsByTagNameNS("*",...
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(xmlByteInputStream);
Element root = doc.getDocumentElement();
NodeList ndList;
// rootNode = document.getDocumentElement();
// ApplicableSupplyChainTradeSettlement
// Create XPathFactory object
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object
XPath xpath = xpathFactory.newXPath();
XPathExpression expr = xpath.compile(
"//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/*[local-name()=\"ID\"]/text()");
// evaluate expression result on XML document
ndList = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
for (int bookingIndex = 0; bookingIndex < ndList.getLength(); bookingIndex++) {
Node booking = ndList.item(bookingIndex);
// if there is a attribute in the tag number:value
// urn:ferd:CrossIndustryDocument:invoice:1p0:extended
// setForeignReference(booking.getTextContent());
context.setProfile(booking.getNodeValue());
}
boolean isMiniumum = false;
boolean isBasic = false;
boolean isBasicWithoutLines = false;
boolean isEN16931 = false;
boolean isExtended = false;
String xsltFilename = null;
// urn:ferd:CrossIndustryDocument:invoice:1p0:extended,
// urn:ferd:CrossIndustryDocument:invoice:1p0:comfort,
// urn:ferd:CrossIndustryDocument:invoice:1p0:basic,
// urn:cen.eu:en16931:2017
// urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:basic
if (root.getNodeName().equalsIgnoreCase("rsm:CrossIndustryInvoice")) { // ZUGFeRD 2.0 or Factur-X
context.setVersion("2");
isMiniumum = context.getProfile().contains("minimum");
isBasic = context.getProfile().contains("basic");
isBasicWithoutLines = context.getProfile().contains("basicwl");
if (isBasicWithoutLines) {
isBasic = false;// basicwl also contains the string basic...
}
isEN16931 = matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:en16931")
|| matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017");
isExtended = context.getProfile().contains("extended");
if (isExtended) {
isEN16931 = false;// the uri for extended is urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p0:extended and thus contains en16931...
}
if (isMiniumum) {
LOGGER.debug("is Minimum");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/MINIMUM/FACTUR-X_MINIMUM.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_minimum.xsl";
} else if (isBasicWithoutLines) {
LOGGER.debug("is Basic/WL");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/BASIC-WL/FACTUR-X_BASIC-WL.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_basicwl.xsl";
} else if (isBasic) {
LOGGER.debug("is Basic");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/BASIC/FACTUR-X_BASIC.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_basic.xsl";
} else if (isEN16931) {
LOGGER.debug("is EN16931");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_en16931.xsl";
} else if (isExtended) {
LOGGER.debug("is EXTENDED");
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf2/EXTENDED/FACTUR-X_EXTENDED.xsd", 18, EPart.fx);
xsltFilename = "/xslt/zugferd21_extended.xsl";
} /*
* ISchematronResource aResSCH = SchematronResourceXSLT.fromFile(new File(
* "/Users/jstaerk/workspace/ZUV/src/main/resources/ZUGFeRDSchematronStylesheet.xsl"
* ));
*/
// takes around 10 Seconds. //
// http://www.bentoweb.org/refs/TCDL2.0/tsdtf_schematron.html // explains that
// this xslt can be created using sth like
// saxon java net.sf.saxon.Transform -o tcdl2.0.tsdtf.sch.tmp.xsl -s
// tcdl2.0.tsdtf.sch iso_svrl.xsl
} else { // ZUGFeRD 1.0
context.setVersion("1");
//
if ((!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"))) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "Unsupported profile type")
.setSection(25).setPart(EPart.fx));
}
validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "zf1/ZUGFeRD1p0.xsd", 18, EPart.fx);
xsltFilename = "/xslt/ZUGFeRD_1p0.xslt";
}
if (context.getVersion().equals("2")) {
if ((!matchesURI(context.getProfile(), "urn:factur-x.eu:1p0:minimum"))
&& (!matchesURI(context.getProfile(), "urn:zugferd.de:2p0:minimum"))
&& (!matchesURI(context.getProfile(), "urn:factur-x.eu:1p0:basicwl"))
&& (!matchesURI(context.getProfile(), "urn:zugferd.de:2p0:basicwl"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#compliant#urn:zugferd.de:2p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended"))
&& (!matchesURI(context.getProfile(), "urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p0:extended"))) {
context.addResultItem(
new ValidationResultItem(ESeverity.error, "Unsupported profile type " + context.getProfile())
.setSection(25).setPart(EPart.fx));
}
} else /** v1 */ {//urn:ferd:invoice:rc:comfort
if ((!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:basic"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort"))
&& (!matchesURI(context.getProfile(), "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"))) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "Unsupported profile type")
.setSection(25).setPart(EPart.fx));
}
}
// main schematron validation
validateSchematron(zfXML, xsltFilename, 4, ESeverity.error);
if (context.getVersion().equals("2")
&& isEN16931) {
//additionally validate against CEN
validateSchematron(zfXML, "/xslt/cii16931schematron/EN16931-CII-validation.xslt", 24, ESeverity.error);
validateXR(zfXML);
}
} catch (IrrecoverableValidationError er) {
throw er;
} catch (Exception e) {
ValidationResultItem vri = new ValidationResultItem(ESeverity.exception, e.getMessage()).setSection(22)
.setPart(EPart.fx);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
vri.setStacktrace(sw.toString());
context.addResultItem(vri);
}
}
long endTime = Calendar.getInstance().getTimeInMillis();
context.addCustomXML("<info><version>" + ((context.getVersion() != null) ? context.getVersion() : "invalid")
+ "</version><profile>" + ((context.getProfile() != null) ? context.getProfile() : "invalid") +
"</profile><validator version=\"" + Main.class.getPackage().getImplementationVersion() + "\"></validator><rules><fired>" + firedRules + "</fired><failed>" + failedRules + "</failed></rules>" + "<duration unit='ms'>" + (endTime - startXMLTime) + "</duration></info>");
}
protected String getXRValidationResult(String xml) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
TransformerFactory factory = TransformerFactory.newInstance();
try {
// Use the factory to create a template containing the xsl file
Templates template = factory.newTemplates(new StreamSource(
this.getClass().getResourceAsStream("/xslt/XRechnung-CII-validation.xsl")));
// Use the template to create a transformer
Transformer xformer = template.newTransformer();
// Prepare the input and output files
Source source = new StreamSource(new ByteArrayInputStream(xml.getBytes()));
Result result = new StreamResult(baos);
// Apply the xsl file to the source file and write the result
// to the output file
xformer.transform(source, result);
} catch (Exception ex) {
LOGGER.error(ex.getMessage(), ex);
}
return baos.toString();
}
public void validateXR(String xml) throws IrrecoverableValidationError {
/*
DocumentBuilderFactory docbfactory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = docbfactory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(getXRValidationResult(xml)));
Document docXMP = builder.parse(is);
XPathFactory xpathFactory = XPathFactory.newInstance();
// Create XPath object XPath xpath = xpathFactory.newXPath(); XPathExpression
XPath xpath = xpathFactory.newXPath();
// xpath.compile("//*[local-name()=\"GuidelineSpecifiedDocumentContextParameter\"]/[local-name()=\"ID\"]");
// evaluate expression result on XML document ndList = (NodeList)
// get the first element
XPathExpression xpr = xpath.compile(
"//*[local-name()=\"failed-assert\"]");
NodeList nodes = (NodeList) xpr.evaluate(docXMP, XPathConstants.NODESET);
for (int nodeIndex = 0; nodeIndex < nodes.getLength(); nodeIndex++) {
String loc=nodes.item(nodeIndex).getAttributes().getNamedItem("location").getTextContent();
NodeList failedSubNodes=nodes.item(nodeIndex).getChildNodes();
for (int failedSubNodeIndex = 0; failedSubNodeIndex < nodes.getLength(); failedSubNodeIndex++) {
if (failedSubNodes.item(failedSubNodeIndex).getNodeName().equals("svrl:text")) {
context.addResultItem(
new ValidationResultItem(ESeverity.warning, failedSubNodes.item(failedSubNodeIndex).getTextContent())
.setLocation(loc).setSection(27).setPart(EPart.xr));
}
}
}
} catch (Exception ex) {
LOGGER.error(ex.getMessage(), ex);
}
*/
validateSchematron(xml, "/xslt/XRechnung-CII-validation.xslt",27, ESeverity.notice);
}
public void validateSchematron(String xml, String xsltFilename, int section, ESeverity severity) throws IrrecoverableValidationError {
ISchematronResource aResSCH = null;
aResSCH = SchematronResourceXSLT.fromClassPath(xsltFilename);
if (aResSCH != null) {
if (!aResSCH.isValidSchematron()) {
throw new IllegalArgumentException(xsltFilename + " is invalid Schematron!");
}
SchematronOutputType sout;
try {
sout = aResSCH
.applySchematronValidationToSVRL(new StreamSource(new StringReader(xml)));
} catch (Exception e) {
throw new IrrecoverableValidationError(e.getMessage());
}
List<Object> failedAsserts = sout.getActivePatternAndFiredRuleAndFailedAssert();
if (failedAsserts.size() > 0) {
for (Object object : failedAsserts) {
if (object instanceof FailedAssert) {
FailedAssert failedAssert = (FailedAssert) object;
LOGGER.info("FailedAssert ", failedAssert);
context.addResultItem(new ValidationResultItem(severity, SVRLHelper.getAsString(failedAssert.getText()))
.setLocation(failedAssert.getLocation()).setCriterion(failedAssert.getTest()).setSection(section)
.setPart(EPart.fx));
failedRules++;
} else if (object instanceof FiredRule) {
firedRules++;
}
}
}
if (firedRules == 0) {
context.addResultItem(new ValidationResultItem(ESeverity.error, "No rules matched, XML to minimal?").setSection(26)
.setPart(EPart.fx));
}
// for (String currentString : sout.getText()) {
// schematronValidationString += "<output>" + currentString + "</output>";
// }
// schematronValidationString += new SVRLMarshaller ().getAsString (sout);
// returns the complete SVRL
}
}
public int getFiredRules() {
return firedRules;
}
public int getFailedRules() {
return failedRules;
}
}

View File

@@ -0,0 +1,292 @@
package org.mustangproject.validator;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
import org.riversun.bigdoc.bin.BigFileSearcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXParseException;
//abstract class
public class ZUGFeRDValidator {
private static final Logger LOGGER = LoggerFactory.getLogger(ZUGFeRDValidator.class.getCanonicalName()); // log
// output
protected ValidationContext context = new ValidationContext(LOGGER);
protected String sha1Checksum;
protected boolean pdfValidity;
protected boolean displayXMLValidationOutput;
protected long startTime;
protected boolean optionsRecognized;
protected String Signature;
protected boolean wasCompletelyValid = false;
protected String logAppend=null;
/***
* within the validation it turned out something in the options was wrong, e.g.
* the file did not exist. recommendation to show the help text again. Should be
* false if XML or PDF file was found
*/
public boolean hasOptionsError() {
return !optionsRecognized;
}
public void setLogAppend(String tobeappended) {
logAppend = tobeappended;
}
/***
* in case the result was not valid the error code of the app will be set to -1
*
* @return
*/
public boolean wasCompletelyValid() {
return wasCompletelyValid;
}
/***
* performs a validation on the file filename
*
* @param filename
* @return
*/
public String validate(String filename) {
boolean xmlValidity;
context.clear();
StringBuffer finalStringResult = new StringBuffer();
SimpleDateFormat isoDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
Date date = new Date();
startTime = Calendar.getInstance().getTimeInMillis();
try {
Path path = Paths.get(filename);
context.setFilename(path.getFileName().toString());// set filename without path
} catch (NullPointerException ex) {
// ignore
}
finalStringResult
.append("<validation filename='" + context.getFilename() + "' datetime='" + isoDF.format(date) + "'>");
try {
if (filename == null) {
optionsRecognized = false;
context.addResultItem(new ValidationResultItem(ESeverity.fatal, "Filename not specified").setSection(10)
.setPart(EPart.pdf));
}
PDFValidator pdfv = new PDFValidator(context);
File file = new File(filename);
if (!file.exists()) {
context.addResultItem(
new ValidationResultItem(ESeverity.fatal, "File not found").setSection(1).setPart(EPart.pdf));
} else if (file.length() < 32) {
// with less then 32 bytes it can not even be a proper XML file
context.addResultItem(
new ValidationResultItem(ESeverity.fatal, "File too small").setSection(5).setPart(EPart.pdf));
} else {
BigFileSearcher searcher = new BigFileSearcher();
XMLValidator xv = new XMLValidator(context);
byte[] pdfSignature = { '%', 'P', 'D', 'F' };
boolean isPDF = searcher.indexOf(file, pdfSignature) == 0;
if (isPDF) {
pdfv.setFilename(filename);
optionsRecognized = true;
try {
if (!file.exists()) {
context.addResultItem(
new ValidationResultItem(ESeverity.exception, "File " + filename + " not found")
.setSection(1));
}
} catch (IrrecoverableValidationError irx) {
// @todo log
}
finalStringResult.append("<pdf>");
optionsRecognized = true;
try {
pdfv.validate();
sha1Checksum = calcSHA1(file);
// Validate PDF
finalStringResult.append(pdfv.getXMLResult());
pdfValidity = context.isValid();
Signature = context.getSignature();
context.clear();// clear sets valid to true again
if (pdfv.getRawXML() != null) {
xv.setStringContent(pdfv.getRawXML());
displayXMLValidationOutput = true;
} else {
context.addResultItem(
new ValidationResultItem(ESeverity.exception, "XML could not be extracted")
.setSection(17));
}
} catch (IrrecoverableValidationError irx) {
// @todo log
}
finalStringResult.append("</pdf>\n");
context.clearCustomXML();
} else {
boolean isXML = false;
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
Element root = doc.getDocumentElement();
isXML=true;//no exception so far
}
catch (Exception ex) {
// probably no xml file, sth like SAXParseException content not allowed in prolog
// ignore isXML is already false
// in the tests, this may error-out anyway
}
if (isXML) {
pdfValidity = true;
optionsRecognized = true;
xv.setFilename(filename);
if (file.exists()) {
sha1Checksum = calcSHA1(file);
}
displayXMLValidationOutput = true;
} else {
optionsRecognized = false;
context.addResultItem(new ValidationResultItem(ESeverity.exception,
"File does not look like PDF nor XML (contains neither %PDF nor <?xml)").setSection(8));
}
}
if ((optionsRecognized) && (displayXMLValidationOutput)) {
finalStringResult.append("<xml>");
try {
xv.validate();
} catch (IrrecoverableValidationError irx) {
// @todo log
}
finalStringResult.append(xv.getXMLResult());
finalStringResult.append("</xml>");
context.clearCustomXML();
}
if ((isPDF)&&(!pdfValidity)) {
context.setInvalid();
}
}
}
catch (IrrecoverableValidationError irx) {
// @todo log
} finally {
finalStringResult.append(context.getXMLResult());
finalStringResult.append("</validation>");
}
OutputFormat format = OutputFormat.createPrettyPrint();
StringWriter sw = new StringWriter();
org.dom4j.Document document = null;
try {
document = DocumentHelper.parseText(new String(finalStringResult));
} catch (DocumentException e1) {
LOGGER.error(e1.getMessage());
}
XMLWriter writer = new XMLWriter(sw, format);
try {
writer.write(document);
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
xmlValidity = context.isValid();
long duration = Calendar.getInstance().getTimeInMillis() - startTime;
String toBeAppended="";
if (logAppend!=null) {
toBeAppended=logAppend;
}
LOGGER.info("Parsed PDF:" + (pdfValidity ? "valid" : "invalid") + " XML:" + (xmlValidity ? "valid" : "invalid")
+ " Signature:" + Signature + " Checksum:" + sha1Checksum + " Profile:" + context.getProfile()
+ " Version:" + context.getVersion() + " Took:" + duration + "ms Errors:["+context.getCSVResult()+"] "+toBeAppended);
wasCompletelyValid = ((pdfValidity) && (xmlValidity));
return sw.toString();
}
/**
* Read the file and calculate the SHA-1 checksum
*
* @param file the file to read
* @return the hex representation of the SHA-1 using uppercase chars
* @throws FileNotFoundException if the file does not exist, is a directory
* rather than a regular file, or for some
* other reason cannot be opened for reading
* @throws IOException if an I/O error occurs
* @throws NoSuchAlgorithmException should never happen
*/
private static String calcSHA1(File file) {
MessageDigest sha1 = null;
try {
sha1 = MessageDigest.getInstance("SHA-1");
InputStream input = new FileInputStream(file);
byte[] buffer = new byte[8192];
int len = input.read(buffer);
while (len != -1) {
sha1.update(buffer, 0, len);
len = input.read(buffer);
}
input.close();
} catch (FileNotFoundException e) {
LOGGER.error(e.getMessage(), e);
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
} catch (NoSuchAlgorithmException e) {
LOGGER.error(e.getMessage(), e);
}
if (sha1 == null) {
return "";
} else {
return new HexBinaryAdapter().marshal(sha1.digest());
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,297 @@
<?xml version="1.0" encoding="UTF-8"?><?xar XSLT?>
<!--
OVERVIEW - iso_abstract_expand.xsl
This is a preprocessor for ISO Schematron, which implements abstract patterns.
It also
* extracts a particular schema using an ID, where there are multiple
schemas, such as when they are embedded in the same NVDL script
* experimentally, allows parameter recognition and substitution inside
text as well as @context, @test, & @select.
This should be used after iso-dsdl-include.xsl and before the skeleton or
meta-stylesheet (e.g. iso-svrl.xsl) . It only requires XSLT 1.
Each kind of inclusion can be turned off (or on) on the command line.
-->
<!--
VERSION INFORMATION
2008-09-18 RJ
* move out param test from iso:schema template to work with XSLT 1. (Noah Fontes)
2008-07-29 RJ
* Create. Pull out as distinct XSL in its own namespace from old iso_pre_pro.xsl
* Put everything in private namespace
* Rewrite replace_substring named template so that copyright is clear
2008-07-24 RJ
* correct abstract patterns so for correct names: param/@name and
param/@value
2007-01-12 RJ
* Use ISO namespace
* Use pattern/@id not pattern/@name
* Add Oliver Becker's suggests from old Schematron-love-in list for <copy>
* Add XT -ism?
2003 RJ
* Original written for old namespace
* http://www.topologi.com/resources/iso-pre-pro.xsl
-->
<!--
LEGAL INFORMATION
Copyright (c) 2000-2008 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-->
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:nvdl="http://purl.oclc.org/dsdl/nvdl"
xmlns:iae="http://www.schematron.com/namespace/iae"
>
<xslt:param name="schema-id"></xslt:param>
<!-- Driver for the mode -->
<xsl:template match="/">
<xsl:apply-templates select="." mode="iae:go" />
</xsl:template>
<!-- ================================================================================== -->
<!-- Normal processing rules -->
<!-- ================================================================================== -->
<!-- Output only the selected schema -->
<xslt:template match="iso:schema" >
<xsl:if test="string-length($schema-id) =0 or @id= $schema-id ">
<xslt:copy>
<xslt:copy-of select="@*" />
<xslt:apply-templates mode="iae:go" />
</xslt:copy>
</xsl:if>
</xslt:template>
<!-- Strip out any foreign elements above the Schematron schema .
-->
<xslt:template match="*[not(ancestor-or-self::iso:*)]" mode="iae:go" >
<xslt:apply-templates mode="iae:go" />
</xslt:template>
<!-- ================================================================================== -->
<!-- Handle Schematron abstract pattern preprocessing -->
<!-- abstract-to-real calls
do-pattern calls
macro-expand calls
multi-macro-expand
replace-substring -->
<!-- ================================================================================== -->
<!--
Abstract patterns allow you to say, for example
<pattern name="htmlTable" is-a="table">
<param name="row" value="html:tr"/>
<param name="cell" value="html:td" />
<param name="table" value="html:table" />
</pattern>
For a good introduction, see Uche Ogbujii's article for IBM DeveloperWorks
"Discover the flexibility of Schematron abstract patterns"
http://www-128.ibm.com/developerworks/xml/library/x-stron.html
However, note that ISO Schematron uses @name and @value attributes on
the iso:param element, and @id not @name on the pattern element.
-->
<!-- Suppress declarations of abstract patterns -->
<xslt:template match="iso:pattern[@abstract='true']" mode="iae:go" >
<xslt:comment>Suppressed abstract pattern <xslt:value-of select="@id"/> was here</xslt:comment>
</xslt:template>
<!-- Suppress uses of abstract patterns -->
<xslt:template match="iso:pattern[@is-a]" mode="iae:go" >
<xslt:comment>Start pattern based on abstract <xslt:value-of select="@is-a"/></xslt:comment>
<xslt:call-template name="iae:abstract-to-real" >
<xslt:with-param name="caller" select="@id" />
<xslt:with-param name="is-a" select="@is-a" />
</xslt:call-template>
</xslt:template>
<!-- output everything else unchanged -->
<xslt:template match="*" priority="-1" mode="iae:go" >
<xslt:copy>
<xslt:copy-of select="@*" />
<xslt:apply-templates mode="iae:go"/>
</xslt:copy>
</xslt:template>
<!-- Templates for macro expansion of abstract patterns -->
<!-- Sets up the initial conditions for the recursive call -->
<xslt:template name="iae:macro-expand">
<xslt:param name="caller"/>
<xslt:param name="text" />
<xslt:call-template name="iae:multi-macro-expand">
<xslt:with-param name="caller" select="$caller"/>
<xslt:with-param name="text" select="$text"/>
<xslt:with-param name="paramNumber" select="1"/>
</xslt:call-template>
</xslt:template>
<!-- Template to replace the current parameter and then
recurse to replace subsequent parameters. -->
<xslt:template name="iae:multi-macro-expand">
<xslt:param name="caller"/>
<xslt:param name="text" />
<xslt:param name="paramNumber" />
<xslt:choose>
<xslt:when test="//iso:pattern[@id=$caller]/iso:param[ $paramNumber]">
<xslt:call-template name="iae:multi-macro-expand">
<xslt:with-param name="caller" select="$caller"/>
<xslt:with-param name="paramNumber" select="$paramNumber + 1"/>
<xslt:with-param name="text" >
<xslt:call-template name="iae:replace-substring">
<xslt:with-param name="original" select="$text"/>
<xslt:with-param name="substring"
select="concat('$', //iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@name)"/>
<xslt:with-param name="replacement"
select="//iso:pattern[@id=$caller]/iso:param[ $paramNumber ]/@value"/>
</xslt:call-template>
</xslt:with-param>
</xslt:call-template>
</xslt:when>
<xslt:otherwise><xslt:value-of select="$text" /></xslt:otherwise>
</xslt:choose>
</xslt:template>
<!-- generate the real pattern from an abstract pattern + parameters-->
<xslt:template name="iae:abstract-to-real" >
<xslt:param name="caller"/>
<xslt:param name="is-a" />
<xslt:for-each select="//iso:pattern[@id= $is-a]">
<xslt:copy>
<xslt:choose>
<xslt:when test=" string-length( $caller ) = 0">
<xslt:attribute name="id"><xslt:value-of select="concat( generate-id(.) , $is-a)" /></xslt:attribute>
</xslt:when>
<xslt:otherwise>
<xslt:attribute name="id"><xslt:value-of select="$caller" /></xslt:attribute>
</xslt:otherwise>
</xslt:choose>
<xslt:apply-templates select="*|text()" mode="iae:do-pattern" >
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:apply-templates>
</xslt:copy>
</xslt:for-each>
</xslt:template>
<!-- Generate a non-abstract pattern -->
<xslt:template mode="iae:do-pattern" match="*">
<xslt:param name="caller"/>
<xslt:copy>
<xslt:for-each select="@*[name()='test' or name()='context' or name()='select']">
<xslt:attribute name="{name()}">
<xslt:call-template name="iae:macro-expand">
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:call-template>
</xslt:attribute>
</xslt:for-each>
<xslt:copy-of select="@*[name()!='test'][name()!='context'][name()!='select']" />
<xsl:for-each select="node()">
<xsl:choose>
<!-- Experiment: replace macros in text as well, to allow parameterized assertions
and so on, without having to have spurious <iso:value-of> calls and multiple
delimiting -->
<xsl:when test="self::text()">
<xslt:call-template name="iae:macro-expand">
<xslt:with-param name="text"><xslt:value-of select="."/></xslt:with-param>
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:call-template>
</xsl:when>
<xsl:otherwise>
<xslt:apply-templates select="." mode="iae:do-pattern">
<xslt:with-param name="caller"><xslt:value-of select="$caller"/></xslt:with-param>
</xslt:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xslt:copy>
</xslt:template>
<!-- UTILITIES -->
<!-- Simple version of replace-substring function -->
<xslt:template name="iae:replace-substring">
<xslt:param name="original" />
<xslt:param name="substring" />
<xslt:param name="replacement" select="''"/>
<xsl:choose>
<xsl:when test="not($original)" />
<xsl:when test="not(string($substring))">
<xsl:value-of select="$original" />
</xsl:when>
<xsl:when test="contains($original, $substring)">
<xsl:variable name="before" select="substring-before($original, $substring)" />
<xsl:variable name="after" select="substring-after($original, $substring)" />
<xsl:value-of select="$before" />
<xsl:value-of select="$replacement" />
<!-- recursion -->
<xsl:call-template name="iae:replace-substring">
<xsl:with-param name="original" select="$after" />
<xsl:with-param name="substring" select="$substring" />
<xsl:with-param name="replacement" select="$replacement" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- no substitution -->
<xsl:value-of select="$original" />
</xsl:otherwise>
</xsl:choose>
</xslt:template>
</xslt:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" ?><?xar XSLT?>
<!-- Implementation for the Schematron XML Schema Language.
http://www.ascc.net/xml/resource/schematron/schematron.html
Copyright (c) 2000,2001 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-->
<!-- Schematron message -->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">
<xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
<xsl:template name="process-prolog">
<axsl:output method="text" />
</xsl:template>
<!-- use default rule for process-root: copy contens / ignore title -->
<!-- use default rule for process-pattern: ignore name and see -->
<!-- use default rule for process-name: output name -->
<!-- use default rule for process-assert and process-report:
call process-message -->
<xsl:template name="process-message">
<xsl:param name="pattern" />
<xsl:param name="role" />
<axsl:message>
<xsl:apply-templates mode="text"
/> (<xsl:value-of select="$pattern" />
<xsl:if test="$role"> / <xsl:value-of select="$role" />
</xsl:if>)</axsl:message>
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,605 @@
<?xml version="1.0" ?>
<!--
ISO_SVRL.xsl
Implementation of Schematron Validation Report Language from ISO Schematron
ISO/IEC 19757 Document Schema Definition Languages (DSDL)
Part 3: Rule-based validation Schematron
Annex D: Schematron Validation Report Language
This ISO Standard is available free as a Publicly Available Specification in PDF from ISO.
Also see www.schematron.com for drafts and other information.
This implementation of SVRL is designed to run with the "Skeleton" implementation
of Schematron which Oliver Becker devised. The skeleton code provides a
Schematron implementation but with named templates for handling all output;
the skeleton provides basic templates for output using this API, but client
validators can be written to import the skeleton and override the default output
templates as required. (In order to understand this, you must understand that
a named template such as "process-assert" in this XSLT stylesheet overrides and
replaces any template with the same name in the imported skeleton XSLT file.)
The other important thing to understand in this code is that there are different
versions of the Schematron skeleton. These track the development of Schematron through
Schematron 1.5, Schematron 1.6 and now ISO Schematron. One only skeleton must be
imported. The code has templates for the different skeletons commented out for
convenience. ISO Schematron has a different namespace than Schematron 1.5 and 1.6;
so the ISO Schematron skeleton has been written itself with an optional import
statement to in turn import the Schematron 1.6 skeleton. This will allow you to
validate with schemas from either namespace.
History:
2010-04-14
* Add command line parameter 'terminate' which will terminate on first failed
assert and (optionally) successful report.
2009-03-18
* Fix attribute with space "see " which generates wrong name in some processors
2008-08-11
* RJ Fix attribute/@select which saxon allows in XSLT 1
2008-08-07
* RJ Add output-encoding attribute to specify final encoding to use
* Alter allow-foreign functionality so that Schematron span, emph and dir elements make
it to the output, for better formatting and because span can be used to mark up
semantically interesting information embedded in diagnostics, which reduces the
need to extend SVRL itself
* Diagnostic-reference had an invalid attribute @id that duplicated @diagnostic: removed
2008-08-06
* RJ Fix invalid output: svrl:diagnostic-reference is not contained in an svrl:text
* Output comment to SVRL file giving filename if available (from command-line parameter)
2008-08-04
* RJ move sch: prefix to schold: prefix to prevent confusion (we want people to
be able to switch from old namespace to new namespace without changing the
sch: prefix, so it is better to keep that prefix completely out of the XSLT)
* Extra signature fixes (PH)
2008-08-03
* Repair missing class parameter on process-p
2008-07-31
* Update skeleton names
2007-04-03
* Add option generate-fired-rule (RG)
2007-02-07
* Prefer true|false for parameters. But allow yes|no on some old for compatibility
* DP Diagnostics output to svrl:text. Diagnosis put out after assertion text.
* Removed non-SVRL elements and attributes: better handled as an extra layer that invokes this one
* Add more formal parameters
* Correct confusion between $schemaVersion and $queryBinding
* Indent
* Validate against RNC schemas for XSLT 1 and 2 (with regex tests removed)
* Validate output with UniversalTest.sch against RNC schema for ISO SVRL
2007-02-01
* DP. Update formal parameters of overriding named templates to handle more attributes.
* DP. Refactor handling of rich and linkable parameters to a named template.
2007-01-22
* DP change svrl:ns to svrl:ns-in-attribute-value
* Change default when no queryBinding from "unknown" to "xslt"
2007-01-18:
* Improve documentation
* KH Add command-line options to generate paths or not
* Use axsl:attribute rather than xsl:attribute to shut XSLT2 up
* Add extra command-line options to pass to the iso_schematron_skeleton
2006-12-01: iso_svrl.xsl Rick Jelliffe,
* update namespace,
* update phase handling,
* add flag param to process-assert and process-report & @ flag on output
2001: Conformance1-5.xsl Rick Jelliffe,
* Created, using the skeleton code contributed by Oliver Becker
-->
<!--
Derived from Conformance1-5.xsl.
Copyright (c) 2001-2010 Rick Jelliffe and Academia Sinica Computing Center, Taiwan
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a product,
an acknowledgment in the product documentation would be appreciated but is
not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-->
<!-- Ideas nabbed from schematrons by Francis N., Miloslav N. and David C. -->
<!-- The command-line parameters are:
phase NMTOKEN | "#ALL" (default) Select the phase for validation
allow-foreign "true" | "false" (default) Pass non-Schematron elements and rich markup to the generated stylesheet
diagnose= true | false|yes|no Add the diagnostics to the assertion test in reports (yes|no are obsolete)
generate-paths=true|false|yes|no generate the @location attribute with XPaths (yes|no are obsolete)
sch.exslt.imports semi-colon delimited string of filenames for some EXSLT implementations
optimize "visit-no-attributes" Use only when the schema has no attributes as the context nodes
generate-fired-rule "true"(default) | "false" Generate fired-rule elements
terminate= yes | no | true | false | assert Terminate on the first failed assertion or successful report
Note: whether any output at all is generated depends on the XSLT implementation.
-->
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias"
xmlns:schold="http://www.ascc.net/xml/schematron"
xmlns:iso="http://purl.oclc.org/dsdl/schematron"
xmlns:svrl="http://purl.oclc.org/dsdl/svrl"
>
<!-- Select the import statement and adjust the path as
necessary for your system.
If not XSLT2 then also remove svrl:active-pattern/@document="{document-uri()}" from process-pattern()
-->
<!--
<xsl:import href="iso_schematron_skeleton_for_saxon.xsl"/>
-->
<xsl:import href="iso_schematron_skeleton_for_xslt1.xsl"/>
<!--
<xsl:import href="iso_schematron_skeleton.xsl"/>
<xsl:import href="skeleton1-5.xsl"/>
<xsl:import href="skeleton1-6.xsl"/>
-->
<xsl:param name="diagnose" >true</xsl:param>
<xsl:param name="phase" >
<xsl:choose>
<!-- Handle Schematron 1.5 and 1.6 phases -->
<xsl:when test="//schold:schema/@defaultPhase">
<xsl:value-of select="//schold:schema/@defaultPhase"/>
</xsl:when>
<!-- Handle ISO Schematron phases -->
<xsl:when test="//iso:schema/@defaultPhase">
<xsl:value-of select="//iso:schema/@defaultPhase"/>
</xsl:when>
<xsl:otherwise>#ALL</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="allow-foreign" >false</xsl:param>
<xsl:param name="generate-paths" >true</xsl:param>
<xsl:param name="generate-fired-rule" >true</xsl:param>
<xsl:param name="optimize"/>
<xsl:param name="output-encoding" ></xsl:param>
<!-- e.g. saxon file.xml file.xsl "sch.exslt.imports=.../string.xsl;.../math.xsl" -->
<xsl:param name="sch.exslt.imports" />
<!-- Experimental: If this file called, then must be generating svrl -->
<xsl:variable name="svrlTest" select="true()" />
<!-- ================================================================ -->
<xsl:template name="process-prolog">
<axsl:output method="xml" omit-xml-declaration="no" standalone="yes"
indent="yes">
<xsl:if test=" string-length($output-encoding) &gt; 0">
<xsl:attribute name="encoding"><xsl:value-of select=" $output-encoding" /></xsl:attribute>
</xsl:if>
</axsl:output>
</xsl:template>
<!-- Overrides skeleton.xsl -->
<xsl:template name="process-root">
<xsl:param name="title"/>
<xsl:param name="contents" />
<xsl:param name="queryBinding" >xslt1</xsl:param>
<xsl:param name="schemaVersion" />
<xsl:param name="id" />
<xsl:param name="version"/>
<!-- "Rich" parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<svrl:schematron-output title="{$title}" schemaVersion="{$schemaVersion}" >
<xsl:if test=" string-length( normalize-space( $phase )) &gt; 0 and
not( normalize-space( $phase ) = '#ALL') ">
<axsl:attribute name="phase">
<xsl:value-of select=" $phase " />
</axsl:attribute>
</xsl:if>
<xsl:if test=" $allow-foreign = 'true'">
</xsl:if>
<xsl:if test=" $allow-foreign = 'true'">
<xsl:call-template name='richParms'>
<xsl:with-param name="fpi" select="$fpi" />
<xsl:with-param name="icon" select="$icon"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="see" select="$see" />
<xsl:with-param name="space" select="$space" />
</xsl:call-template>
</xsl:if>
<axsl:comment><axsl:value-of select="$archiveDirParameter"/> &#xA0;
<axsl:value-of select="$archiveNameParameter"/> &#xA0;
<axsl:value-of select="$fileNameParameter"/> &#xA0;
<axsl:value-of select="$fileDirParameter"/></axsl:comment>
<xsl:apply-templates mode="do-schema-p" />
<xsl:copy-of select="$contents" />
</svrl:schematron-output>
</xsl:template>
<xsl:template name="process-assert">
<xsl:param name="test"/>
<xsl:param name="diagnostics" />
<xsl:param name="id" />
<xsl:param name="flag" />
<!-- "Linkable" parameters -->
<xsl:param name="role"/>
<xsl:param name="subject"/>
<!-- "Rich" parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<svrl:failed-assert test="{$test}" >
<xsl:if test="string-length( $id ) &gt; 0">
<axsl:attribute name="id">
<xsl:value-of select=" $id " />
</axsl:attribute>
</xsl:if>
<xsl:if test=" string-length( $flag ) &gt; 0">
<axsl:attribute name="flag">
<xsl:value-of select=" $flag " />
</axsl:attribute>
</xsl:if>
<!-- Process rich attributes. -->
<xsl:call-template name="richParms">
<xsl:with-param name="fpi" select="$fpi"/>
<xsl:with-param name="icon" select="$icon"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="see" select="$see" />
<xsl:with-param name="space" select="$space" />
</xsl:call-template>
<xsl:call-template name='linkableParms'>
<xsl:with-param name="role" select="$role" />
<xsl:with-param name="subject" select="$subject"/>
</xsl:call-template>
<xsl:if test=" $generate-paths = 'true' or $generate-paths= 'yes' ">
<!-- true/false is the new way -->
<axsl:attribute name="location">
<axsl:apply-templates select="." mode="schematron-get-full-path"/>
</axsl:attribute>
</xsl:if>
<svrl:text>
<xsl:apply-templates mode="text" />
</svrl:text>
<xsl:if test="$diagnose = 'yes' or $diagnose= 'true' ">
<!-- true/false is the new way -->
<xsl:call-template name="diagnosticsSplit">
<xsl:with-param name="str" select="$diagnostics"/>
</xsl:call-template>
</xsl:if>
</svrl:failed-assert>
<xsl:if test=" $terminate = 'yes' or $terminate = 'true' ">
<axsl:message terminate="yes">TERMINATING</axsl:message>
</xsl:if>
<xsl:if test=" $terminate = 'assert' ">
<axsl:message terminate="yes">TERMINATING</axsl:message>
</xsl:if>
</xsl:template>
<xsl:template name="process-report">
<xsl:param name="id"/>
<xsl:param name="test"/>
<xsl:param name="diagnostics"/>
<xsl:param name="flag" />
<!-- "Linkable" parameters -->
<xsl:param name="role"/>
<xsl:param name="subject"/>
<!-- "Rich" parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<svrl:successful-report test="{$test}" >
<xsl:if test=" string-length( $id ) &gt; 0">
<axsl:attribute name="id">
<xsl:value-of select=" $id " />
</axsl:attribute>
</xsl:if>
<xsl:if test=" string-length( $flag ) &gt; 0">
<axsl:attribute name="flag">
<xsl:value-of select=" $flag " />
</axsl:attribute>
</xsl:if>
<!-- Process rich attributes. -->
<xsl:call-template name="richParms">
<xsl:with-param name="fpi" select="$fpi"/>
<xsl:with-param name="icon" select="$icon"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="see" select="$see" />
<xsl:with-param name="space" select="$space" />
</xsl:call-template>
<xsl:call-template name='linkableParms'>
<xsl:with-param name="role" select="$role" />
<xsl:with-param name="subject" select="$subject"/>
</xsl:call-template>
<xsl:if test=" $generate-paths = 'yes' or $generate-paths = 'true' ">
<!-- true/false is the new way -->
<axsl:attribute name="location">
<axsl:apply-templates select="." mode="schematron-get-full-path"/>
</axsl:attribute>
</xsl:if>
<svrl:text>
<xsl:apply-templates mode="text" />
</svrl:text>
<xsl:if test="$diagnose = 'yes' or $diagnose='true' ">
<!-- true/false is the new way -->
<xsl:call-template name="diagnosticsSplit">
<xsl:with-param name="str" select="$diagnostics"/>
</xsl:call-template>
</xsl:if>
</svrl:successful-report>
<xsl:if test=" $terminate = 'yes' or $terminate = 'true' ">
<axsl:message terminate="yes">TERMINATING</axsl:message>
</xsl:if>
</xsl:template>
<!-- Overrides skeleton -->
<xsl:template name="process-dir" >
<xsl:param name="value" />
<xsl:choose>
<xsl:when test=" $allow-foreign = 'true'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<!-- We generate too much whitespace rather than risking concatenation -->
<axsl:text> </axsl:text>
<xsl:apply-templates mode="inline-text"/>
<axsl:text> </axsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="process-diagnostic">
<xsl:param name="id"/>
<!-- Rich parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<svrl:diagnostic-reference diagnostic="{$id}" >
<xsl:call-template name="richParms">
<xsl:with-param name="fpi" select="$fpi"/>
<xsl:with-param name="icon" select="$icon"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="see" select="$see" />
<xsl:with-param name="space" select="$space" />
</xsl:call-template>
<xsl:text>
</xsl:text>
<xsl:apply-templates mode="text"/>
</svrl:diagnostic-reference>
</xsl:template>
<!-- Overrides skeleton -->
<xsl:template name="process-emph" >
<xsl:param name="class" />
<xsl:choose>
<xsl:when test=" $allow-foreign = 'true'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<!-- We generate too much whitespace rather than risking concatenation -->
<axsl:text> </axsl:text>
<xsl:apply-templates mode="inline-text"/>
<axsl:text> </axsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="process-rule">
<xsl:param name="id"/>
<xsl:param name="context"/>
<xsl:param name="flag"/>
<!-- "Linkable" parameters -->
<xsl:param name="role"/>
<xsl:param name="subject"/>
<!-- "Rich" parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<xsl:if test=" $generate-fired-rule = 'true'">
<svrl:fired-rule context="{$context}" >
<!-- Process rich attributes. -->
<xsl:call-template name="richParms">
<xsl:with-param name="fpi" select="$fpi"/>
<xsl:with-param name="icon" select="$icon"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="see" select="$see" />
<xsl:with-param name="space" select="$space" />
</xsl:call-template>
<xsl:if test=" string( $id )">
<xsl:attribute name="id">
<xsl:value-of select=" $id " />
</xsl:attribute>
</xsl:if>
<xsl:if test=" string-length( $role ) &gt; 0">
<xsl:attribute name="role">
<xsl:value-of select=" $role " />
</xsl:attribute>
</xsl:if>
</svrl:fired-rule>
</xsl:if>
</xsl:template>
<xsl:template name="process-ns">
<xsl:param name="prefix"/>
<xsl:param name="uri"/>
<svrl:ns-prefix-in-attribute-values uri="{$uri}" prefix="{$prefix}" />
</xsl:template>
<xsl:template name="process-p">
<xsl:param name="icon"/>
<xsl:param name="class"/>
<xsl:param name="id"/>
<xsl:param name="lang"/>
<svrl:text>
<xsl:apply-templates mode="text"/>
</svrl:text>
</xsl:template>
<xsl:template name="process-pattern">
<xsl:param name="name"/>
<xsl:param name="id"/>
<xsl:param name="is-a"/>
<!-- "Rich" parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<svrl:active-pattern >
<xsl:if test=" string( $id )">
<axsl:attribute name="id">
<xsl:value-of select=" $id " />
</axsl:attribute>
</xsl:if>
<xsl:if test=" string( $name )">
<axsl:attribute name="name">
<xsl:value-of select=" $name " />
</axsl:attribute>
</xsl:if>
<xsl:call-template name='richParms'>
<xsl:with-param name="fpi" select="$fpi"/>
<xsl:with-param name="icon" select="$icon"/>
<xsl:with-param name="lang" select="$lang"/>
<xsl:with-param name="see" select="$see" />
<xsl:with-param name="space" select="$space" />
</xsl:call-template>
<!-- ?? report that this screws up iso:title processing -->
<xsl:apply-templates mode="do-pattern-p"/>
<!-- ?? Seems that this apply-templates is never triggered DP -->
<axsl:apply-templates />
</svrl:active-pattern>
</xsl:template>
<!-- Overrides skeleton -->
<xsl:template name="process-message" >
<xsl:param name="pattern"/>
<xsl:param name="role"/>
</xsl:template>
<!-- Overrides skeleton -->
<xsl:template name="process-span" >
<xsl:param name="class" />
<xsl:choose>
<xsl:when test=" $allow-foreign = 'true'">
<xsl:copy-of select="."/>
</xsl:when>
<xsl:otherwise>
<!-- We generate too much whitespace rather than risking concatenation -->
<axsl:text> </axsl:text>
<xsl:apply-templates mode="inline-text"/>
<axsl:text> </axsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- =========================================================================== -->
<!-- processing rich parameters. -->
<xsl:template name='richParms'>
<!-- "Rich" parameters -->
<xsl:param name="fpi" />
<xsl:param name="icon" />
<xsl:param name="lang" />
<xsl:param name="see" />
<xsl:param name="space" />
<!-- Process rich attributes. -->
<xsl:if test=" $allow-foreign = 'true'">
<xsl:if test="string($fpi)">
<axsl:attribute name="fpi">
<xsl:value-of select="$fpi"/>
</axsl:attribute>
</xsl:if>
<xsl:if test="string($icon)">
<axsl:attribute name="icon">
<xsl:value-of select="$icon"/>
</axsl:attribute>
</xsl:if>
<xsl:if test="string($see)">
<axsl:attribute name="see">
<xsl:value-of select="$see"/>
</axsl:attribute>
</xsl:if>
</xsl:if>
<xsl:if test="string($space)">
<axsl:attribute name="xml:space">
<xsl:value-of select="$space"/>
</axsl:attribute>
</xsl:if>
<xsl:if test="string($lang)">
<axsl:attribute name="xml:lang">
<xsl:value-of select="$lang"/>
</axsl:attribute>
</xsl:if>
</xsl:template>
<!-- processing linkable parameters. -->
<xsl:template name='linkableParms'>
<xsl:param name="role"/>
<xsl:param name="subject"/>
<!-- ISO SVRL has a role attribute to match the Schematron role attribute -->
<xsl:if test=" string($role )">
<axsl:attribute name="role">
<xsl:value-of select=" $role " />
</axsl:attribute>
</xsl:if>
<!-- ISO SVRL does not have a subject attribute to match the Schematron subject attribute.
Instead, the Schematron subject attribute is folded into the location attribute -->
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,29 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- Daily rollover -->
<fileNamePattern>log/ZUV-%d{yyyy-MM}.log</fileNamePattern>
<!-- Keep 5 years worth of history -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- Configure so that it outputs to both console and log file -->
<root level="INFO">
<appender-ref ref="FILE" />
<!-- appender-ref ref="STDOUT" /-->
</root>
</configuration>

View File

@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:adt="http://4s4u.de/additional_data/adcollection/base_all_1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://4s4u.de/additional_data/adcollection/base_all_1.0"
elementFormDefault="qualified">
<!-- # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
met: # * Redistributions of source code must retain the above copyright #
notice, this list of conditions and the following disclaimer. # * Redistributions
in binary form must reproduce the above copyright # notice, this list of
conditions and the following disclaimer in the # documentation and/or other
materials provided with the distribution. # * The name of the authors may
not be used to endorse or promote products # derived from this software without
specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT # HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -->
<xs:element name="additionalOrAlternateData"
type="adt:additionalOrAlternativeDataType" />
<xs:complexType name="additionalOrAlternativeDataType">
<xs:sequence>
<xs:element name="referencedData" type="adt:referencedDataType" minOccurs="1" maxOccurs="1" />
<xs:element name="additionalData" type="adt:additionalDataType" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="alternateData" type="adt:additionalDataType" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="referencedDataType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="adt:referenceType" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="additionalDataType">
<xs:sequence>
<xs:element name="data" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:complexContent>
<!-- this could be more detailed … -->
<xs:extension base="xs:anyType">
<xs:attribute name="type" type="xs:string" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="referencedElement" minOccurs="1"
maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="adt:referenceType" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="alternateDataType">
<xs:sequence>
<xs:element name="data" minOccurs="1" maxOccurs="1">
<xs:complexType>
<xs:complexContent>
<!-- this could be more detailed … -->
<xs:extension base="xs:anyType">
<xs:attribute name="type" type="xs:string" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="referencedElement" minOccurs="1"
maxOccurs="1">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="type" type="adt:referenceType" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="referenceType">
<xs:restriction base="xs:string">
<xs:enumeration value="XPath" />
<xs:enumeration value="URI" />
<!-- and so on … -->
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:ferd:CrossIndustryDocument:invoice:1p0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
targetNamespace="urn:ferd:CrossIndustryDocument:invoice:1p0"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_12.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
<xs:element name="CrossIndustryDocument" type="rsm:CrossIndustryDocumentType"/>
<xs:complexType name="CrossIndustryDocumentType">
<xs:sequence>
<xs:element name="SpecifiedExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="HeaderExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SpecifiedSupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
elementFormDefault="qualified"
version="12.0">
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
<xs:simpleType name="AllowanceChargeReasonCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="AllowanceChargeReasonCodeType">
<xs:simpleContent>
<xs:extension base="qdt:AllowanceChargeReasonCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CountryIDContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="CountryIDType">
<xs:simpleContent>
<xs:extension base="qdt:CountryIDContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DateMandatoryDateTimeType">
<xs:union memberTypes="xs:dateTime xs:date"/>
</xs:simpleType>
<xs:simpleType name="DeliveryTermsCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="DeliveryTermsCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DeliveryTermsCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DocumentCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="DocumentCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DocumentCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="PaymentMeansCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="PaymentMeansCodeType">
<xs:simpleContent>
<xs:extension base="qdt:PaymentMeansCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="ReferenceCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="ReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:ReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxCategoryCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TaxCategoryCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxCategoryCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxTypeCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TaxTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,352 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
elementFormDefault="qualified"
version="12.0">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
<xs:complexType name="CreditorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="AccountName" type="udt:TextType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreditorFinancialInstitutionType">
<xs:sequence>
<xs:element name="BICID" type="udt:IDType" minOccurs="0"/>
<xs:element name="GermanBankleitzahlID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialInstitutionType">
<xs:sequence>
<xs:element name="BICID" type="udt:IDType" minOccurs="0"/>
<xs:element name="GermanBankleitzahlID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentLineDocumentType">
<xs:sequence>
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="TestIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="CopyIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="LanguageID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="EffectiveSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LogisticsServiceChargeType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AppliedAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AppliedTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LogisticsTransportMovementType">
<xs:sequence>
<xs:element name="ModeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="ContentCode" type="udt:CodeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Content" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductCharacteristicType">
<xs:sequence>
<xs:element name="TypeCode" type="udt:CodeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ValueMeasure" type="udt:MeasureType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Value" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductClassificationType">
<xs:sequence>
<xs:element name="ClassCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="ClassName" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssueDateTime" type="qdt:DateMandatoryDateTimeType" minOccurs="0"/>
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReferenceTypeCode" type="qdt:ReferenceCodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedProductType">
<xs:sequence>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="UnitQuantity" type="udt:QuantityType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SpecifiedPeriodType">
<xs:sequence>
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="CompleteDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainConsignmentType">
<xs:sequence>
<xs:element name="SpecifiedLogisticsTransportMovement" type="ram:LogisticsTransportMovementType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainEventType">
<xs:sequence>
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ProductEndUserTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ApplicableTradeDeliveryTerms" type="ram:TradeDeliveryTermsType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="CustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeDeliveryType">
<xs:sequence>
<xs:element name="BilledQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ChargeFreeQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="PackageQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="RelatedSupplyChainConsignment" type="ram:SupplyChainConsignmentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ShipFromTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeLineItemType">
<xs:sequence>
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType" minOccurs="0"/>
<xs:element name="SpecifiedSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType" minOccurs="0"/>
<xs:element name="SpecifiedSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType" minOccurs="0"/>
<xs:element name="SpecifiedSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType" minOccurs="0"/>
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeSettlementType">
<xs:sequence>
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="InvoiceCurrencyCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="InvoiceeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedLogisticsServiceCharge" type="ram:LogisticsServiceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementMonetarySummation" type="ram:TradeSettlementMonetarySummationType" minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="ApplicableSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType" minOccurs="0"/>
<xs:element name="ApplicableSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType" minOccurs="0"/>
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAccountingAccountType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAllowanceChargeType">
<xs:sequence>
<xs:element name="ChargeIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="SequenceNumeric" type="udt:NumericType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ActualAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeContactType">
<xs:sequence>
<xs:element name="PersonName" type="udt:TextType" minOccurs="0"/>
<xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/>
<xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="FaxUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeCountryType">
<xs:sequence>
<xs:element name="ID" type="qdt:CountryIDType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeDeliveryTermsType">
<xs:sequence>
<xs:element name="DeliveryTypeCode" type="qdt:DeliveryTermsCodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentDiscountTermsType">
<xs:sequence>
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="ActualDiscountAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentPenaltyTermsType">
<xs:sequence>
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="ActualPenaltyAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentTermsType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="PartialPaymentAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradePaymentPenaltyTerms" type="ram:TradePaymentPenaltyTermsType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradePaymentDiscountTerms" type="ram:TradePaymentDiscountTermsType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePriceType">
<xs:sequence>
<xs:element name="ChargeAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeProductType">
<xs:sequence>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IncludedReferencedProduct" type="ram:ReferencedProductType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="TotalAllowanceChargeAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DuePayableAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementPaymentMeansType">
<xs:sequence>
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType" minOccurs="0"/>
<xs:element name="Information" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayerSpecifiedDebtorFinancialInstitution" type="ram:DebtorFinancialInstitutionType" minOccurs="0"/>
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeTaxType">
<xs:sequence>
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType" minOccurs="0"/>
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="LineTotalBasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AllowanceChargeBasisAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType" minOccurs="0"/>
<xs:element name="ApplicablePercent" type="udt:PercentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UniversalCommunicationType">
<xs:sequence>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="CompleteNumber" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
elementFormDefault="qualified"
version="15.0">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="udt:AmountTypeCurrencyIDContentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="AmountTypeCurrencyIDContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="listID" type="xs:token"/>
<xs:attribute name="listVersionID" type="xs:token"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token"/>
<xs:attribute name="schemeAgencyID" type="udt:IDTypeSchemeAgencyIDContentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="IDTypeSchemeAgencyIDContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="IndicatorType">
<xs:choice>
<xs:element name="Indicator" type="xs:boolean"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="MeasureType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="udt:MeasureTypeUnitCodeContentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="MeasureTypeUnitCodeContentType">
<xs:restriction base="xs:token">
<xs:minLength value="1"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="NumericType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="PercentType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="QuantityType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="udt:QuantityTypeUnitCodeContentType"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="QuantityTypeUnitCodeContentType">
<xs:restriction base="xs:token">
<xs:minLength value="1"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_BASIC-WL_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="FACTUR-X_BASIC-WL_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_BASIC-WL_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,788 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_BASIC-WL_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:simpleType name="AllowanceChargeReasonCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AA"/>
<xs:enumeration value="AAA"/>
<xs:enumeration value="AAC"/>
<xs:enumeration value="AAD"/>
<xs:enumeration value="AAE"/>
<xs:enumeration value="AAF"/>
<xs:enumeration value="AAH"/>
<xs:enumeration value="AAI"/>
<xs:enumeration value="AAS"/>
<xs:enumeration value="AAT"/>
<xs:enumeration value="AAV"/>
<xs:enumeration value="AAY"/>
<xs:enumeration value="AAZ"/>
<xs:enumeration value="ABA"/>
<xs:enumeration value="ABB"/>
<xs:enumeration value="ABC"/>
<xs:enumeration value="ABD"/>
<xs:enumeration value="ABF"/>
<xs:enumeration value="ABK"/>
<xs:enumeration value="ABL"/>
<xs:enumeration value="ABN"/>
<xs:enumeration value="ABR"/>
<xs:enumeration value="ABS"/>
<xs:enumeration value="ABT"/>
<xs:enumeration value="ABU"/>
<xs:enumeration value="ACF"/>
<xs:enumeration value="ACG"/>
<xs:enumeration value="ACH"/>
<xs:enumeration value="ACI"/>
<xs:enumeration value="ACJ"/>
<xs:enumeration value="ACK"/>
<xs:enumeration value="ACL"/>
<xs:enumeration value="ACM"/>
<xs:enumeration value="ACS"/>
<xs:enumeration value="ADC"/>
<xs:enumeration value="ADE"/>
<xs:enumeration value="ADJ"/>
<xs:enumeration value="ADK"/>
<xs:enumeration value="ADL"/>
<xs:enumeration value="ADM"/>
<xs:enumeration value="ADN"/>
<xs:enumeration value="ADO"/>
<xs:enumeration value="ADP"/>
<xs:enumeration value="ADQ"/>
<xs:enumeration value="ADR"/>
<xs:enumeration value="ADT"/>
<xs:enumeration value="ADW"/>
<xs:enumeration value="ADY"/>
<xs:enumeration value="ADZ"/>
<xs:enumeration value="AEA"/>
<xs:enumeration value="AEB"/>
<xs:enumeration value="AEC"/>
<xs:enumeration value="AED"/>
<xs:enumeration value="AEF"/>
<xs:enumeration value="AEH"/>
<xs:enumeration value="AEI"/>
<xs:enumeration value="AEJ"/>
<xs:enumeration value="AEK"/>
<xs:enumeration value="AEL"/>
<xs:enumeration value="AEM"/>
<xs:enumeration value="AEN"/>
<xs:enumeration value="AEO"/>
<xs:enumeration value="AEP"/>
<xs:enumeration value="AES"/>
<xs:enumeration value="AET"/>
<xs:enumeration value="AEU"/>
<xs:enumeration value="AEV"/>
<xs:enumeration value="AEW"/>
<xs:enumeration value="AEX"/>
<xs:enumeration value="AEY"/>
<xs:enumeration value="AEZ"/>
<xs:enumeration value="AJ"/>
<xs:enumeration value="AU"/>
<xs:enumeration value="CA"/>
<xs:enumeration value="CAB"/>
<xs:enumeration value="CAD"/>
<xs:enumeration value="CAE"/>
<xs:enumeration value="CAF"/>
<xs:enumeration value="CAI"/>
<xs:enumeration value="CAJ"/>
<xs:enumeration value="CAK"/>
<xs:enumeration value="CAL"/>
<xs:enumeration value="CAM"/>
<xs:enumeration value="CAN"/>
<xs:enumeration value="CAO"/>
<xs:enumeration value="CAP"/>
<xs:enumeration value="CAQ"/>
<xs:enumeration value="CAR"/>
<xs:enumeration value="CAS"/>
<xs:enumeration value="CAT"/>
<xs:enumeration value="CAU"/>
<xs:enumeration value="CAV"/>
<xs:enumeration value="CAW"/>
<xs:enumeration value="CAX"/>
<xs:enumeration value="CAY"/>
<xs:enumeration value="CAZ"/>
<xs:enumeration value="CD"/>
<xs:enumeration value="CG"/>
<xs:enumeration value="CS"/>
<xs:enumeration value="CT"/>
<xs:enumeration value="DAB"/>
<xs:enumeration value="DAC"/>
<xs:enumeration value="DAD"/>
<xs:enumeration value="DAF"/>
<xs:enumeration value="DAG"/>
<xs:enumeration value="DAH"/>
<xs:enumeration value="DAI"/>
<xs:enumeration value="DAJ"/>
<xs:enumeration value="DAK"/>
<xs:enumeration value="DAL"/>
<xs:enumeration value="DAM"/>
<xs:enumeration value="DAN"/>
<xs:enumeration value="DAO"/>
<xs:enumeration value="DAP"/>
<xs:enumeration value="DAQ"/>
<xs:enumeration value="DL"/>
<xs:enumeration value="EG"/>
<xs:enumeration value="EP"/>
<xs:enumeration value="ER"/>
<xs:enumeration value="FAA"/>
<xs:enumeration value="FAB"/>
<xs:enumeration value="FAC"/>
<xs:enumeration value="FC"/>
<xs:enumeration value="FH"/>
<xs:enumeration value="FI"/>
<xs:enumeration value="GAA"/>
<xs:enumeration value="HAA"/>
<xs:enumeration value="HD"/>
<xs:enumeration value="HH"/>
<xs:enumeration value="IAA"/>
<xs:enumeration value="IAB"/>
<xs:enumeration value="ID"/>
<xs:enumeration value="IF"/>
<xs:enumeration value="IR"/>
<xs:enumeration value="IS"/>
<xs:enumeration value="KO"/>
<xs:enumeration value="L1"/>
<xs:enumeration value="LA"/>
<xs:enumeration value="LAA"/>
<xs:enumeration value="LAB"/>
<xs:enumeration value="LF"/>
<xs:enumeration value="MAE"/>
<xs:enumeration value="MI"/>
<xs:enumeration value="ML"/>
<xs:enumeration value="NAA"/>
<xs:enumeration value="OA"/>
<xs:enumeration value="PA"/>
<xs:enumeration value="PAA"/>
<xs:enumeration value="PC"/>
<xs:enumeration value="PL"/>
<xs:enumeration value="RAB"/>
<xs:enumeration value="RAC"/>
<xs:enumeration value="RAD"/>
<xs:enumeration value="RAF"/>
<xs:enumeration value="RE"/>
<xs:enumeration value="RF"/>
<xs:enumeration value="RH"/>
<xs:enumeration value="RV"/>
<xs:enumeration value="SA"/>
<xs:enumeration value="SAA"/>
<xs:enumeration value="SAD"/>
<xs:enumeration value="SAE"/>
<xs:enumeration value="SAI"/>
<xs:enumeration value="SG"/>
<xs:enumeration value="SH"/>
<xs:enumeration value="SM"/>
<xs:enumeration value="SU"/>
<xs:enumeration value="TAB"/>
<xs:enumeration value="TAC"/>
<xs:enumeration value="TT"/>
<xs:enumeration value="TV"/>
<xs:enumeration value="V1"/>
<xs:enumeration value="V2"/>
<xs:enumeration value="WH"/>
<xs:enumeration value="XAA"/>
<xs:enumeration value="YY"/>
<xs:enumeration value="ZZZ"/>
<xs:enumeration value="41"/>
<xs:enumeration value="42"/>
<xs:enumeration value="60"/>
<xs:enumeration value="62"/>
<xs:enumeration value="63"/>
<xs:enumeration value="64"/>
<xs:enumeration value="65"/>
<xs:enumeration value="66"/>
<xs:enumeration value="67"/>
<xs:enumeration value="68"/>
<xs:enumeration value="70"/>
<xs:enumeration value="71"/>
<xs:enumeration value="88"/>
<xs:enumeration value="95"/>
<xs:enumeration value="100"/>
<xs:enumeration value="102"/>
<xs:enumeration value="103"/>
<xs:enumeration value="104"/>
<xs:enumeration value="105"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AllowanceChargeReasonCodeType">
<xs:simpleContent>
<xs:extension base="qdt:AllowanceChargeReasonCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CountryIDContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="1A"/>
<xs:enumeration value="AD"/>
<xs:enumeration value="AE"/>
<xs:enumeration value="AF"/>
<xs:enumeration value="AG"/>
<xs:enumeration value="AI"/>
<xs:enumeration value="AL"/>
<xs:enumeration value="AM"/>
<xs:enumeration value="AO"/>
<xs:enumeration value="AQ"/>
<xs:enumeration value="AR"/>
<xs:enumeration value="AS"/>
<xs:enumeration value="AT"/>
<xs:enumeration value="AU"/>
<xs:enumeration value="AW"/>
<xs:enumeration value="AX"/>
<xs:enumeration value="AZ"/>
<xs:enumeration value="BA"/>
<xs:enumeration value="BB"/>
<xs:enumeration value="BD"/>
<xs:enumeration value="BE"/>
<xs:enumeration value="BF"/>
<xs:enumeration value="BG"/>
<xs:enumeration value="BH"/>
<xs:enumeration value="BI"/>
<xs:enumeration value="BJ"/>
<xs:enumeration value="BL"/>
<xs:enumeration value="BM"/>
<xs:enumeration value="BN"/>
<xs:enumeration value="BO"/>
<xs:enumeration value="BQ"/>
<xs:enumeration value="BR"/>
<xs:enumeration value="BS"/>
<xs:enumeration value="BT"/>
<xs:enumeration value="BV"/>
<xs:enumeration value="BW"/>
<xs:enumeration value="BY"/>
<xs:enumeration value="BZ"/>
<xs:enumeration value="CA"/>
<xs:enumeration value="CC"/>
<xs:enumeration value="CD"/>
<xs:enumeration value="CF"/>
<xs:enumeration value="CG"/>
<xs:enumeration value="CH"/>
<xs:enumeration value="CI"/>
<xs:enumeration value="CK"/>
<xs:enumeration value="CL"/>
<xs:enumeration value="CM"/>
<xs:enumeration value="CN"/>
<xs:enumeration value="CO"/>
<xs:enumeration value="CR"/>
<xs:enumeration value="CU"/>
<xs:enumeration value="CV"/>
<xs:enumeration value="CW"/>
<xs:enumeration value="CX"/>
<xs:enumeration value="CY"/>
<xs:enumeration value="CZ"/>
<xs:enumeration value="DE"/>
<xs:enumeration value="DJ"/>
<xs:enumeration value="DK"/>
<xs:enumeration value="DM"/>
<xs:enumeration value="DO"/>
<xs:enumeration value="DZ"/>
<xs:enumeration value="EC"/>
<xs:enumeration value="EE"/>
<xs:enumeration value="EG"/>
<xs:enumeration value="EH"/>
<xs:enumeration value="ER"/>
<xs:enumeration value="ES"/>
<xs:enumeration value="ET"/>
<xs:enumeration value="FI"/>
<xs:enumeration value="FJ"/>
<xs:enumeration value="FK"/>
<xs:enumeration value="FM"/>
<xs:enumeration value="FO"/>
<xs:enumeration value="FR"/>
<xs:enumeration value="GA"/>
<xs:enumeration value="GB"/>
<xs:enumeration value="GD"/>
<xs:enumeration value="GE"/>
<xs:enumeration value="GF"/>
<xs:enumeration value="GG"/>
<xs:enumeration value="GH"/>
<xs:enumeration value="GI"/>
<xs:enumeration value="GL"/>
<xs:enumeration value="GM"/>
<xs:enumeration value="GN"/>
<xs:enumeration value="GP"/>
<xs:enumeration value="GQ"/>
<xs:enumeration value="GR"/>
<xs:enumeration value="GS"/>
<xs:enumeration value="GT"/>
<xs:enumeration value="GU"/>
<xs:enumeration value="GW"/>
<xs:enumeration value="GY"/>
<xs:enumeration value="HK"/>
<xs:enumeration value="HM"/>
<xs:enumeration value="HN"/>
<xs:enumeration value="HR"/>
<xs:enumeration value="HT"/>
<xs:enumeration value="HU"/>
<xs:enumeration value="ID"/>
<xs:enumeration value="IE"/>
<xs:enumeration value="IL"/>
<xs:enumeration value="IM"/>
<xs:enumeration value="IN"/>
<xs:enumeration value="IO"/>
<xs:enumeration value="IQ"/>
<xs:enumeration value="IR"/>
<xs:enumeration value="IS"/>
<xs:enumeration value="IT"/>
<xs:enumeration value="JE"/>
<xs:enumeration value="JM"/>
<xs:enumeration value="JO"/>
<xs:enumeration value="JP"/>
<xs:enumeration value="KE"/>
<xs:enumeration value="KG"/>
<xs:enumeration value="KH"/>
<xs:enumeration value="KI"/>
<xs:enumeration value="KM"/>
<xs:enumeration value="KN"/>
<xs:enumeration value="KP"/>
<xs:enumeration value="KR"/>
<xs:enumeration value="KW"/>
<xs:enumeration value="KY"/>
<xs:enumeration value="KZ"/>
<xs:enumeration value="LA"/>
<xs:enumeration value="LB"/>
<xs:enumeration value="LC"/>
<xs:enumeration value="LI"/>
<xs:enumeration value="LK"/>
<xs:enumeration value="LR"/>
<xs:enumeration value="LS"/>
<xs:enumeration value="LT"/>
<xs:enumeration value="LU"/>
<xs:enumeration value="LV"/>
<xs:enumeration value="LY"/>
<xs:enumeration value="MA"/>
<xs:enumeration value="MC"/>
<xs:enumeration value="MD"/>
<xs:enumeration value="ME"/>
<xs:enumeration value="MF"/>
<xs:enumeration value="MG"/>
<xs:enumeration value="MH"/>
<xs:enumeration value="MK"/>
<xs:enumeration value="ML"/>
<xs:enumeration value="MM"/>
<xs:enumeration value="MN"/>
<xs:enumeration value="MO"/>
<xs:enumeration value="MP"/>
<xs:enumeration value="MQ"/>
<xs:enumeration value="MR"/>
<xs:enumeration value="MS"/>
<xs:enumeration value="MT"/>
<xs:enumeration value="MU"/>
<xs:enumeration value="MV"/>
<xs:enumeration value="MW"/>
<xs:enumeration value="MX"/>
<xs:enumeration value="MY"/>
<xs:enumeration value="MZ"/>
<xs:enumeration value="NA"/>
<xs:enumeration value="NC"/>
<xs:enumeration value="NE"/>
<xs:enumeration value="NF"/>
<xs:enumeration value="NG"/>
<xs:enumeration value="NI"/>
<xs:enumeration value="NL"/>
<xs:enumeration value="NO"/>
<xs:enumeration value="NP"/>
<xs:enumeration value="NR"/>
<xs:enumeration value="NU"/>
<xs:enumeration value="NZ"/>
<xs:enumeration value="OM"/>
<xs:enumeration value="PA"/>
<xs:enumeration value="PE"/>
<xs:enumeration value="PF"/>
<xs:enumeration value="PG"/>
<xs:enumeration value="PH"/>
<xs:enumeration value="PK"/>
<xs:enumeration value="PL"/>
<xs:enumeration value="PM"/>
<xs:enumeration value="PN"/>
<xs:enumeration value="PR"/>
<xs:enumeration value="PS"/>
<xs:enumeration value="PT"/>
<xs:enumeration value="PW"/>
<xs:enumeration value="PY"/>
<xs:enumeration value="QA"/>
<xs:enumeration value="RE"/>
<xs:enumeration value="RO"/>
<xs:enumeration value="RS"/>
<xs:enumeration value="RU"/>
<xs:enumeration value="RW"/>
<xs:enumeration value="SA"/>
<xs:enumeration value="SB"/>
<xs:enumeration value="SC"/>
<xs:enumeration value="SD"/>
<xs:enumeration value="SE"/>
<xs:enumeration value="SG"/>
<xs:enumeration value="SH"/>
<xs:enumeration value="SI"/>
<xs:enumeration value="SJ"/>
<xs:enumeration value="SK"/>
<xs:enumeration value="SL"/>
<xs:enumeration value="SM"/>
<xs:enumeration value="SN"/>
<xs:enumeration value="SO"/>
<xs:enumeration value="SR"/>
<xs:enumeration value="SS"/>
<xs:enumeration value="ST"/>
<xs:enumeration value="SV"/>
<xs:enumeration value="SX"/>
<xs:enumeration value="SY"/>
<xs:enumeration value="SZ"/>
<xs:enumeration value="TC"/>
<xs:enumeration value="TD"/>
<xs:enumeration value="TF"/>
<xs:enumeration value="TG"/>
<xs:enumeration value="TH"/>
<xs:enumeration value="TJ"/>
<xs:enumeration value="TK"/>
<xs:enumeration value="TL"/>
<xs:enumeration value="TM"/>
<xs:enumeration value="TN"/>
<xs:enumeration value="TO"/>
<xs:enumeration value="TR"/>
<xs:enumeration value="TT"/>
<xs:enumeration value="TV"/>
<xs:enumeration value="TW"/>
<xs:enumeration value="TZ"/>
<xs:enumeration value="UA"/>
<xs:enumeration value="UG"/>
<xs:enumeration value="UM"/>
<xs:enumeration value="US"/>
<xs:enumeration value="UY"/>
<xs:enumeration value="UZ"/>
<xs:enumeration value="VA"/>
<xs:enumeration value="VC"/>
<xs:enumeration value="VE"/>
<xs:enumeration value="VG"/>
<xs:enumeration value="VI"/>
<xs:enumeration value="VN"/>
<xs:enumeration value="VU"/>
<xs:enumeration value="WF"/>
<xs:enumeration value="WS"/>
<xs:enumeration value="YE"/>
<xs:enumeration value="YT"/>
<xs:enumeration value="ZA"/>
<xs:enumeration value="ZM"/>
<xs:enumeration value="ZW"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CountryIDType">
<xs:simpleContent>
<xs:extension base="qdt:CountryIDContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CurrencyCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AED"/>
<xs:enumeration value="AFN"/>
<xs:enumeration value="ALL"/>
<xs:enumeration value="AMD"/>
<xs:enumeration value="ANG"/>
<xs:enumeration value="AOA"/>
<xs:enumeration value="ARS"/>
<xs:enumeration value="AUD"/>
<xs:enumeration value="AWG"/>
<xs:enumeration value="AZN"/>
<xs:enumeration value="BAM"/>
<xs:enumeration value="BBD"/>
<xs:enumeration value="BDT"/>
<xs:enumeration value="BGN"/>
<xs:enumeration value="BHD"/>
<xs:enumeration value="BIF"/>
<xs:enumeration value="BMD"/>
<xs:enumeration value="BND"/>
<xs:enumeration value="BOB"/>
<xs:enumeration value="BOV"/>
<xs:enumeration value="BRL"/>
<xs:enumeration value="BSD"/>
<xs:enumeration value="BTN"/>
<xs:enumeration value="BWP"/>
<xs:enumeration value="BYN"/>
<xs:enumeration value="BZD"/>
<xs:enumeration value="CAD"/>
<xs:enumeration value="CDF"/>
<xs:enumeration value="CHE"/>
<xs:enumeration value="CHF"/>
<xs:enumeration value="CHW"/>
<xs:enumeration value="CLF"/>
<xs:enumeration value="CLP"/>
<xs:enumeration value="CNY"/>
<xs:enumeration value="COP"/>
<xs:enumeration value="COU"/>
<xs:enumeration value="CRC"/>
<xs:enumeration value="CUC"/>
<xs:enumeration value="CUP"/>
<xs:enumeration value="CVE"/>
<xs:enumeration value="CZK"/>
<xs:enumeration value="DJF"/>
<xs:enumeration value="DKK"/>
<xs:enumeration value="DOP"/>
<xs:enumeration value="DZD"/>
<xs:enumeration value="EGP"/>
<xs:enumeration value="ERN"/>
<xs:enumeration value="ETB"/>
<xs:enumeration value="EUR"/>
<xs:enumeration value="FJD"/>
<xs:enumeration value="FKP"/>
<xs:enumeration value="GBP"/>
<xs:enumeration value="GEL"/>
<xs:enumeration value="GHS"/>
<xs:enumeration value="GIP"/>
<xs:enumeration value="GMD"/>
<xs:enumeration value="GNF"/>
<xs:enumeration value="GTQ"/>
<xs:enumeration value="GYD"/>
<xs:enumeration value="HKD"/>
<xs:enumeration value="HNL"/>
<xs:enumeration value="HRK"/>
<xs:enumeration value="HTG"/>
<xs:enumeration value="HUF"/>
<xs:enumeration value="IDR"/>
<xs:enumeration value="ILS"/>
<xs:enumeration value="INR"/>
<xs:enumeration value="IQD"/>
<xs:enumeration value="IRR"/>
<xs:enumeration value="ISK"/>
<xs:enumeration value="JMD"/>
<xs:enumeration value="JOD"/>
<xs:enumeration value="JPY"/>
<xs:enumeration value="KES"/>
<xs:enumeration value="KGS"/>
<xs:enumeration value="KHR"/>
<xs:enumeration value="KMF"/>
<xs:enumeration value="KPW"/>
<xs:enumeration value="KRW"/>
<xs:enumeration value="KWD"/>
<xs:enumeration value="KYD"/>
<xs:enumeration value="KZT"/>
<xs:enumeration value="LAK"/>
<xs:enumeration value="LBP"/>
<xs:enumeration value="LKR"/>
<xs:enumeration value="LRD"/>
<xs:enumeration value="LSL"/>
<xs:enumeration value="LYD"/>
<xs:enumeration value="MAD"/>
<xs:enumeration value="MDL"/>
<xs:enumeration value="MGA"/>
<xs:enumeration value="MKD"/>
<xs:enumeration value="MMK"/>
<xs:enumeration value="MNT"/>
<xs:enumeration value="MOP"/>
<xs:enumeration value="MRU"/>
<xs:enumeration value="MUR"/>
<xs:enumeration value="MVR"/>
<xs:enumeration value="MWK"/>
<xs:enumeration value="MXN"/>
<xs:enumeration value="MXV"/>
<xs:enumeration value="MYR"/>
<xs:enumeration value="MZN"/>
<xs:enumeration value="NAD"/>
<xs:enumeration value="NGN"/>
<xs:enumeration value="NIO"/>
<xs:enumeration value="NOK"/>
<xs:enumeration value="NPR"/>
<xs:enumeration value="NZD"/>
<xs:enumeration value="OMR"/>
<xs:enumeration value="PAB"/>
<xs:enumeration value="PEN"/>
<xs:enumeration value="PGK"/>
<xs:enumeration value="PHP"/>
<xs:enumeration value="PKR"/>
<xs:enumeration value="PLN"/>
<xs:enumeration value="PYG"/>
<xs:enumeration value="QAR"/>
<xs:enumeration value="RON"/>
<xs:enumeration value="RSD"/>
<xs:enumeration value="RUB"/>
<xs:enumeration value="RWF"/>
<xs:enumeration value="SAR"/>
<xs:enumeration value="SBD"/>
<xs:enumeration value="SCR"/>
<xs:enumeration value="SDG"/>
<xs:enumeration value="SEK"/>
<xs:enumeration value="SGD"/>
<xs:enumeration value="SHP"/>
<xs:enumeration value="SLL"/>
<xs:enumeration value="SOS"/>
<xs:enumeration value="SRD"/>
<xs:enumeration value="SSP"/>
<xs:enumeration value="STN"/>
<xs:enumeration value="SVC"/>
<xs:enumeration value="SYP"/>
<xs:enumeration value="SZL"/>
<xs:enumeration value="THB"/>
<xs:enumeration value="TJS"/>
<xs:enumeration value="TMT"/>
<xs:enumeration value="TND"/>
<xs:enumeration value="TOP"/>
<xs:enumeration value="TRY"/>
<xs:enumeration value="TTD"/>
<xs:enumeration value="TWD"/>
<xs:enumeration value="TZS"/>
<xs:enumeration value="UAH"/>
<xs:enumeration value="UGX"/>
<xs:enumeration value="USD"/>
<xs:enumeration value="USN"/>
<xs:enumeration value="UYI"/>
<xs:enumeration value="UYU"/>
<xs:enumeration value="UYW"/>
<xs:enumeration value="UZS"/>
<xs:enumeration value="VES"/>
<xs:enumeration value="VND"/>
<xs:enumeration value="VUV"/>
<xs:enumeration value="WST"/>
<xs:enumeration value="XAF"/>
<xs:enumeration value="XAG"/>
<xs:enumeration value="XAU"/>
<xs:enumeration value="XBA"/>
<xs:enumeration value="XBB"/>
<xs:enumeration value="XBC"/>
<xs:enumeration value="XBD"/>
<xs:enumeration value="XCD"/>
<xs:enumeration value="XDR"/>
<xs:enumeration value="XOF"/>
<xs:enumeration value="XPD"/>
<xs:enumeration value="XPF"/>
<xs:enumeration value="XPT"/>
<xs:enumeration value="XSU"/>
<xs:enumeration value="XTS"/>
<xs:enumeration value="XUA"/>
<xs:enumeration value="XXX"/>
<xs:enumeration value="YER"/>
<xs:enumeration value="ZAR"/>
<xs:enumeration value="ZMW"/>
<xs:enumeration value="ZWL"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CurrencyCodeType">
<xs:simpleContent>
<xs:extension base="qdt:CurrencyCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DocumentCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="80"/>
<xs:enumeration value="81"/>
<xs:enumeration value="82"/>
<xs:enumeration value="83"/>
<xs:enumeration value="84"/>
<xs:enumeration value="130"/>
<xs:enumeration value="202"/>
<xs:enumeration value="203"/>
<xs:enumeration value="204"/>
<xs:enumeration value="211"/>
<xs:enumeration value="261"/>
<xs:enumeration value="262"/>
<xs:enumeration value="295"/>
<xs:enumeration value="296"/>
<xs:enumeration value="308"/>
<xs:enumeration value="325"/>
<xs:enumeration value="326"/>
<xs:enumeration value="380"/>
<xs:enumeration value="381"/>
<xs:enumeration value="383"/>
<xs:enumeration value="384"/>
<xs:enumeration value="385"/>
<xs:enumeration value="386"/>
<xs:enumeration value="387"/>
<xs:enumeration value="388"/>
<xs:enumeration value="389"/>
<xs:enumeration value="390"/>
<xs:enumeration value="393"/>
<xs:enumeration value="394"/>
<xs:enumeration value="395"/>
<xs:enumeration value="396"/>
<xs:enumeration value="420"/>
<xs:enumeration value="456"/>
<xs:enumeration value="457"/>
<xs:enumeration value="458"/>
<xs:enumeration value="527"/>
<xs:enumeration value="575"/>
<xs:enumeration value="623"/>
<xs:enumeration value="633"/>
<xs:enumeration value="751"/>
<xs:enumeration value="780"/>
<xs:enumeration value="935"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="DocumentCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DocumentCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="FormattedDateTimeFormatContentType">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="FormattedDateTimeType">
<xs:sequence>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="qdt:FormattedDateTimeFormatContentType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="PaymentMeansCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="10"/>
<xs:enumeration value="20"/>
<xs:enumeration value="30"/>
<xs:enumeration value="42"/>
<xs:enumeration value="48"/>
<xs:enumeration value="49"/>
<xs:enumeration value="57"/>
<xs:enumeration value="58"/>
<xs:enumeration value="59"/>
<xs:enumeration value="97"/>
<xs:enumeration value="ZZZ"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="PaymentMeansCodeType">
<xs:simpleContent>
<xs:extension base="qdt:PaymentMeansCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxCategoryCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AE"/>
<xs:enumeration value="E"/>
<xs:enumeration value="G"/>
<xs:enumeration value="K"/>
<xs:enumeration value="L"/>
<xs:enumeration value="M"/>
<xs:enumeration value="O"/>
<xs:enumeration value="S"/>
<xs:enumeration value="Z"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TaxCategoryCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxCategoryCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxTypeCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="VAT"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TaxTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TimeReferenceCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="5"/>
<xs:enumeration value="29"/>
<xs:enumeration value="72"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TimeReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TimeReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_BASIC-WL_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_BASIC-WL_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:complexType name="CreditorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType"/>
<xs:element name="SellerTaxRepresentativeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeDeliveryType">
<xs:sequence>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeSettlementType">
<xs:sequence>
<xs:element name="CreditorReferenceID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="InvoiceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementHeaderMonetarySummation" type="ram:TradeSettlementHeaderMonetarySummationType"/>
<xs:element name="InvoiceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LegalOrganizationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TradingBusinessName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="Content" type="udt:TextType"/>
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssuerAssignedID" type="udt:IDType"/>
<xs:element name="FormattedIssueDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SpecifiedPeriodType">
<xs:sequence>
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainEventType">
<xs:sequence>
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="ApplicableHeaderTradeAgreement" type="ram:HeaderTradeAgreementType"/>
<xs:element name="ApplicableHeaderTradeDelivery" type="ram:HeaderTradeDeliveryType"/>
<xs:element name="ApplicableHeaderTradeSettlement" type="ram:HeaderTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAccountingAccountType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineThree" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType"/>
<xs:element name="CountrySubDivisionName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAllowanceChargeType">
<xs:sequence>
<xs:element name="ChargeIndicator" type="udt:IndicatorType"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="ActualAmount" type="udt:AmountType"/>
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="SpecifiedLegalOrganization" type="ram:LegalOrganizationType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="URIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentTermsType">
<xs:sequence>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="DirectDebitMandateID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementHeaderMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType"/>
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="DuePayableAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementPaymentMeansType">
<xs:sequence>
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeTaxType">
<xs:sequence>
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType"/>
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType"/>
<xs:element name="ExemptionReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="DueDateTypeCode" type="qdt:TimeReferenceCodeType" minOccurs="0"/>
<xs:element name="RateApplicablePercent" type="udt:PercentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UniversalCommunicationType">
<xs:sequence>
<xs:element name="URIID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="IndicatorType">
<xs:choice>
<xs:element name="Indicator" type="xs:boolean"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="PercentType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_BASIC_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="FACTUR-X_BASIC_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_BASIC_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,788 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_BASIC_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:simpleType name="AllowanceChargeReasonCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AA"/>
<xs:enumeration value="AAA"/>
<xs:enumeration value="AAC"/>
<xs:enumeration value="AAD"/>
<xs:enumeration value="AAE"/>
<xs:enumeration value="AAF"/>
<xs:enumeration value="AAH"/>
<xs:enumeration value="AAI"/>
<xs:enumeration value="AAS"/>
<xs:enumeration value="AAT"/>
<xs:enumeration value="AAV"/>
<xs:enumeration value="AAY"/>
<xs:enumeration value="AAZ"/>
<xs:enumeration value="ABA"/>
<xs:enumeration value="ABB"/>
<xs:enumeration value="ABC"/>
<xs:enumeration value="ABD"/>
<xs:enumeration value="ABF"/>
<xs:enumeration value="ABK"/>
<xs:enumeration value="ABL"/>
<xs:enumeration value="ABN"/>
<xs:enumeration value="ABR"/>
<xs:enumeration value="ABS"/>
<xs:enumeration value="ABT"/>
<xs:enumeration value="ABU"/>
<xs:enumeration value="ACF"/>
<xs:enumeration value="ACG"/>
<xs:enumeration value="ACH"/>
<xs:enumeration value="ACI"/>
<xs:enumeration value="ACJ"/>
<xs:enumeration value="ACK"/>
<xs:enumeration value="ACL"/>
<xs:enumeration value="ACM"/>
<xs:enumeration value="ACS"/>
<xs:enumeration value="ADC"/>
<xs:enumeration value="ADE"/>
<xs:enumeration value="ADJ"/>
<xs:enumeration value="ADK"/>
<xs:enumeration value="ADL"/>
<xs:enumeration value="ADM"/>
<xs:enumeration value="ADN"/>
<xs:enumeration value="ADO"/>
<xs:enumeration value="ADP"/>
<xs:enumeration value="ADQ"/>
<xs:enumeration value="ADR"/>
<xs:enumeration value="ADT"/>
<xs:enumeration value="ADW"/>
<xs:enumeration value="ADY"/>
<xs:enumeration value="ADZ"/>
<xs:enumeration value="AEA"/>
<xs:enumeration value="AEB"/>
<xs:enumeration value="AEC"/>
<xs:enumeration value="AED"/>
<xs:enumeration value="AEF"/>
<xs:enumeration value="AEH"/>
<xs:enumeration value="AEI"/>
<xs:enumeration value="AEJ"/>
<xs:enumeration value="AEK"/>
<xs:enumeration value="AEL"/>
<xs:enumeration value="AEM"/>
<xs:enumeration value="AEN"/>
<xs:enumeration value="AEO"/>
<xs:enumeration value="AEP"/>
<xs:enumeration value="AES"/>
<xs:enumeration value="AET"/>
<xs:enumeration value="AEU"/>
<xs:enumeration value="AEV"/>
<xs:enumeration value="AEW"/>
<xs:enumeration value="AEX"/>
<xs:enumeration value="AEY"/>
<xs:enumeration value="AEZ"/>
<xs:enumeration value="AJ"/>
<xs:enumeration value="AU"/>
<xs:enumeration value="CA"/>
<xs:enumeration value="CAB"/>
<xs:enumeration value="CAD"/>
<xs:enumeration value="CAE"/>
<xs:enumeration value="CAF"/>
<xs:enumeration value="CAI"/>
<xs:enumeration value="CAJ"/>
<xs:enumeration value="CAK"/>
<xs:enumeration value="CAL"/>
<xs:enumeration value="CAM"/>
<xs:enumeration value="CAN"/>
<xs:enumeration value="CAO"/>
<xs:enumeration value="CAP"/>
<xs:enumeration value="CAQ"/>
<xs:enumeration value="CAR"/>
<xs:enumeration value="CAS"/>
<xs:enumeration value="CAT"/>
<xs:enumeration value="CAU"/>
<xs:enumeration value="CAV"/>
<xs:enumeration value="CAW"/>
<xs:enumeration value="CAX"/>
<xs:enumeration value="CAY"/>
<xs:enumeration value="CAZ"/>
<xs:enumeration value="CD"/>
<xs:enumeration value="CG"/>
<xs:enumeration value="CS"/>
<xs:enumeration value="CT"/>
<xs:enumeration value="DAB"/>
<xs:enumeration value="DAC"/>
<xs:enumeration value="DAD"/>
<xs:enumeration value="DAF"/>
<xs:enumeration value="DAG"/>
<xs:enumeration value="DAH"/>
<xs:enumeration value="DAI"/>
<xs:enumeration value="DAJ"/>
<xs:enumeration value="DAK"/>
<xs:enumeration value="DAL"/>
<xs:enumeration value="DAM"/>
<xs:enumeration value="DAN"/>
<xs:enumeration value="DAO"/>
<xs:enumeration value="DAP"/>
<xs:enumeration value="DAQ"/>
<xs:enumeration value="DL"/>
<xs:enumeration value="EG"/>
<xs:enumeration value="EP"/>
<xs:enumeration value="ER"/>
<xs:enumeration value="FAA"/>
<xs:enumeration value="FAB"/>
<xs:enumeration value="FAC"/>
<xs:enumeration value="FC"/>
<xs:enumeration value="FH"/>
<xs:enumeration value="FI"/>
<xs:enumeration value="GAA"/>
<xs:enumeration value="HAA"/>
<xs:enumeration value="HD"/>
<xs:enumeration value="HH"/>
<xs:enumeration value="IAA"/>
<xs:enumeration value="IAB"/>
<xs:enumeration value="ID"/>
<xs:enumeration value="IF"/>
<xs:enumeration value="IR"/>
<xs:enumeration value="IS"/>
<xs:enumeration value="KO"/>
<xs:enumeration value="L1"/>
<xs:enumeration value="LA"/>
<xs:enumeration value="LAA"/>
<xs:enumeration value="LAB"/>
<xs:enumeration value="LF"/>
<xs:enumeration value="MAE"/>
<xs:enumeration value="MI"/>
<xs:enumeration value="ML"/>
<xs:enumeration value="NAA"/>
<xs:enumeration value="OA"/>
<xs:enumeration value="PA"/>
<xs:enumeration value="PAA"/>
<xs:enumeration value="PC"/>
<xs:enumeration value="PL"/>
<xs:enumeration value="RAB"/>
<xs:enumeration value="RAC"/>
<xs:enumeration value="RAD"/>
<xs:enumeration value="RAF"/>
<xs:enumeration value="RE"/>
<xs:enumeration value="RF"/>
<xs:enumeration value="RH"/>
<xs:enumeration value="RV"/>
<xs:enumeration value="SA"/>
<xs:enumeration value="SAA"/>
<xs:enumeration value="SAD"/>
<xs:enumeration value="SAE"/>
<xs:enumeration value="SAI"/>
<xs:enumeration value="SG"/>
<xs:enumeration value="SH"/>
<xs:enumeration value="SM"/>
<xs:enumeration value="SU"/>
<xs:enumeration value="TAB"/>
<xs:enumeration value="TAC"/>
<xs:enumeration value="TT"/>
<xs:enumeration value="TV"/>
<xs:enumeration value="V1"/>
<xs:enumeration value="V2"/>
<xs:enumeration value="WH"/>
<xs:enumeration value="XAA"/>
<xs:enumeration value="YY"/>
<xs:enumeration value="ZZZ"/>
<xs:enumeration value="41"/>
<xs:enumeration value="42"/>
<xs:enumeration value="60"/>
<xs:enumeration value="62"/>
<xs:enumeration value="63"/>
<xs:enumeration value="64"/>
<xs:enumeration value="65"/>
<xs:enumeration value="66"/>
<xs:enumeration value="67"/>
<xs:enumeration value="68"/>
<xs:enumeration value="70"/>
<xs:enumeration value="71"/>
<xs:enumeration value="88"/>
<xs:enumeration value="95"/>
<xs:enumeration value="100"/>
<xs:enumeration value="102"/>
<xs:enumeration value="103"/>
<xs:enumeration value="104"/>
<xs:enumeration value="105"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AllowanceChargeReasonCodeType">
<xs:simpleContent>
<xs:extension base="qdt:AllowanceChargeReasonCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CountryIDContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="1A"/>
<xs:enumeration value="AD"/>
<xs:enumeration value="AE"/>
<xs:enumeration value="AF"/>
<xs:enumeration value="AG"/>
<xs:enumeration value="AI"/>
<xs:enumeration value="AL"/>
<xs:enumeration value="AM"/>
<xs:enumeration value="AO"/>
<xs:enumeration value="AQ"/>
<xs:enumeration value="AR"/>
<xs:enumeration value="AS"/>
<xs:enumeration value="AT"/>
<xs:enumeration value="AU"/>
<xs:enumeration value="AW"/>
<xs:enumeration value="AX"/>
<xs:enumeration value="AZ"/>
<xs:enumeration value="BA"/>
<xs:enumeration value="BB"/>
<xs:enumeration value="BD"/>
<xs:enumeration value="BE"/>
<xs:enumeration value="BF"/>
<xs:enumeration value="BG"/>
<xs:enumeration value="BH"/>
<xs:enumeration value="BI"/>
<xs:enumeration value="BJ"/>
<xs:enumeration value="BL"/>
<xs:enumeration value="BM"/>
<xs:enumeration value="BN"/>
<xs:enumeration value="BO"/>
<xs:enumeration value="BQ"/>
<xs:enumeration value="BR"/>
<xs:enumeration value="BS"/>
<xs:enumeration value="BT"/>
<xs:enumeration value="BV"/>
<xs:enumeration value="BW"/>
<xs:enumeration value="BY"/>
<xs:enumeration value="BZ"/>
<xs:enumeration value="CA"/>
<xs:enumeration value="CC"/>
<xs:enumeration value="CD"/>
<xs:enumeration value="CF"/>
<xs:enumeration value="CG"/>
<xs:enumeration value="CH"/>
<xs:enumeration value="CI"/>
<xs:enumeration value="CK"/>
<xs:enumeration value="CL"/>
<xs:enumeration value="CM"/>
<xs:enumeration value="CN"/>
<xs:enumeration value="CO"/>
<xs:enumeration value="CR"/>
<xs:enumeration value="CU"/>
<xs:enumeration value="CV"/>
<xs:enumeration value="CW"/>
<xs:enumeration value="CX"/>
<xs:enumeration value="CY"/>
<xs:enumeration value="CZ"/>
<xs:enumeration value="DE"/>
<xs:enumeration value="DJ"/>
<xs:enumeration value="DK"/>
<xs:enumeration value="DM"/>
<xs:enumeration value="DO"/>
<xs:enumeration value="DZ"/>
<xs:enumeration value="EC"/>
<xs:enumeration value="EE"/>
<xs:enumeration value="EG"/>
<xs:enumeration value="EH"/>
<xs:enumeration value="ER"/>
<xs:enumeration value="ES"/>
<xs:enumeration value="ET"/>
<xs:enumeration value="FI"/>
<xs:enumeration value="FJ"/>
<xs:enumeration value="FK"/>
<xs:enumeration value="FM"/>
<xs:enumeration value="FO"/>
<xs:enumeration value="FR"/>
<xs:enumeration value="GA"/>
<xs:enumeration value="GB"/>
<xs:enumeration value="GD"/>
<xs:enumeration value="GE"/>
<xs:enumeration value="GF"/>
<xs:enumeration value="GG"/>
<xs:enumeration value="GH"/>
<xs:enumeration value="GI"/>
<xs:enumeration value="GL"/>
<xs:enumeration value="GM"/>
<xs:enumeration value="GN"/>
<xs:enumeration value="GP"/>
<xs:enumeration value="GQ"/>
<xs:enumeration value="GR"/>
<xs:enumeration value="GS"/>
<xs:enumeration value="GT"/>
<xs:enumeration value="GU"/>
<xs:enumeration value="GW"/>
<xs:enumeration value="GY"/>
<xs:enumeration value="HK"/>
<xs:enumeration value="HM"/>
<xs:enumeration value="HN"/>
<xs:enumeration value="HR"/>
<xs:enumeration value="HT"/>
<xs:enumeration value="HU"/>
<xs:enumeration value="ID"/>
<xs:enumeration value="IE"/>
<xs:enumeration value="IL"/>
<xs:enumeration value="IM"/>
<xs:enumeration value="IN"/>
<xs:enumeration value="IO"/>
<xs:enumeration value="IQ"/>
<xs:enumeration value="IR"/>
<xs:enumeration value="IS"/>
<xs:enumeration value="IT"/>
<xs:enumeration value="JE"/>
<xs:enumeration value="JM"/>
<xs:enumeration value="JO"/>
<xs:enumeration value="JP"/>
<xs:enumeration value="KE"/>
<xs:enumeration value="KG"/>
<xs:enumeration value="KH"/>
<xs:enumeration value="KI"/>
<xs:enumeration value="KM"/>
<xs:enumeration value="KN"/>
<xs:enumeration value="KP"/>
<xs:enumeration value="KR"/>
<xs:enumeration value="KW"/>
<xs:enumeration value="KY"/>
<xs:enumeration value="KZ"/>
<xs:enumeration value="LA"/>
<xs:enumeration value="LB"/>
<xs:enumeration value="LC"/>
<xs:enumeration value="LI"/>
<xs:enumeration value="LK"/>
<xs:enumeration value="LR"/>
<xs:enumeration value="LS"/>
<xs:enumeration value="LT"/>
<xs:enumeration value="LU"/>
<xs:enumeration value="LV"/>
<xs:enumeration value="LY"/>
<xs:enumeration value="MA"/>
<xs:enumeration value="MC"/>
<xs:enumeration value="MD"/>
<xs:enumeration value="ME"/>
<xs:enumeration value="MF"/>
<xs:enumeration value="MG"/>
<xs:enumeration value="MH"/>
<xs:enumeration value="MK"/>
<xs:enumeration value="ML"/>
<xs:enumeration value="MM"/>
<xs:enumeration value="MN"/>
<xs:enumeration value="MO"/>
<xs:enumeration value="MP"/>
<xs:enumeration value="MQ"/>
<xs:enumeration value="MR"/>
<xs:enumeration value="MS"/>
<xs:enumeration value="MT"/>
<xs:enumeration value="MU"/>
<xs:enumeration value="MV"/>
<xs:enumeration value="MW"/>
<xs:enumeration value="MX"/>
<xs:enumeration value="MY"/>
<xs:enumeration value="MZ"/>
<xs:enumeration value="NA"/>
<xs:enumeration value="NC"/>
<xs:enumeration value="NE"/>
<xs:enumeration value="NF"/>
<xs:enumeration value="NG"/>
<xs:enumeration value="NI"/>
<xs:enumeration value="NL"/>
<xs:enumeration value="NO"/>
<xs:enumeration value="NP"/>
<xs:enumeration value="NR"/>
<xs:enumeration value="NU"/>
<xs:enumeration value="NZ"/>
<xs:enumeration value="OM"/>
<xs:enumeration value="PA"/>
<xs:enumeration value="PE"/>
<xs:enumeration value="PF"/>
<xs:enumeration value="PG"/>
<xs:enumeration value="PH"/>
<xs:enumeration value="PK"/>
<xs:enumeration value="PL"/>
<xs:enumeration value="PM"/>
<xs:enumeration value="PN"/>
<xs:enumeration value="PR"/>
<xs:enumeration value="PS"/>
<xs:enumeration value="PT"/>
<xs:enumeration value="PW"/>
<xs:enumeration value="PY"/>
<xs:enumeration value="QA"/>
<xs:enumeration value="RE"/>
<xs:enumeration value="RO"/>
<xs:enumeration value="RS"/>
<xs:enumeration value="RU"/>
<xs:enumeration value="RW"/>
<xs:enumeration value="SA"/>
<xs:enumeration value="SB"/>
<xs:enumeration value="SC"/>
<xs:enumeration value="SD"/>
<xs:enumeration value="SE"/>
<xs:enumeration value="SG"/>
<xs:enumeration value="SH"/>
<xs:enumeration value="SI"/>
<xs:enumeration value="SJ"/>
<xs:enumeration value="SK"/>
<xs:enumeration value="SL"/>
<xs:enumeration value="SM"/>
<xs:enumeration value="SN"/>
<xs:enumeration value="SO"/>
<xs:enumeration value="SR"/>
<xs:enumeration value="SS"/>
<xs:enumeration value="ST"/>
<xs:enumeration value="SV"/>
<xs:enumeration value="SX"/>
<xs:enumeration value="SY"/>
<xs:enumeration value="SZ"/>
<xs:enumeration value="TC"/>
<xs:enumeration value="TD"/>
<xs:enumeration value="TF"/>
<xs:enumeration value="TG"/>
<xs:enumeration value="TH"/>
<xs:enumeration value="TJ"/>
<xs:enumeration value="TK"/>
<xs:enumeration value="TL"/>
<xs:enumeration value="TM"/>
<xs:enumeration value="TN"/>
<xs:enumeration value="TO"/>
<xs:enumeration value="TR"/>
<xs:enumeration value="TT"/>
<xs:enumeration value="TV"/>
<xs:enumeration value="TW"/>
<xs:enumeration value="TZ"/>
<xs:enumeration value="UA"/>
<xs:enumeration value="UG"/>
<xs:enumeration value="UM"/>
<xs:enumeration value="US"/>
<xs:enumeration value="UY"/>
<xs:enumeration value="UZ"/>
<xs:enumeration value="VA"/>
<xs:enumeration value="VC"/>
<xs:enumeration value="VE"/>
<xs:enumeration value="VG"/>
<xs:enumeration value="VI"/>
<xs:enumeration value="VN"/>
<xs:enumeration value="VU"/>
<xs:enumeration value="WF"/>
<xs:enumeration value="WS"/>
<xs:enumeration value="YE"/>
<xs:enumeration value="YT"/>
<xs:enumeration value="ZA"/>
<xs:enumeration value="ZM"/>
<xs:enumeration value="ZW"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CountryIDType">
<xs:simpleContent>
<xs:extension base="qdt:CountryIDContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CurrencyCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AED"/>
<xs:enumeration value="AFN"/>
<xs:enumeration value="ALL"/>
<xs:enumeration value="AMD"/>
<xs:enumeration value="ANG"/>
<xs:enumeration value="AOA"/>
<xs:enumeration value="ARS"/>
<xs:enumeration value="AUD"/>
<xs:enumeration value="AWG"/>
<xs:enumeration value="AZN"/>
<xs:enumeration value="BAM"/>
<xs:enumeration value="BBD"/>
<xs:enumeration value="BDT"/>
<xs:enumeration value="BGN"/>
<xs:enumeration value="BHD"/>
<xs:enumeration value="BIF"/>
<xs:enumeration value="BMD"/>
<xs:enumeration value="BND"/>
<xs:enumeration value="BOB"/>
<xs:enumeration value="BOV"/>
<xs:enumeration value="BRL"/>
<xs:enumeration value="BSD"/>
<xs:enumeration value="BTN"/>
<xs:enumeration value="BWP"/>
<xs:enumeration value="BYN"/>
<xs:enumeration value="BZD"/>
<xs:enumeration value="CAD"/>
<xs:enumeration value="CDF"/>
<xs:enumeration value="CHE"/>
<xs:enumeration value="CHF"/>
<xs:enumeration value="CHW"/>
<xs:enumeration value="CLF"/>
<xs:enumeration value="CLP"/>
<xs:enumeration value="CNY"/>
<xs:enumeration value="COP"/>
<xs:enumeration value="COU"/>
<xs:enumeration value="CRC"/>
<xs:enumeration value="CUC"/>
<xs:enumeration value="CUP"/>
<xs:enumeration value="CVE"/>
<xs:enumeration value="CZK"/>
<xs:enumeration value="DJF"/>
<xs:enumeration value="DKK"/>
<xs:enumeration value="DOP"/>
<xs:enumeration value="DZD"/>
<xs:enumeration value="EGP"/>
<xs:enumeration value="ERN"/>
<xs:enumeration value="ETB"/>
<xs:enumeration value="EUR"/>
<xs:enumeration value="FJD"/>
<xs:enumeration value="FKP"/>
<xs:enumeration value="GBP"/>
<xs:enumeration value="GEL"/>
<xs:enumeration value="GHS"/>
<xs:enumeration value="GIP"/>
<xs:enumeration value="GMD"/>
<xs:enumeration value="GNF"/>
<xs:enumeration value="GTQ"/>
<xs:enumeration value="GYD"/>
<xs:enumeration value="HKD"/>
<xs:enumeration value="HNL"/>
<xs:enumeration value="HRK"/>
<xs:enumeration value="HTG"/>
<xs:enumeration value="HUF"/>
<xs:enumeration value="IDR"/>
<xs:enumeration value="ILS"/>
<xs:enumeration value="INR"/>
<xs:enumeration value="IQD"/>
<xs:enumeration value="IRR"/>
<xs:enumeration value="ISK"/>
<xs:enumeration value="JMD"/>
<xs:enumeration value="JOD"/>
<xs:enumeration value="JPY"/>
<xs:enumeration value="KES"/>
<xs:enumeration value="KGS"/>
<xs:enumeration value="KHR"/>
<xs:enumeration value="KMF"/>
<xs:enumeration value="KPW"/>
<xs:enumeration value="KRW"/>
<xs:enumeration value="KWD"/>
<xs:enumeration value="KYD"/>
<xs:enumeration value="KZT"/>
<xs:enumeration value="LAK"/>
<xs:enumeration value="LBP"/>
<xs:enumeration value="LKR"/>
<xs:enumeration value="LRD"/>
<xs:enumeration value="LSL"/>
<xs:enumeration value="LYD"/>
<xs:enumeration value="MAD"/>
<xs:enumeration value="MDL"/>
<xs:enumeration value="MGA"/>
<xs:enumeration value="MKD"/>
<xs:enumeration value="MMK"/>
<xs:enumeration value="MNT"/>
<xs:enumeration value="MOP"/>
<xs:enumeration value="MRU"/>
<xs:enumeration value="MUR"/>
<xs:enumeration value="MVR"/>
<xs:enumeration value="MWK"/>
<xs:enumeration value="MXN"/>
<xs:enumeration value="MXV"/>
<xs:enumeration value="MYR"/>
<xs:enumeration value="MZN"/>
<xs:enumeration value="NAD"/>
<xs:enumeration value="NGN"/>
<xs:enumeration value="NIO"/>
<xs:enumeration value="NOK"/>
<xs:enumeration value="NPR"/>
<xs:enumeration value="NZD"/>
<xs:enumeration value="OMR"/>
<xs:enumeration value="PAB"/>
<xs:enumeration value="PEN"/>
<xs:enumeration value="PGK"/>
<xs:enumeration value="PHP"/>
<xs:enumeration value="PKR"/>
<xs:enumeration value="PLN"/>
<xs:enumeration value="PYG"/>
<xs:enumeration value="QAR"/>
<xs:enumeration value="RON"/>
<xs:enumeration value="RSD"/>
<xs:enumeration value="RUB"/>
<xs:enumeration value="RWF"/>
<xs:enumeration value="SAR"/>
<xs:enumeration value="SBD"/>
<xs:enumeration value="SCR"/>
<xs:enumeration value="SDG"/>
<xs:enumeration value="SEK"/>
<xs:enumeration value="SGD"/>
<xs:enumeration value="SHP"/>
<xs:enumeration value="SLL"/>
<xs:enumeration value="SOS"/>
<xs:enumeration value="SRD"/>
<xs:enumeration value="SSP"/>
<xs:enumeration value="STN"/>
<xs:enumeration value="SVC"/>
<xs:enumeration value="SYP"/>
<xs:enumeration value="SZL"/>
<xs:enumeration value="THB"/>
<xs:enumeration value="TJS"/>
<xs:enumeration value="TMT"/>
<xs:enumeration value="TND"/>
<xs:enumeration value="TOP"/>
<xs:enumeration value="TRY"/>
<xs:enumeration value="TTD"/>
<xs:enumeration value="TWD"/>
<xs:enumeration value="TZS"/>
<xs:enumeration value="UAH"/>
<xs:enumeration value="UGX"/>
<xs:enumeration value="USD"/>
<xs:enumeration value="USN"/>
<xs:enumeration value="UYI"/>
<xs:enumeration value="UYU"/>
<xs:enumeration value="UYW"/>
<xs:enumeration value="UZS"/>
<xs:enumeration value="VES"/>
<xs:enumeration value="VND"/>
<xs:enumeration value="VUV"/>
<xs:enumeration value="WST"/>
<xs:enumeration value="XAF"/>
<xs:enumeration value="XAG"/>
<xs:enumeration value="XAU"/>
<xs:enumeration value="XBA"/>
<xs:enumeration value="XBB"/>
<xs:enumeration value="XBC"/>
<xs:enumeration value="XBD"/>
<xs:enumeration value="XCD"/>
<xs:enumeration value="XDR"/>
<xs:enumeration value="XOF"/>
<xs:enumeration value="XPD"/>
<xs:enumeration value="XPF"/>
<xs:enumeration value="XPT"/>
<xs:enumeration value="XSU"/>
<xs:enumeration value="XTS"/>
<xs:enumeration value="XUA"/>
<xs:enumeration value="XXX"/>
<xs:enumeration value="YER"/>
<xs:enumeration value="ZAR"/>
<xs:enumeration value="ZMW"/>
<xs:enumeration value="ZWL"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CurrencyCodeType">
<xs:simpleContent>
<xs:extension base="qdt:CurrencyCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DocumentCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="80"/>
<xs:enumeration value="81"/>
<xs:enumeration value="82"/>
<xs:enumeration value="83"/>
<xs:enumeration value="84"/>
<xs:enumeration value="130"/>
<xs:enumeration value="202"/>
<xs:enumeration value="203"/>
<xs:enumeration value="204"/>
<xs:enumeration value="211"/>
<xs:enumeration value="261"/>
<xs:enumeration value="262"/>
<xs:enumeration value="295"/>
<xs:enumeration value="296"/>
<xs:enumeration value="308"/>
<xs:enumeration value="325"/>
<xs:enumeration value="326"/>
<xs:enumeration value="380"/>
<xs:enumeration value="381"/>
<xs:enumeration value="383"/>
<xs:enumeration value="384"/>
<xs:enumeration value="385"/>
<xs:enumeration value="386"/>
<xs:enumeration value="387"/>
<xs:enumeration value="388"/>
<xs:enumeration value="389"/>
<xs:enumeration value="390"/>
<xs:enumeration value="393"/>
<xs:enumeration value="394"/>
<xs:enumeration value="395"/>
<xs:enumeration value="396"/>
<xs:enumeration value="420"/>
<xs:enumeration value="456"/>
<xs:enumeration value="457"/>
<xs:enumeration value="458"/>
<xs:enumeration value="527"/>
<xs:enumeration value="575"/>
<xs:enumeration value="623"/>
<xs:enumeration value="633"/>
<xs:enumeration value="751"/>
<xs:enumeration value="780"/>
<xs:enumeration value="935"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="DocumentCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DocumentCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="FormattedDateTimeFormatContentType">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="FormattedDateTimeType">
<xs:sequence>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="qdt:FormattedDateTimeFormatContentType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="PaymentMeansCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="10"/>
<xs:enumeration value="20"/>
<xs:enumeration value="30"/>
<xs:enumeration value="42"/>
<xs:enumeration value="48"/>
<xs:enumeration value="49"/>
<xs:enumeration value="57"/>
<xs:enumeration value="58"/>
<xs:enumeration value="59"/>
<xs:enumeration value="97"/>
<xs:enumeration value="ZZZ"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="PaymentMeansCodeType">
<xs:simpleContent>
<xs:extension base="qdt:PaymentMeansCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxCategoryCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AE"/>
<xs:enumeration value="E"/>
<xs:enumeration value="G"/>
<xs:enumeration value="K"/>
<xs:enumeration value="L"/>
<xs:enumeration value="M"/>
<xs:enumeration value="O"/>
<xs:enumeration value="S"/>
<xs:enumeration value="Z"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TaxCategoryCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxCategoryCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxTypeCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="VAT"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TaxTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TimeReferenceCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="5"/>
<xs:enumeration value="29"/>
<xs:enumeration value="72"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TimeReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TimeReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,242 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_BASIC_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_BASIC_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:complexType name="CreditorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentLineDocumentType">
<xs:sequence>
<xs:element name="LineID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType"/>
<xs:element name="SellerTaxRepresentativeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeDeliveryType">
<xs:sequence>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeSettlementType">
<xs:sequence>
<xs:element name="CreditorReferenceID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="InvoiceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementHeaderMonetarySummation" type="ram:TradeSettlementHeaderMonetarySummationType"/>
<xs:element name="InvoiceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LegalOrganizationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TradingBusinessName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeAgreementType">
<xs:sequence>
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeDeliveryType">
<xs:sequence>
<xs:element name="BilledQuantity" type="udt:QuantityType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeSettlementType">
<xs:sequence>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementLineMonetarySummation" type="ram:TradeSettlementLineMonetarySummationType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="Content" type="udt:TextType"/>
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssuerAssignedID" type="udt:IDType"/>
<xs:element name="FormattedIssueDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SpecifiedPeriodType">
<xs:sequence>
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainEventType">
<xs:sequence>
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeLineItemType">
<xs:sequence>
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType"/>
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType"/>
<xs:element name="SpecifiedLineTradeAgreement" type="ram:LineTradeAgreementType"/>
<xs:element name="SpecifiedLineTradeDelivery" type="ram:LineTradeDeliveryType" minOccurs="0"/>
<xs:element name="SpecifiedLineTradeSettlement" type="ram:LineTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" maxOccurs="unbounded"/>
<xs:element name="ApplicableHeaderTradeAgreement" type="ram:HeaderTradeAgreementType"/>
<xs:element name="ApplicableHeaderTradeDelivery" type="ram:HeaderTradeDeliveryType"/>
<xs:element name="ApplicableHeaderTradeSettlement" type="ram:HeaderTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAccountingAccountType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineThree" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAllowanceChargeType">
<xs:sequence>
<xs:element name="ChargeIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="ActualAmount" type="udt:AmountType"/>
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="SpecifiedLegalOrganization" type="ram:LegalOrganizationType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="URIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentTermsType">
<xs:sequence>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="DirectDebitMandateID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePriceType">
<xs:sequence>
<xs:element name="ChargeAmount" type="udt:AmountType"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeProductType">
<xs:sequence>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementHeaderMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType"/>
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="DuePayableAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementLineMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementPaymentMeansType">
<xs:sequence>
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeTaxType">
<xs:sequence>
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType"/>
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType"/>
<xs:element name="ExemptionReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="DueDateTypeCode" type="qdt:TimeReferenceCodeType" minOccurs="0"/>
<xs:element name="RateApplicablePercent" type="udt:PercentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UniversalCommunicationType">
<xs:sequence>
<xs:element name="URIID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="IndicatorType">
<xs:choice>
<xs:element name="Indicator" type="xs:boolean"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="PercentType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="QuantityType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="xs:token" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_EN16931_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="FACTUR-X_EN16931_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_EN16931_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_EN16931_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_EN16931_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:complexType name="CreditorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="AccountName" type="udt:TextType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreditorFinancialInstitutionType">
<xs:sequence>
<xs:element name="BICID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentLineDocumentType">
<xs:sequence>
<xs:element name="LineID" type="udt:IDType"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType"/>
<xs:element name="SellerTaxRepresentativeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="SellerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedProcuringProject" type="ram:ProcuringProjectType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeDeliveryType">
<xs:sequence>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeSettlementType">
<xs:sequence>
<xs:element name="CreditorReferenceID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="TaxCurrencyCode" type="qdt:CurrencyCodeType" minOccurs="0"/>
<xs:element name="InvoiceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementHeaderMonetarySummation" type="ram:TradeSettlementHeaderMonetarySummationType"/>
<xs:element name="InvoiceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LegalOrganizationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TradingBusinessName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0"/>
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeDeliveryType">
<xs:sequence>
<xs:element name="BilledQuantity" type="udt:QuantityType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeSettlementType">
<xs:sequence>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementLineMonetarySummation" type="ram:TradeSettlementLineMonetarySummationType"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="Content" type="udt:TextType"/>
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProcuringProjectType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="Name" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductCharacteristicType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType"/>
<xs:element name="Value" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductClassificationType">
<xs:sequence>
<xs:element name="ClassCode" type="udt:CodeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssuerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="AttachmentBinaryObject" type="udt:BinaryObjectType" minOccurs="0"/>
<xs:element name="ReferenceTypeCode" type="qdt:ReferenceCodeType" minOccurs="0"/>
<xs:element name="FormattedIssueDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SpecifiedPeriodType">
<xs:sequence>
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainEventType">
<xs:sequence>
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeLineItemType">
<xs:sequence>
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType"/>
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType"/>
<xs:element name="SpecifiedLineTradeAgreement" type="ram:LineTradeAgreementType"/>
<xs:element name="SpecifiedLineTradeDelivery" type="ram:LineTradeDeliveryType" minOccurs="0"/>
<xs:element name="SpecifiedLineTradeSettlement" type="ram:LineTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" maxOccurs="unbounded"/>
<xs:element name="ApplicableHeaderTradeAgreement" type="ram:HeaderTradeAgreementType"/>
<xs:element name="ApplicableHeaderTradeDelivery" type="ram:HeaderTradeDeliveryType"/>
<xs:element name="ApplicableHeaderTradeSettlement" type="ram:HeaderTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAccountingAccountType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineThree" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType"/>
<xs:element name="CountrySubDivisionName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAllowanceChargeType">
<xs:sequence>
<xs:element name="ChargeIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="ActualAmount" type="udt:AmountType"/>
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeContactType">
<xs:sequence>
<xs:element name="PersonName" type="udt:TextType" minOccurs="0"/>
<xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/>
<xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeCountryType">
<xs:sequence>
<xs:element name="ID" type="qdt:CountryIDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="SpecifiedLegalOrganization" type="ram:LegalOrganizationType" minOccurs="0"/>
<xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="URIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentTermsType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="DirectDebitMandateID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePriceType">
<xs:sequence>
<xs:element name="ChargeAmount" type="udt:AmountType"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeProductType">
<xs:sequence>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementFinancialCardType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="CardholderName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementHeaderMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="2"/>
<xs:element name="RoundingAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType"/>
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="DuePayableAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementLineMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementPaymentMeansType">
<xs:sequence>
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType"/>
<xs:element name="Information" type="udt:TextType" minOccurs="0"/>
<xs:element name="ApplicableTradeSettlementFinancialCard" type="ram:TradeSettlementFinancialCardType" minOccurs="0"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeTaxType">
<xs:sequence>
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType"/>
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType"/>
<xs:element name="ExemptionReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="TaxPointDate" type="udt:DateType" minOccurs="0"/>
<xs:element name="DueDateTypeCode" type="qdt:TimeReferenceCodeType" minOccurs="0"/>
<xs:element name="RateApplicablePercent" type="udt:PercentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UniversalCommunicationType">
<xs:sequence>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="CompleteNumber" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="BinaryObjectType">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="mimeCode" type="xs:token" use="required"/>
<xs:attribute name="filename" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="listID" type="xs:token" use="optional"/>
<xs:attribute name="listVersionID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="DateType">
<xs:choice>
<xs:element name="DateString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="IndicatorType">
<xs:choice>
<xs:element name="Indicator" type="xs:boolean"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="PercentType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="QuantityType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="xs:token" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,433 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:complexType name="AdvancePaymentType">
<xs:sequence>
<xs:element name="PaidAmount" type="udt:AmountType"/>
<xs:element name="FormattedReceivedDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
<xs:element name="IncludedTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreditorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="AccountName" type="udt:TextType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreditorFinancialInstitutionType">
<xs:sequence>
<xs:element name="BICID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentLineDocumentType">
<xs:sequence>
<xs:element name="LineID" type="udt:IDType"/>
<xs:element name="LineStatusCode" type="qdt:LineStatusCodeType" minOccurs="0"/>
<xs:element name="LineStatusReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="TestIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType"/>
<xs:element name="CopyIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="LanguageID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="EffectiveSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType"/>
<xs:element name="SellerTaxRepresentativeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ProductEndUserTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ApplicableTradeDeliveryTerms" type="ram:TradeDeliveryTermsType" minOccurs="0"/>
<xs:element name="SellerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedProcuringProject" type="ram:ProcuringProjectType" minOccurs="0"/>
<xs:element name="UltimateCustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeDeliveryType">
<xs:sequence>
<xs:element name="RelatedSupplyChainConsignment" type="ram:SupplyChainConsignmentType" minOccurs="0"/>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ShipFromTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeSettlementType">
<xs:sequence>
<xs:element name="CreditorReferenceID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="TaxCurrencyCode" type="qdt:CurrencyCodeType" minOccurs="0"/>
<xs:element name="InvoiceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="InvoiceIssuerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="InvoicerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="InvoiceeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="TaxApplicableTradeCurrencyExchange" type="ram:TradeCurrencyExchangeType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedLogisticsServiceCharge" type="ram:LogisticsServiceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementHeaderMonetarySummation" type="ram:TradeSettlementHeaderMonetarySummationType"/>
<xs:element name="InvoiceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedAdvancePayment" type="ram:AdvancePaymentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LegalOrganizationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TradingBusinessName" type="udt:TextType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0"/>
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType"/>
<xs:element name="UltimateCustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeDeliveryType">
<xs:sequence>
<xs:element name="BilledQuantity" type="udt:QuantityType"/>
<xs:element name="ChargeFreeQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="PackageQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeSettlementType">
<xs:sequence>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementLineMonetarySummation" type="ram:TradeSettlementLineMonetarySummationType"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LogisticsServiceChargeType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType"/>
<xs:element name="AppliedAmount" type="udt:AmountType"/>
<xs:element name="AppliedTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LogisticsTransportMovementType">
<xs:sequence>
<xs:element name="ModeCode" type="qdt:TransportModeCodeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="ContentCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="Content" type="udt:TextType"/>
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProcuringProjectType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="Name" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductCharacteristicType">
<xs:sequence>
<xs:element name="TypeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="Description" type="udt:TextType"/>
<xs:element name="ValueMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="Value" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductClassificationType">
<xs:sequence>
<xs:element name="ClassCode" type="udt:CodeType"/>
<xs:element name="ClassName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssuerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="AttachmentBinaryObject" type="udt:BinaryObjectType" minOccurs="0"/>
<xs:element name="ReferenceTypeCode" type="qdt:ReferenceCodeType" minOccurs="0"/>
<xs:element name="FormattedIssueDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedProductType">
<xs:sequence>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="UnitQuantity" type="udt:QuantityType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SpecifiedPeriodType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="CompleteDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainConsignmentType">
<xs:sequence>
<xs:element name="SpecifiedLogisticsTransportMovement" type="ram:LogisticsTransportMovementType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainEventType">
<xs:sequence>
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeLineItemType">
<xs:sequence>
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType"/>
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType"/>
<xs:element name="SpecifiedLineTradeAgreement" type="ram:LineTradeAgreementType"/>
<xs:element name="SpecifiedLineTradeDelivery" type="ram:LineTradeDeliveryType" minOccurs="0"/>
<xs:element name="SpecifiedLineTradeSettlement" type="ram:LineTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" maxOccurs="unbounded"/>
<xs:element name="ApplicableHeaderTradeAgreement" type="ram:HeaderTradeAgreementType"/>
<xs:element name="ApplicableHeaderTradeDelivery" type="ram:HeaderTradeDeliveryType"/>
<xs:element name="ApplicableHeaderTradeSettlement" type="ram:HeaderTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAccountingAccountType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="TypeCode" type="qdt:AccountingAccountTypeCodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineThree" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType"/>
<xs:element name="CountrySubDivisionName" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAllowanceChargeType">
<xs:sequence>
<xs:element name="ChargeIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="SequenceNumeric" type="udt:NumericType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ActualAmount" type="udt:AmountType"/>
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeContactType">
<xs:sequence>
<xs:element name="PersonName" type="udt:TextType" minOccurs="0"/>
<xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/>
<xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="FaxUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeCountryType">
<xs:sequence>
<xs:element name="ID" type="qdt:CountryIDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeCurrencyExchangeType">
<xs:sequence>
<xs:element name="SourceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="TargetCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="ConversionRate" type="udt:RateType"/>
<xs:element name="ConversionRateDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeDeliveryTermsType">
<xs:sequence>
<xs:element name="DeliveryTypeCode" type="qdt:DeliveryTermsCodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="SpecifiedLegalOrganization" type="ram:LegalOrganizationType" minOccurs="0"/>
<xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="URIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentDiscountTermsType">
<xs:sequence>
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="ActualDiscountAmount" type="udt:AmountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentPenaltyTermsType">
<xs:sequence>
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="ActualPenaltyAmount" type="udt:AmountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentTermsType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="DirectDebitMandateID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PartialPaymentAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="ApplicableTradePaymentPenaltyTerms" type="ram:TradePaymentPenaltyTermsType" minOccurs="0"/>
<xs:element name="ApplicableTradePaymentDiscountTerms" type="ram:TradePaymentDiscountTermsType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePriceType">
<xs:sequence>
<xs:element name="ChargeAmount" type="udt:AmountType"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IncludedTradeTax" type="ram:TradeTaxType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeProductType">
<xs:sequence>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0"/>
<xs:element name="IncludedReferencedProduct" type="ram:ReferencedProductType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementFinancialCardType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="CardholderName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementHeaderMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType" maxOccurs="2"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="2"/>
<xs:element name="RoundingAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType" maxOccurs="2"/>
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="DuePayableAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementLineMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="TotalAllowanceChargeAmount" type="udt:AmountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementPaymentMeansType">
<xs:sequence>
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType"/>
<xs:element name="Information" type="udt:TextType" minOccurs="0"/>
<xs:element name="ApplicableTradeSettlementFinancialCard" type="ram:TradeSettlementFinancialCardType" minOccurs="0"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeTaxType">
<xs:sequence>
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType" minOccurs="0"/>
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="LineTotalBasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceChargeBasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType" minOccurs="0"/>
<xs:element name="ExemptionReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="TaxPointDate" type="udt:DateType" minOccurs="0"/>
<xs:element name="DueDateTypeCode" type="qdt:TimeReferenceCodeType" minOccurs="0"/>
<xs:element name="RateApplicablePercent" type="udt:PercentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UniversalCommunicationType">
<xs:sequence>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="CompleteNumber" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="BinaryObjectType">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="mimeCode" type="xs:token" use="required"/>
<xs:attribute name="filename" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="listID" type="xs:token" use="optional"/>
<xs:attribute name="listVersionID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="DateTime" type="xs:dateTime"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="DateType">
<xs:choice>
<xs:element name="DateString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="IndicatorType">
<xs:choice>
<xs:element name="Indicator" type="xs:boolean"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="MeasureType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="xs:token" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="NumericType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="PercentType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="QuantityType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="xs:token" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="RateType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_MINIMUM_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="FACTUR-X_MINIMUM_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_MINIMUM_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,507 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_MINIMUM_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:simpleType name="CountryIDContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="1A"/>
<xs:enumeration value="AD"/>
<xs:enumeration value="AE"/>
<xs:enumeration value="AF"/>
<xs:enumeration value="AG"/>
<xs:enumeration value="AI"/>
<xs:enumeration value="AL"/>
<xs:enumeration value="AM"/>
<xs:enumeration value="AO"/>
<xs:enumeration value="AQ"/>
<xs:enumeration value="AR"/>
<xs:enumeration value="AS"/>
<xs:enumeration value="AT"/>
<xs:enumeration value="AU"/>
<xs:enumeration value="AW"/>
<xs:enumeration value="AX"/>
<xs:enumeration value="AZ"/>
<xs:enumeration value="BA"/>
<xs:enumeration value="BB"/>
<xs:enumeration value="BD"/>
<xs:enumeration value="BE"/>
<xs:enumeration value="BF"/>
<xs:enumeration value="BG"/>
<xs:enumeration value="BH"/>
<xs:enumeration value="BI"/>
<xs:enumeration value="BJ"/>
<xs:enumeration value="BL"/>
<xs:enumeration value="BM"/>
<xs:enumeration value="BN"/>
<xs:enumeration value="BO"/>
<xs:enumeration value="BQ"/>
<xs:enumeration value="BR"/>
<xs:enumeration value="BS"/>
<xs:enumeration value="BT"/>
<xs:enumeration value="BV"/>
<xs:enumeration value="BW"/>
<xs:enumeration value="BY"/>
<xs:enumeration value="BZ"/>
<xs:enumeration value="CA"/>
<xs:enumeration value="CC"/>
<xs:enumeration value="CD"/>
<xs:enumeration value="CF"/>
<xs:enumeration value="CG"/>
<xs:enumeration value="CH"/>
<xs:enumeration value="CI"/>
<xs:enumeration value="CK"/>
<xs:enumeration value="CL"/>
<xs:enumeration value="CM"/>
<xs:enumeration value="CN"/>
<xs:enumeration value="CO"/>
<xs:enumeration value="CR"/>
<xs:enumeration value="CU"/>
<xs:enumeration value="CV"/>
<xs:enumeration value="CW"/>
<xs:enumeration value="CX"/>
<xs:enumeration value="CY"/>
<xs:enumeration value="CZ"/>
<xs:enumeration value="DE"/>
<xs:enumeration value="DJ"/>
<xs:enumeration value="DK"/>
<xs:enumeration value="DM"/>
<xs:enumeration value="DO"/>
<xs:enumeration value="DZ"/>
<xs:enumeration value="EC"/>
<xs:enumeration value="EE"/>
<xs:enumeration value="EG"/>
<xs:enumeration value="EH"/>
<xs:enumeration value="ER"/>
<xs:enumeration value="ES"/>
<xs:enumeration value="ET"/>
<xs:enumeration value="FI"/>
<xs:enumeration value="FJ"/>
<xs:enumeration value="FK"/>
<xs:enumeration value="FM"/>
<xs:enumeration value="FO"/>
<xs:enumeration value="FR"/>
<xs:enumeration value="GA"/>
<xs:enumeration value="GB"/>
<xs:enumeration value="GD"/>
<xs:enumeration value="GE"/>
<xs:enumeration value="GF"/>
<xs:enumeration value="GG"/>
<xs:enumeration value="GH"/>
<xs:enumeration value="GI"/>
<xs:enumeration value="GL"/>
<xs:enumeration value="GM"/>
<xs:enumeration value="GN"/>
<xs:enumeration value="GP"/>
<xs:enumeration value="GQ"/>
<xs:enumeration value="GR"/>
<xs:enumeration value="GS"/>
<xs:enumeration value="GT"/>
<xs:enumeration value="GU"/>
<xs:enumeration value="GW"/>
<xs:enumeration value="GY"/>
<xs:enumeration value="HK"/>
<xs:enumeration value="HM"/>
<xs:enumeration value="HN"/>
<xs:enumeration value="HR"/>
<xs:enumeration value="HT"/>
<xs:enumeration value="HU"/>
<xs:enumeration value="ID"/>
<xs:enumeration value="IE"/>
<xs:enumeration value="IL"/>
<xs:enumeration value="IM"/>
<xs:enumeration value="IN"/>
<xs:enumeration value="IO"/>
<xs:enumeration value="IQ"/>
<xs:enumeration value="IR"/>
<xs:enumeration value="IS"/>
<xs:enumeration value="IT"/>
<xs:enumeration value="JE"/>
<xs:enumeration value="JM"/>
<xs:enumeration value="JO"/>
<xs:enumeration value="JP"/>
<xs:enumeration value="KE"/>
<xs:enumeration value="KG"/>
<xs:enumeration value="KH"/>
<xs:enumeration value="KI"/>
<xs:enumeration value="KM"/>
<xs:enumeration value="KN"/>
<xs:enumeration value="KP"/>
<xs:enumeration value="KR"/>
<xs:enumeration value="KW"/>
<xs:enumeration value="KY"/>
<xs:enumeration value="KZ"/>
<xs:enumeration value="LA"/>
<xs:enumeration value="LB"/>
<xs:enumeration value="LC"/>
<xs:enumeration value="LI"/>
<xs:enumeration value="LK"/>
<xs:enumeration value="LR"/>
<xs:enumeration value="LS"/>
<xs:enumeration value="LT"/>
<xs:enumeration value="LU"/>
<xs:enumeration value="LV"/>
<xs:enumeration value="LY"/>
<xs:enumeration value="MA"/>
<xs:enumeration value="MC"/>
<xs:enumeration value="MD"/>
<xs:enumeration value="ME"/>
<xs:enumeration value="MF"/>
<xs:enumeration value="MG"/>
<xs:enumeration value="MH"/>
<xs:enumeration value="MK"/>
<xs:enumeration value="ML"/>
<xs:enumeration value="MM"/>
<xs:enumeration value="MN"/>
<xs:enumeration value="MO"/>
<xs:enumeration value="MP"/>
<xs:enumeration value="MQ"/>
<xs:enumeration value="MR"/>
<xs:enumeration value="MS"/>
<xs:enumeration value="MT"/>
<xs:enumeration value="MU"/>
<xs:enumeration value="MV"/>
<xs:enumeration value="MW"/>
<xs:enumeration value="MX"/>
<xs:enumeration value="MY"/>
<xs:enumeration value="MZ"/>
<xs:enumeration value="NA"/>
<xs:enumeration value="NC"/>
<xs:enumeration value="NE"/>
<xs:enumeration value="NF"/>
<xs:enumeration value="NG"/>
<xs:enumeration value="NI"/>
<xs:enumeration value="NL"/>
<xs:enumeration value="NO"/>
<xs:enumeration value="NP"/>
<xs:enumeration value="NR"/>
<xs:enumeration value="NU"/>
<xs:enumeration value="NZ"/>
<xs:enumeration value="OM"/>
<xs:enumeration value="PA"/>
<xs:enumeration value="PE"/>
<xs:enumeration value="PF"/>
<xs:enumeration value="PG"/>
<xs:enumeration value="PH"/>
<xs:enumeration value="PK"/>
<xs:enumeration value="PL"/>
<xs:enumeration value="PM"/>
<xs:enumeration value="PN"/>
<xs:enumeration value="PR"/>
<xs:enumeration value="PS"/>
<xs:enumeration value="PT"/>
<xs:enumeration value="PW"/>
<xs:enumeration value="PY"/>
<xs:enumeration value="QA"/>
<xs:enumeration value="RE"/>
<xs:enumeration value="RO"/>
<xs:enumeration value="RS"/>
<xs:enumeration value="RU"/>
<xs:enumeration value="RW"/>
<xs:enumeration value="SA"/>
<xs:enumeration value="SB"/>
<xs:enumeration value="SC"/>
<xs:enumeration value="SD"/>
<xs:enumeration value="SE"/>
<xs:enumeration value="SG"/>
<xs:enumeration value="SH"/>
<xs:enumeration value="SI"/>
<xs:enumeration value="SJ"/>
<xs:enumeration value="SK"/>
<xs:enumeration value="SL"/>
<xs:enumeration value="SM"/>
<xs:enumeration value="SN"/>
<xs:enumeration value="SO"/>
<xs:enumeration value="SR"/>
<xs:enumeration value="SS"/>
<xs:enumeration value="ST"/>
<xs:enumeration value="SV"/>
<xs:enumeration value="SX"/>
<xs:enumeration value="SY"/>
<xs:enumeration value="SZ"/>
<xs:enumeration value="TC"/>
<xs:enumeration value="TD"/>
<xs:enumeration value="TF"/>
<xs:enumeration value="TG"/>
<xs:enumeration value="TH"/>
<xs:enumeration value="TJ"/>
<xs:enumeration value="TK"/>
<xs:enumeration value="TL"/>
<xs:enumeration value="TM"/>
<xs:enumeration value="TN"/>
<xs:enumeration value="TO"/>
<xs:enumeration value="TR"/>
<xs:enumeration value="TT"/>
<xs:enumeration value="TV"/>
<xs:enumeration value="TW"/>
<xs:enumeration value="TZ"/>
<xs:enumeration value="UA"/>
<xs:enumeration value="UG"/>
<xs:enumeration value="UM"/>
<xs:enumeration value="US"/>
<xs:enumeration value="UY"/>
<xs:enumeration value="UZ"/>
<xs:enumeration value="VA"/>
<xs:enumeration value="VC"/>
<xs:enumeration value="VE"/>
<xs:enumeration value="VG"/>
<xs:enumeration value="VI"/>
<xs:enumeration value="VN"/>
<xs:enumeration value="VU"/>
<xs:enumeration value="WF"/>
<xs:enumeration value="WS"/>
<xs:enumeration value="YE"/>
<xs:enumeration value="YT"/>
<xs:enumeration value="ZA"/>
<xs:enumeration value="ZM"/>
<xs:enumeration value="ZW"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CountryIDType">
<xs:simpleContent>
<xs:extension base="qdt:CountryIDContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CurrencyCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="AED"/>
<xs:enumeration value="AFN"/>
<xs:enumeration value="ALL"/>
<xs:enumeration value="AMD"/>
<xs:enumeration value="ANG"/>
<xs:enumeration value="AOA"/>
<xs:enumeration value="ARS"/>
<xs:enumeration value="AUD"/>
<xs:enumeration value="AWG"/>
<xs:enumeration value="AZN"/>
<xs:enumeration value="BAM"/>
<xs:enumeration value="BBD"/>
<xs:enumeration value="BDT"/>
<xs:enumeration value="BGN"/>
<xs:enumeration value="BHD"/>
<xs:enumeration value="BIF"/>
<xs:enumeration value="BMD"/>
<xs:enumeration value="BND"/>
<xs:enumeration value="BOB"/>
<xs:enumeration value="BOV"/>
<xs:enumeration value="BRL"/>
<xs:enumeration value="BSD"/>
<xs:enumeration value="BTN"/>
<xs:enumeration value="BWP"/>
<xs:enumeration value="BYN"/>
<xs:enumeration value="BZD"/>
<xs:enumeration value="CAD"/>
<xs:enumeration value="CDF"/>
<xs:enumeration value="CHE"/>
<xs:enumeration value="CHF"/>
<xs:enumeration value="CHW"/>
<xs:enumeration value="CLF"/>
<xs:enumeration value="CLP"/>
<xs:enumeration value="CNY"/>
<xs:enumeration value="COP"/>
<xs:enumeration value="COU"/>
<xs:enumeration value="CRC"/>
<xs:enumeration value="CUC"/>
<xs:enumeration value="CUP"/>
<xs:enumeration value="CVE"/>
<xs:enumeration value="CZK"/>
<xs:enumeration value="DJF"/>
<xs:enumeration value="DKK"/>
<xs:enumeration value="DOP"/>
<xs:enumeration value="DZD"/>
<xs:enumeration value="EGP"/>
<xs:enumeration value="ERN"/>
<xs:enumeration value="ETB"/>
<xs:enumeration value="EUR"/>
<xs:enumeration value="FJD"/>
<xs:enumeration value="FKP"/>
<xs:enumeration value="GBP"/>
<xs:enumeration value="GEL"/>
<xs:enumeration value="GHS"/>
<xs:enumeration value="GIP"/>
<xs:enumeration value="GMD"/>
<xs:enumeration value="GNF"/>
<xs:enumeration value="GTQ"/>
<xs:enumeration value="GYD"/>
<xs:enumeration value="HKD"/>
<xs:enumeration value="HNL"/>
<xs:enumeration value="HRK"/>
<xs:enumeration value="HTG"/>
<xs:enumeration value="HUF"/>
<xs:enumeration value="IDR"/>
<xs:enumeration value="ILS"/>
<xs:enumeration value="INR"/>
<xs:enumeration value="IQD"/>
<xs:enumeration value="IRR"/>
<xs:enumeration value="ISK"/>
<xs:enumeration value="JMD"/>
<xs:enumeration value="JOD"/>
<xs:enumeration value="JPY"/>
<xs:enumeration value="KES"/>
<xs:enumeration value="KGS"/>
<xs:enumeration value="KHR"/>
<xs:enumeration value="KMF"/>
<xs:enumeration value="KPW"/>
<xs:enumeration value="KRW"/>
<xs:enumeration value="KWD"/>
<xs:enumeration value="KYD"/>
<xs:enumeration value="KZT"/>
<xs:enumeration value="LAK"/>
<xs:enumeration value="LBP"/>
<xs:enumeration value="LKR"/>
<xs:enumeration value="LRD"/>
<xs:enumeration value="LSL"/>
<xs:enumeration value="LYD"/>
<xs:enumeration value="MAD"/>
<xs:enumeration value="MDL"/>
<xs:enumeration value="MGA"/>
<xs:enumeration value="MKD"/>
<xs:enumeration value="MMK"/>
<xs:enumeration value="MNT"/>
<xs:enumeration value="MOP"/>
<xs:enumeration value="MRU"/>
<xs:enumeration value="MUR"/>
<xs:enumeration value="MVR"/>
<xs:enumeration value="MWK"/>
<xs:enumeration value="MXN"/>
<xs:enumeration value="MXV"/>
<xs:enumeration value="MYR"/>
<xs:enumeration value="MZN"/>
<xs:enumeration value="NAD"/>
<xs:enumeration value="NGN"/>
<xs:enumeration value="NIO"/>
<xs:enumeration value="NOK"/>
<xs:enumeration value="NPR"/>
<xs:enumeration value="NZD"/>
<xs:enumeration value="OMR"/>
<xs:enumeration value="PAB"/>
<xs:enumeration value="PEN"/>
<xs:enumeration value="PGK"/>
<xs:enumeration value="PHP"/>
<xs:enumeration value="PKR"/>
<xs:enumeration value="PLN"/>
<xs:enumeration value="PYG"/>
<xs:enumeration value="QAR"/>
<xs:enumeration value="RON"/>
<xs:enumeration value="RSD"/>
<xs:enumeration value="RUB"/>
<xs:enumeration value="RWF"/>
<xs:enumeration value="SAR"/>
<xs:enumeration value="SBD"/>
<xs:enumeration value="SCR"/>
<xs:enumeration value="SDG"/>
<xs:enumeration value="SEK"/>
<xs:enumeration value="SGD"/>
<xs:enumeration value="SHP"/>
<xs:enumeration value="SLL"/>
<xs:enumeration value="SOS"/>
<xs:enumeration value="SRD"/>
<xs:enumeration value="SSP"/>
<xs:enumeration value="STN"/>
<xs:enumeration value="SVC"/>
<xs:enumeration value="SYP"/>
<xs:enumeration value="SZL"/>
<xs:enumeration value="THB"/>
<xs:enumeration value="TJS"/>
<xs:enumeration value="TMT"/>
<xs:enumeration value="TND"/>
<xs:enumeration value="TOP"/>
<xs:enumeration value="TRY"/>
<xs:enumeration value="TTD"/>
<xs:enumeration value="TWD"/>
<xs:enumeration value="TZS"/>
<xs:enumeration value="UAH"/>
<xs:enumeration value="UGX"/>
<xs:enumeration value="USD"/>
<xs:enumeration value="USN"/>
<xs:enumeration value="UYI"/>
<xs:enumeration value="UYU"/>
<xs:enumeration value="UYW"/>
<xs:enumeration value="UZS"/>
<xs:enumeration value="VES"/>
<xs:enumeration value="VND"/>
<xs:enumeration value="VUV"/>
<xs:enumeration value="WST"/>
<xs:enumeration value="XAF"/>
<xs:enumeration value="XAG"/>
<xs:enumeration value="XAU"/>
<xs:enumeration value="XBA"/>
<xs:enumeration value="XBB"/>
<xs:enumeration value="XBC"/>
<xs:enumeration value="XBD"/>
<xs:enumeration value="XCD"/>
<xs:enumeration value="XDR"/>
<xs:enumeration value="XOF"/>
<xs:enumeration value="XPD"/>
<xs:enumeration value="XPF"/>
<xs:enumeration value="XPT"/>
<xs:enumeration value="XSU"/>
<xs:enumeration value="XTS"/>
<xs:enumeration value="XUA"/>
<xs:enumeration value="XXX"/>
<xs:enumeration value="YER"/>
<xs:enumeration value="ZAR"/>
<xs:enumeration value="ZMW"/>
<xs:enumeration value="ZWL"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="CurrencyCodeType">
<xs:simpleContent>
<xs:extension base="qdt:CurrencyCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DocumentCodeContentType">
<xs:restriction base="xs:token">
<xs:enumeration value="80"/>
<xs:enumeration value="81"/>
<xs:enumeration value="82"/>
<xs:enumeration value="83"/>
<xs:enumeration value="84"/>
<xs:enumeration value="130"/>
<xs:enumeration value="202"/>
<xs:enumeration value="203"/>
<xs:enumeration value="204"/>
<xs:enumeration value="211"/>
<xs:enumeration value="261"/>
<xs:enumeration value="262"/>
<xs:enumeration value="295"/>
<xs:enumeration value="296"/>
<xs:enumeration value="308"/>
<xs:enumeration value="325"/>
<xs:enumeration value="326"/>
<xs:enumeration value="380"/>
<xs:enumeration value="381"/>
<xs:enumeration value="383"/>
<xs:enumeration value="384"/>
<xs:enumeration value="385"/>
<xs:enumeration value="386"/>
<xs:enumeration value="387"/>
<xs:enumeration value="388"/>
<xs:enumeration value="389"/>
<xs:enumeration value="390"/>
<xs:enumeration value="393"/>
<xs:enumeration value="394"/>
<xs:enumeration value="395"/>
<xs:enumeration value="396"/>
<xs:enumeration value="420"/>
<xs:enumeration value="456"/>
<xs:enumeration value="457"/>
<xs:enumeration value="458"/>
<xs:enumeration value="527"/>
<xs:enumeration value="575"/>
<xs:enumeration value="623"/>
<xs:enumeration value="633"/>
<xs:enumeration value="751"/>
<xs:enumeration value="780"/>
<xs:enumeration value="935"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="DocumentCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DocumentCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="FACTUR-X_MINIMUM_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="FACTUR-X_MINIMUM_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeDeliveryType"/>
<xs:complexType name="HeaderTradeSettlementType">
<xs:sequence>
<xs:element name="InvoiceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="SpecifiedTradeSettlementHeaderMonetarySummation" type="ram:TradeSettlementHeaderMonetarySummationType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LegalOrganizationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssuerAssignedID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="ApplicableHeaderTradeAgreement" type="ram:HeaderTradeAgreementType"/>
<xs:element name="ApplicableHeaderTradeDelivery" type="ram:HeaderTradeDeliveryType"/>
<xs:element name="ApplicableHeaderTradeSettlement" type="ram:HeaderTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineThree" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType"/>
<xs:element name="CountrySubDivisionName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="Name" type="udt:TextType"/>
<xs:element name="SpecifiedLegalOrganization" type="ram:LegalOrganizationType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementHeaderMonetarySummationType">
<xs:sequence>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType"/>
<xs:element name="DuePayableAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
elementFormDefault="qualified"
version="100.D16B">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,61 @@
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" is-a="model"
id="CII-model">
<param name="BR-DE-01"
value="rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans" />
<param name="BR-DE-02" value="ram:DefinedTradeContact" />
<param name="BR-DE-03" value="ram:CityName[boolean(normalize-space(.))]" />
<param name="BR-DE-04" value="ram:PostcodeCode[boolean(normalize-space(.))]" />
<param name="BR-DE-05"
value="(ram:PersonName,ram:DepartmentName)[boolean(normalize-space(.))]" />
<param name="BR-DE-06"
value="ram:TelephoneUniversalCommunication/ram:CompleteNumber[boolean(normalize-space(.))]" />
<param name="BR-DE-07"
value="ram:EmailURIUniversalCommunication/ram:URIID[boolean(normalize-space(.))]" />
<param name="BR-DE-08" value="ram:CityName[boolean(normalize-space(.))]" />
<param name="BR-DE-09" value="ram:PostcodeCode[boolean(normalize-space(.))]" />
<param name="BR-DE-10" value="ram:CityName[boolean(normalize-space(.))]" />
<param name="BR-DE-11" value="ram:PostcodeCode[boolean(normalize-space(.))]" />
<!-- Für BG-19 wird jedes Informationselement der Gruppe einzeln aufgeführt, der Pfad zu BG-19 (DIRECT DEBIT) zu unspezifisch ist und
sich mit den Pfaden zu BG-17 und BG-18 überschneidet. -->
<param name="BR-DE-13"
value="count((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayeePartyCreditorFinancialAccount)[1]) + count(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:ApplicableTradeSettlementFinancialCard) + count((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID, rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:CreditorReferenceID, rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayerPartyDebtorFinancialAccount/ram:IBANID)[1]) = 1" />
<param name="BR-DE-14"
value="ram:RateApplicablePercent[boolean(normalize-space(.))]" />
<param name="BR-DE-15"
value="rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerReference[boolean(normalize-space(.))]" />
<param name="BR-DE-16"
value="(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID='VA' or @schemeID='VAT' or @schemeID='FC'][boolean(normalize-space(.))], rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty)" />
<param name="BR-DE-17"
value="rsm:ExchangedDocument/ram:TypeCode = ('326', '380', '384', '389', '381', '875', '876', '877')" />
<param name="BR-DE-18"
value="every $line in rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:Description/tokenize(.,'(\r\n|\r|\n)') satisfies if(count(tokenize($line,'#')) &gt; 1) then tokenize($line,'#')[1]='' and (tokenize($line,'#')[2]='SKONTO' or tokenize($line,'#')[2]='VERZUG') and string-length(replace(tokenize($line,'#')[3],'TAGE=[0-9]+',''))=0 and string-length(replace(tokenize($line,'#')[4],'PROZENT=[0-9]+\.[0-9]{2}',''))=0 and (tokenize($line,'#')[5]='' and empty(tokenize($line,'#')[6]) or string-length(replace(tokenize($line,'#')[5],'BASISBETRAG=[0-9]+\.[0-9]{2}',''))=0 and tokenize($line,'#')[6]='' and empty(tokenize($line,'#')[7])) else true()" />
<param name="BR-DE-19"
value=" not(ram:TypeCode = '58') or matches(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer( replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( upper-case(concat(substring(ram:PayeePartyCreditorFinancialAccount/ram:IBANID,5),substring(ram:PayeePartyCreditorFinancialAccount/ram:IBANID,1,4))) ,'A','10'),'B','11'),'C','12'),'D','13'),'E','14'),'F','15'),'G','16'),'H','17'),'I','18'),'J','19'),'K','20'),'L','21'),'M','22') ,'N','23'),'O','24'),'P','25'),'Q','26'),'R','27'),'S','28'),'T','29'),'U','30'),'V','31'),'W','32'),'X','33'),'Y','34'),'Z','35') ) mod 97 = 1 " />
<param name="BR-DE-20"
value=" not(ram:TypeCode = '59') or matches(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer( replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( upper-case(concat(substring(ram:PayerPartyDebtorFinancialAccount/ram:IBANID,5),substring(ram:PayerPartyDebtorFinancialAccount/ram:IBANID,1,4))) ,'A','10'),'B','11'),'C','12'),'D','13'),'E','14'),'F','15'),'G','16'),'H','17'),'I','18'),'J','19'),'K','20'),'L','21'),'M','22') ,'N','23'),'O','24'),'P','25'),'Q','26'),'R','27'),'S','28'),'T','29'),'U','30'),'V','31'),'W','32'),'X','33'),'Y','34'),'Z','35') ) mod 97 = 1" />
<param name="BR-DE-21"
value="ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2'" />
<param name="INVOICE" value="//rsm:CrossIndustryInvoice" />
<param name="BG-2_PROCESS_CONTROL"
value="/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext" />
<param name="BG-4_SELLER"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty" />
<param name="BG-5_SELLER_POSTAL_ADDRESS"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:PostalTradeAddress" />
<param name="BG-6_SELLER_CONTACT"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact" />
<param name="BG-8_BUYER_POSTAL_ADDRESS"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:PostalTradeAddress" />
<param name="BG-15_DELIVER_TO_ADDRESS"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty/ram:PostalTradeAddress" />
<param name="BG-16_PAYMENT_INSTRUCTIONS"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans" />
<param name="BG-23_VAT_BREAKDOWN"
value="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax" />
</pattern>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://purl.oclc.org/dsdl/schematron"
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:ccts="urn:un:unece:uncefact:documentation:standard:CoreComponentsTechnicalSpecification:2"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
schemaVersion="2.0.0" queryBinding="xslt2">
<title>Schematron Version 1.3.0 - XRechnung
1.2.2 compatible - CII</title>
<ns prefix="rsm"
uri="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" />
<ns prefix="ccts"
uri="urn:un:unece:uncefact:documentation:standard:CoreComponentsTechnicalSpecification:2" />
<ns prefix="udt"
uri="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" />
<ns prefix="qdt"
uri="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" />
<ns prefix="ram"
uri="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" />
<phase id="XRechnung_model">
<active pattern="CII-model" />
</phase>
<!-- Abstract CEN BII patterns -->
<!-- ========================= -->
<include href="abstract/XRechnung-model.sch" />
<!-- Data Binding parameters -->
<!-- ======================= -->
<include href="CII/XRechnung-CII-model.sch" />
</schema>

View File

@@ -0,0 +1,59 @@
<pattern xmlns="http://purl.oclc.org/dsdl/schematron" abstract="true" id="model">
<rule context="$INVOICE">
<assert test="$BR-DE-01" flag="fatal" id="BR-DE-1"
>[BR-DE-1] Eine Rechnung (INVOICE) muss Angaben zu "PAYMENT INSTRUCTIONS" (BG-16) enthalten.</assert>
<assert test="$BR-DE-13" flag="fatal" id="BR-DE-13"
>[BR-DE-13] In der Rechnung müssen Angaben zu genau einer der drei Gruppen "CREDIT TRANSFER" (BG-17), "PAYMENT CARD INFORMATION" (BG-18) oder "DIRECT DEBIT" (BG-19) übermittelt werden.</assert>
<assert test="$BR-DE-15" flag="fatal" id="BR-DE-15"
>[BR-DE-15] Das Element "Buyer reference" (BT-10) muss übermittelt werden.</assert>
<assert test="$BR-DE-16" flag="fatal" id="BR-DE-16"
>[BR-DE-16] In der Rechnung muss mindestens eines der Elemente "Seller VAT identifier" (BT-31), "Seller tax registration identifier" (BT-32) oder "SELLER TAX REPRESENTATIVE PARTY" (BG-11) übermittelt werden.</assert>
<assert test="$BR-DE-17" flag="warning" id="BR-DE-17" >[BR-DE-17] Mit dem Element "Invoice type code" (BT-3) sollen ausschließlich folgende Codes aus der Codeliste UNTDID 1001 übermittelt werden: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice) und 381 (Credit note),875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).</assert>
<assert test="$BR-DE-18" flag="fatal" id="BR-DE-18"
>[BR-DE-18] Die Informationen zur Gewährung von Skonto oder zur Berechnung von Verzugszinsen müssen wie folgt im Element "Payment terms" (BT-20) übermittelt werden: Anzugeben ist im ersten Segment "SKONTO" oder "VERZUG", im zweiten "TAGE=n", im dritten "PROZENT=n". Prozentzahlen sind ohne Vorzeichen sowie mit Punkt getrennt von zwei Nachkommastellen anzugeben. Liegt dem zu berechnenden Betrag nicht BT-115, "fälliger Betrag" zugrunde, sondern nur ein Teil des fälligen Betrags der Rechnung, ist der Grundwert zur Berechnung von Skonto oder Verzugszins als viertes Segment "BASISBETRAG=n" gemäß dem semantischen Datentypen Amount anzugeben. Jeder Eintrag beginnt mit einer #, die Segmente sind mit einer # getrennt und eine Zeile schließt mit einer # ab. Am Ende einer vollständigen Skonto oder Verzugsangabe muss ein XML-konformer Zeilenumbruch folgen. Alle Angaben zur Gewährung von Skonto oder zur Berechnung von Verzugszinsen müssen in Großbuchstaben gemacht werden. Zusätzliches Whitespace (Leerzeichen, Tabulatoren oder Zeilenumbrüche) ist nicht zulässig. Andere Zeichen oder Texte als in den oberen Vorgaben genannt sind nicht zulässig.</assert>
</rule>
<rule context="$BG-2_PROCESS_CONTROL">
<assert test="$BR-DE-21" flag="warning" id="BR-DE-21"
>[BR-DE-21] Das Element "Specification identifier" (BT-24) soll syntaktisch der Kennung des Standards XRechnung entsprechen.</assert>
</rule>
<rule context="$BG-4_SELLER">
<assert test="$BR-DE-02" flag="fatal" id="BR-DE-2"
>[BR-DE-2] Die Gruppe "SELLER CONTACT" (BG-6) muss übermittelt werden.</assert>
</rule>
<rule context="$BG-5_SELLER_POSTAL_ADDRESS">
<assert test="$BR-DE-03" flag="fatal" id="BR-DE-3"
>[BR-DE-3] Das Element "Seller city" (BT-37) muss übermittelt werden.</assert>
<assert test="$BR-DE-04" flag="fatal" id="BR-DE-4"
>[BR-DE-4] Das Element "Seller post code" (BT-38) muss übermittelt werden.</assert>
</rule>
<rule context="$BG-6_SELLER_CONTACT">
<assert test="$BR-DE-05" flag="fatal" id="BR-DE-5"
>[BR-DE-5] Das Element "Seller contact point" (BT-41) muss übermittelt werden.</assert>
<assert test="$BR-DE-06" flag="fatal" id="BR-DE-6"
>[BR-DE-6] Das Element "Seller contact telephone number" (BT-42) muss übermittelt werden.</assert>
<assert test="$BR-DE-07" flag="fatal" id="BR-DE-7"
>[BR-DE-7] Das Element "Seller contact email address" (BT-43) muss übermittelt werden.</assert>
</rule>
<rule context="$BG-8_BUYER_POSTAL_ADDRESS">
<assert test="$BR-DE-08" flag="fatal" id="BR-DE-8"
>[BR-DE-8] Das Element "Buyer city" (BT-52) muss übermittelt werden.</assert>
<assert test="$BR-DE-09" flag="fatal" id="BR-DE-9"
>[BR-DE-9] Das Element "Buyer post code" (BT-53) muss übermittelt werden.</assert>
</rule>
<rule context="$BG-15_DELIVER_TO_ADDRESS">
<assert test="$BR-DE-10" flag="fatal" id="BR-DE-10"
>[BR-DE-10] Das Element "Deliver to city" (BT-77) muss übermittelt werden, wenn die Gruppe "DELIVER TO ADDRESS" (BG-15) übermittelt wird.</assert>
<assert test="$BR-DE-11" flag="fatal" id="BR-DE-11"
>[BR-DE-11] Das Element "Deliver to post code" (BT-78) muss übermittelt werden, wenn die Gruppe "DELIVER TO ADDRESS" (BG-15) übermittelt wird.</assert>
</rule>
<rule context="$BG-16_PAYMENT_INSTRUCTIONS">
<assert test="$BR-DE-19" flag="warning" id="BR-DE-19"
>[BR-DE-19] "Payment account identifier" (BT-84) soll eine korrekte IBAN enthalten, wenn in "Payment means type code" (BT-81) mit dem Code 58 SEPA als Zahlungsmittel gefordert wird.</assert>
<assert test="$BR-DE-20" flag="warning" id="BR-DE-20"
>[BR-DE-20] "Debited account identifier" (BT-91) soll eine korrekte IBAN enthalten, wenn in "Payment means type code" (BT-81) mit dem Code 59 SEPA als Zahlungsmittel gefordert wird.</assert>
</rule>
<rule context="$BG-23_VAT_BREAKDOWN">
<assert test="$BR-DE-14" flag="fatal" id="BR-DE-14"
>[BR-DE-14] Das Element "VAT category rate" (BT-119) muss übermittelt werden.</assert>
</rule>
</pattern>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,637 @@
<?xml version="1.0" encoding="UTF-8"?>
<codedb>
<cl id="1">
<enumeration value="80"/>
<enumeration value="81"/>
<enumeration value="82"/>
<enumeration value="83"/>
<enumeration value="84"/>
<enumeration value="130"/>
<enumeration value="202"/>
<enumeration value="203"/>
<enumeration value="204"/>
<enumeration value="211"/>
<enumeration value="261"/>
<enumeration value="262"/>
<enumeration value="295"/>
<enumeration value="296"/>
<enumeration value="308"/>
<enumeration value="325"/>
<enumeration value="326"/>
<enumeration value="380"/>
<enumeration value="381"/>
<enumeration value="383"/>
<enumeration value="384"/>
<enumeration value="385"/>
<enumeration value="386"/>
<enumeration value="387"/>
<enumeration value="388"/>
<enumeration value="389"/>
<enumeration value="390"/>
<enumeration value="393"/>
<enumeration value="394"/>
<enumeration value="395"/>
<enumeration value="396"/>
<enumeration value="420"/>
<enumeration value="456"/>
<enumeration value="457"/>
<enumeration value="458"/>
<enumeration value="527"/>
<enumeration value="575"/>
<enumeration value="623"/>
<enumeration value="633"/>
<enumeration value="751"/>
<enumeration value="780"/>
<enumeration value="935"/>
</cl>
<cl id="2">
<enumeration value="102"/>
</cl>
<cl id="3">
<enumeration value="0002"/>
<enumeration value="0003"/>
<enumeration value="0004"/>
<enumeration value="0005"/>
<enumeration value="0006"/>
<enumeration value="0007"/>
<enumeration value="0008"/>
<enumeration value="0009"/>
<enumeration value="0010"/>
<enumeration value="0011"/>
<enumeration value="0012"/>
<enumeration value="0013"/>
<enumeration value="0014"/>
<enumeration value="0015"/>
<enumeration value="0016"/>
<enumeration value="0017"/>
<enumeration value="0018"/>
<enumeration value="0019"/>
<enumeration value="0020"/>
<enumeration value="0021"/>
<enumeration value="0022"/>
<enumeration value="0023"/>
<enumeration value="0024"/>
<enumeration value="0025"/>
<enumeration value="0026"/>
<enumeration value="0027"/>
<enumeration value="0028"/>
<enumeration value="0029"/>
<enumeration value="0030"/>
<enumeration value="0031"/>
<enumeration value="0032"/>
<enumeration value="0033"/>
<enumeration value="0034"/>
<enumeration value="0035"/>
<enumeration value="0036"/>
<enumeration value="0037"/>
<enumeration value="0038"/>
<enumeration value="0039"/>
<enumeration value="0040"/>
<enumeration value="0041"/>
<enumeration value="0042"/>
<enumeration value="0043"/>
<enumeration value="0044"/>
<enumeration value="0045"/>
<enumeration value="0046"/>
<enumeration value="0047"/>
<enumeration value="0048"/>
<enumeration value="0049"/>
<enumeration value="0050"/>
<enumeration value="0051"/>
<enumeration value="0052"/>
<enumeration value="0053"/>
<enumeration value="0054"/>
<enumeration value="0055"/>
<enumeration value="0056"/>
<enumeration value="0057"/>
<enumeration value="0058"/>
<enumeration value="0059"/>
<enumeration value="0060"/>
<enumeration value="0061"/>
<enumeration value="0062"/>
<enumeration value="0063"/>
<enumeration value="0064"/>
<enumeration value="0065"/>
<enumeration value="0066"/>
<enumeration value="0067"/>
<enumeration value="0068"/>
<enumeration value="0069"/>
<enumeration value="0070"/>
<enumeration value="0071"/>
<enumeration value="0072"/>
<enumeration value="0073"/>
<enumeration value="0074"/>
<enumeration value="0075"/>
<enumeration value="0076"/>
<enumeration value="0077"/>
<enumeration value="0078"/>
<enumeration value="0079"/>
<enumeration value="0080"/>
<enumeration value="0081"/>
<enumeration value="0082"/>
<enumeration value="0083"/>
<enumeration value="0084"/>
<enumeration value="0085"/>
<enumeration value="0086"/>
<enumeration value="0087"/>
<enumeration value="0088"/>
<enumeration value="0089"/>
<enumeration value="0090"/>
<enumeration value="0091"/>
<enumeration value="0093"/>
<enumeration value="0094"/>
<enumeration value="0095"/>
<enumeration value="0096"/>
<enumeration value="0097"/>
<enumeration value="0098"/>
<enumeration value="0099"/>
<enumeration value="0100"/>
<enumeration value="0101"/>
<enumeration value="0102"/>
<enumeration value="0104"/>
<enumeration value="0105"/>
<enumeration value="0106"/>
<enumeration value="0107"/>
<enumeration value="0108"/>
<enumeration value="0109"/>
<enumeration value="0110"/>
<enumeration value="0111"/>
<enumeration value="0112"/>
<enumeration value="0113"/>
<enumeration value="0114"/>
<enumeration value="0115"/>
<enumeration value="0116"/>
<enumeration value="0117"/>
<enumeration value="0118"/>
<enumeration value="0119"/>
<enumeration value="0120"/>
<enumeration value="0121"/>
<enumeration value="0122"/>
<enumeration value="0123"/>
<enumeration value="0124"/>
<enumeration value="0125"/>
<enumeration value="0126"/>
<enumeration value="0127"/>
<enumeration value="0128"/>
<enumeration value="0129"/>
<enumeration value="0130"/>
<enumeration value="0131"/>
<enumeration value="0132"/>
<enumeration value="0133"/>
<enumeration value="0134"/>
<enumeration value="0135"/>
<enumeration value="0136"/>
<enumeration value="0137"/>
<enumeration value="0138"/>
<enumeration value="0139"/>
<enumeration value="0140"/>
<enumeration value="0141"/>
<enumeration value="0142"/>
<enumeration value="0143"/>
<enumeration value="0144"/>
<enumeration value="0145"/>
<enumeration value="0146"/>
<enumeration value="0147"/>
<enumeration value="0148"/>
<enumeration value="0149"/>
<enumeration value="0150"/>
<enumeration value="0151"/>
<enumeration value="0152"/>
<enumeration value="0153"/>
<enumeration value="0154"/>
<enumeration value="0155"/>
<enumeration value="0156"/>
<enumeration value="0157"/>
<enumeration value="0158"/>
<enumeration value="0159"/>
<enumeration value="0160"/>
<enumeration value="0161"/>
<enumeration value="0162"/>
<enumeration value="0163"/>
<enumeration value="0164"/>
<enumeration value="0165"/>
<enumeration value="0166"/>
<enumeration value="0167"/>
<enumeration value="0168"/>
<enumeration value="0169"/>
<enumeration value="0170"/>
<enumeration value="0171"/>
<enumeration value="0172"/>
<enumeration value="0173"/>
<enumeration value="0174"/>
<enumeration value="0175"/>
<enumeration value="0176"/>
<enumeration value="0177"/>
<enumeration value="0178"/>
<enumeration value="0179"/>
<enumeration value="0180"/>
<enumeration value="0183"/>
<enumeration value="0184"/>
<enumeration value="0185"/>
<enumeration value="0186"/>
<enumeration value="0187"/>
<enumeration value="0188"/>
<enumeration value="0189"/>
<enumeration value="0190"/>
<enumeration value="0191"/>
<enumeration value="0192"/>
<enumeration value="0193"/>
<enumeration value="0194"/>
<enumeration value="0195"/>
<enumeration value="0196"/>
<enumeration value="0197"/>
<enumeration value="0198"/>
<enumeration value="0199"/>
<enumeration value="0200"/>
<enumeration value="0201"/>
<enumeration value="0202"/>
<enumeration value="0203"/>
<enumeration value="0204"/>
</cl>
<cl id="4">
<enumeration value="FC"/>
<enumeration value="VA"/>
</cl>
<cl id="5">
<enumeration value="0002"/>
<enumeration value="0003"/>
<enumeration value="0004"/>
<enumeration value="0005"/>
<enumeration value="0006"/>
<enumeration value="0007"/>
<enumeration value="0008"/>
<enumeration value="0009"/>
<enumeration value="0010"/>
<enumeration value="0011"/>
<enumeration value="0012"/>
<enumeration value="0013"/>
<enumeration value="0014"/>
<enumeration value="0015"/>
<enumeration value="0016"/>
<enumeration value="0017"/>
<enumeration value="0018"/>
<enumeration value="0019"/>
<enumeration value="0020"/>
<enumeration value="0021"/>
<enumeration value="0022"/>
<enumeration value="0023"/>
<enumeration value="0024"/>
<enumeration value="0025"/>
<enumeration value="0026"/>
<enumeration value="0027"/>
<enumeration value="0028"/>
<enumeration value="0029"/>
<enumeration value="0030"/>
<enumeration value="0031"/>
<enumeration value="0032"/>
<enumeration value="0033"/>
<enumeration value="0034"/>
<enumeration value="0035"/>
<enumeration value="0036"/>
<enumeration value="0037"/>
<enumeration value="0038"/>
<enumeration value="0039"/>
<enumeration value="0040"/>
<enumeration value="0041"/>
<enumeration value="0042"/>
<enumeration value="0043"/>
<enumeration value="0044"/>
<enumeration value="0045"/>
<enumeration value="0046"/>
<enumeration value="0047"/>
<enumeration value="0048"/>
<enumeration value="0049"/>
<enumeration value="0050"/>
<enumeration value="0051"/>
<enumeration value="0052"/>
<enumeration value="0053"/>
<enumeration value="0054"/>
<enumeration value="0055"/>
<enumeration value="0056"/>
<enumeration value="0057"/>
<enumeration value="0058"/>
<enumeration value="0059"/>
<enumeration value="0060"/>
<enumeration value="0061"/>
<enumeration value="0062"/>
<enumeration value="0063"/>
<enumeration value="0064"/>
<enumeration value="0065"/>
<enumeration value="0066"/>
<enumeration value="0067"/>
<enumeration value="0068"/>
<enumeration value="0069"/>
<enumeration value="0070"/>
<enumeration value="0071"/>
<enumeration value="0072"/>
<enumeration value="0073"/>
<enumeration value="0074"/>
<enumeration value="0075"/>
<enumeration value="0076"/>
<enumeration value="0077"/>
<enumeration value="0078"/>
<enumeration value="0079"/>
<enumeration value="0080"/>
<enumeration value="0081"/>
<enumeration value="0082"/>
<enumeration value="0083"/>
<enumeration value="0084"/>
<enumeration value="0085"/>
<enumeration value="0086"/>
<enumeration value="0087"/>
<enumeration value="0088"/>
<enumeration value="0089"/>
<enumeration value="0090"/>
<enumeration value="0091"/>
<enumeration value="0093"/>
<enumeration value="0094"/>
<enumeration value="0095"/>
<enumeration value="0096"/>
<enumeration value="0097"/>
<enumeration value="0098"/>
<enumeration value="0099"/>
<enumeration value="0100"/>
<enumeration value="0101"/>
<enumeration value="0102"/>
<enumeration value="0104"/>
<enumeration value="0105"/>
<enumeration value="0106"/>
<enumeration value="0107"/>
<enumeration value="0108"/>
<enumeration value="0109"/>
<enumeration value="0110"/>
<enumeration value="0111"/>
<enumeration value="0112"/>
<enumeration value="0113"/>
<enumeration value="0114"/>
<enumeration value="0115"/>
<enumeration value="0116"/>
<enumeration value="0117"/>
<enumeration value="0118"/>
<enumeration value="0119"/>
<enumeration value="0120"/>
<enumeration value="0121"/>
<enumeration value="0122"/>
<enumeration value="0123"/>
<enumeration value="0124"/>
<enumeration value="0125"/>
<enumeration value="0126"/>
<enumeration value="0127"/>
<enumeration value="0128"/>
<enumeration value="0129"/>
<enumeration value="0130"/>
<enumeration value="0131"/>
<enumeration value="0132"/>
<enumeration value="0133"/>
<enumeration value="0134"/>
<enumeration value="0135"/>
<enumeration value="0136"/>
<enumeration value="0137"/>
<enumeration value="0138"/>
<enumeration value="0139"/>
<enumeration value="0140"/>
<enumeration value="0141"/>
<enumeration value="0142"/>
<enumeration value="0143"/>
<enumeration value="0144"/>
<enumeration value="0145"/>
<enumeration value="0146"/>
<enumeration value="0147"/>
<enumeration value="0148"/>
<enumeration value="0149"/>
<enumeration value="0150"/>
<enumeration value="0151"/>
<enumeration value="0152"/>
<enumeration value="0153"/>
<enumeration value="0154"/>
<enumeration value="0155"/>
<enumeration value="0156"/>
<enumeration value="0157"/>
<enumeration value="0158"/>
<enumeration value="0159"/>
<enumeration value="0160"/>
<enumeration value="0161"/>
<enumeration value="0162"/>
<enumeration value="0163"/>
<enumeration value="0164"/>
<enumeration value="0165"/>
<enumeration value="0166"/>
<enumeration value="0167"/>
<enumeration value="0168"/>
<enumeration value="0169"/>
<enumeration value="0170"/>
<enumeration value="0171"/>
<enumeration value="0172"/>
<enumeration value="0173"/>
<enumeration value="0174"/>
<enumeration value="0175"/>
<enumeration value="0176"/>
<enumeration value="0177"/>
<enumeration value="0178"/>
<enumeration value="0179"/>
<enumeration value="0180"/>
<enumeration value="0183"/>
<enumeration value="0184"/>
<enumeration value="0185"/>
<enumeration value="0186"/>
<enumeration value="0187"/>
<enumeration value="0188"/>
<enumeration value="0189"/>
<enumeration value="0190"/>
<enumeration value="0191"/>
<enumeration value="0192"/>
<enumeration value="0193"/>
<enumeration value="0194"/>
<enumeration value="0195"/>
<enumeration value="0196"/>
<enumeration value="0197"/>
<enumeration value="0198"/>
<enumeration value="0199"/>
<enumeration value="0200"/>
<enumeration value="0201"/>
<enumeration value="0202"/>
<enumeration value="0203"/>
<enumeration value="0204"/>
</cl>
<cl id="6">
<enumeration value="AED"/>
<enumeration value="AFN"/>
<enumeration value="ALL"/>
<enumeration value="AMD"/>
<enumeration value="ANG"/>
<enumeration value="AOA"/>
<enumeration value="ARS"/>
<enumeration value="AUD"/>
<enumeration value="AWG"/>
<enumeration value="AZN"/>
<enumeration value="BAM"/>
<enumeration value="BBD"/>
<enumeration value="BDT"/>
<enumeration value="BGN"/>
<enumeration value="BHD"/>
<enumeration value="BIF"/>
<enumeration value="BMD"/>
<enumeration value="BND"/>
<enumeration value="BOB"/>
<enumeration value="BOV"/>
<enumeration value="BRL"/>
<enumeration value="BSD"/>
<enumeration value="BTN"/>
<enumeration value="BWP"/>
<enumeration value="BYN"/>
<enumeration value="BZD"/>
<enumeration value="CAD"/>
<enumeration value="CDF"/>
<enumeration value="CHE"/>
<enumeration value="CHF"/>
<enumeration value="CHW"/>
<enumeration value="CLF"/>
<enumeration value="CLP"/>
<enumeration value="CNY"/>
<enumeration value="COP"/>
<enumeration value="COU"/>
<enumeration value="CRC"/>
<enumeration value="CUC"/>
<enumeration value="CUP"/>
<enumeration value="CVE"/>
<enumeration value="CZK"/>
<enumeration value="DJF"/>
<enumeration value="DKK"/>
<enumeration value="DOP"/>
<enumeration value="DZD"/>
<enumeration value="EGP"/>
<enumeration value="ERN"/>
<enumeration value="ETB"/>
<enumeration value="EUR"/>
<enumeration value="FJD"/>
<enumeration value="FKP"/>
<enumeration value="GBP"/>
<enumeration value="GEL"/>
<enumeration value="GHS"/>
<enumeration value="GIP"/>
<enumeration value="GMD"/>
<enumeration value="GNF"/>
<enumeration value="GTQ"/>
<enumeration value="GYD"/>
<enumeration value="HKD"/>
<enumeration value="HNL"/>
<enumeration value="HRK"/>
<enumeration value="HTG"/>
<enumeration value="HUF"/>
<enumeration value="IDR"/>
<enumeration value="ILS"/>
<enumeration value="INR"/>
<enumeration value="IQD"/>
<enumeration value="IRR"/>
<enumeration value="ISK"/>
<enumeration value="JMD"/>
<enumeration value="JOD"/>
<enumeration value="JPY"/>
<enumeration value="KES"/>
<enumeration value="KGS"/>
<enumeration value="KHR"/>
<enumeration value="KMF"/>
<enumeration value="KPW"/>
<enumeration value="KRW"/>
<enumeration value="KWD"/>
<enumeration value="KYD"/>
<enumeration value="KZT"/>
<enumeration value="LAK"/>
<enumeration value="LBP"/>
<enumeration value="LKR"/>
<enumeration value="LRD"/>
<enumeration value="LSL"/>
<enumeration value="LYD"/>
<enumeration value="MAD"/>
<enumeration value="MDL"/>
<enumeration value="MGA"/>
<enumeration value="MKD"/>
<enumeration value="MMK"/>
<enumeration value="MNT"/>
<enumeration value="MOP"/>
<enumeration value="MRU"/>
<enumeration value="MUR"/>
<enumeration value="MVR"/>
<enumeration value="MWK"/>
<enumeration value="MXN"/>
<enumeration value="MXV"/>
<enumeration value="MYR"/>
<enumeration value="MZN"/>
<enumeration value="NAD"/>
<enumeration value="NGN"/>
<enumeration value="NIO"/>
<enumeration value="NOK"/>
<enumeration value="NPR"/>
<enumeration value="NZD"/>
<enumeration value="OMR"/>
<enumeration value="PAB"/>
<enumeration value="PEN"/>
<enumeration value="PGK"/>
<enumeration value="PHP"/>
<enumeration value="PKR"/>
<enumeration value="PLN"/>
<enumeration value="PYG"/>
<enumeration value="QAR"/>
<enumeration value="RON"/>
<enumeration value="RSD"/>
<enumeration value="RUB"/>
<enumeration value="RWF"/>
<enumeration value="SAR"/>
<enumeration value="SBD"/>
<enumeration value="SCR"/>
<enumeration value="SDG"/>
<enumeration value="SEK"/>
<enumeration value="SGD"/>
<enumeration value="SHP"/>
<enumeration value="SLL"/>
<enumeration value="SOS"/>
<enumeration value="SRD"/>
<enumeration value="SSP"/>
<enumeration value="STN"/>
<enumeration value="SVC"/>
<enumeration value="SYP"/>
<enumeration value="SZL"/>
<enumeration value="THB"/>
<enumeration value="TJS"/>
<enumeration value="TMT"/>
<enumeration value="TND"/>
<enumeration value="TOP"/>
<enumeration value="TRY"/>
<enumeration value="TTD"/>
<enumeration value="TWD"/>
<enumeration value="TZS"/>
<enumeration value="UAH"/>
<enumeration value="UGX"/>
<enumeration value="USD"/>
<enumeration value="USN"/>
<enumeration value="UYI"/>
<enumeration value="UYU"/>
<enumeration value="UYW"/>
<enumeration value="UZS"/>
<enumeration value="VES"/>
<enumeration value="VND"/>
<enumeration value="VUV"/>
<enumeration value="WST"/>
<enumeration value="XAF"/>
<enumeration value="XAG"/>
<enumeration value="XAU"/>
<enumeration value="XBA"/>
<enumeration value="XBB"/>
<enumeration value="XBC"/>
<enumeration value="XBD"/>
<enumeration value="XCD"/>
<enumeration value="XDR"/>
<enumeration value="XOF"/>
<enumeration value="XPD"/>
<enumeration value="XPF"/>
<enumeration value="XPT"/>
<enumeration value="XSU"/>
<enumeration value="XTS"/>
<enumeration value="XUA"/>
<enumeration value="XXX"/>
<enumeration value="YER"/>
<enumeration value="ZAR"/>
<enumeration value="ZMW"/>
<enumeration value="ZWL"/>
</cl>
</codedb>

View File

@@ -0,0 +1,544 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsl:stylesheet xmlns:svrl="http://purl.oclc.org/dsdl/svrl" xmlns:ccts="urn:un:unece:uncefact:documentation:standard:CoreComponentsTechnicalSpecification:2" xmlns:iso="http://purl.oclc.org/dsdl/schematron" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:saxon="http://saxon.sf.net/" xmlns:schold="http://www.ascc.net/xml/schematron" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<!--Implementers: please note that overriding process-prolog or process-root is
the preferred method for meta-stylesheets to use where possible. -->
<xsl:param name="archiveDirParameter" />
<xsl:param name="archiveNameParameter" />
<xsl:param name="fileNameParameter" />
<xsl:param name="fileDirParameter" />
<xsl:variable name="document-uri">
<xsl:value-of select="document-uri(/)" />
</xsl:variable>
<!--PHASES-->
<!--PROLOG-->
<xsl:output indent="yes" method="xml" omit-xml-declaration="no" standalone="yes" />
<!--XSD TYPES FOR XSLT2-->
<!--KEYS AND FUNCTIONS-->
<!--DEFAULT RULES-->
<!--MODE: SCHEMATRON-SELECT-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-select-full-path">
<xsl:apply-templates mode="schematron-get-full-path" select="." />
</xsl:template>
<!--MODE: SCHEMATRON-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-get-full-path">
<xsl:apply-templates mode="schematron-get-full-path" select="parent::*" />
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="namespace-uri()=''">
<xsl:value-of select="name()" />
</xsl:when>
<xsl:otherwise>
<xsl:text>*:</xsl:text>
<xsl:value-of select="local-name()" />
<xsl:text>[namespace-uri()='</xsl:text>
<xsl:value-of select="namespace-uri()" />
<xsl:text>']</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="preceding" select="count(preceding-sibling::*[local-name()=local-name(current()) and namespace-uri() = namespace-uri(current())])" />
<xsl:text>[</xsl:text>
<xsl:value-of select="1+ $preceding" />
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="@*" mode="schematron-get-full-path">
<xsl:apply-templates mode="schematron-get-full-path" select="parent::*" />
<xsl:text>/</xsl:text>
<xsl:choose>
<xsl:when test="namespace-uri()=''">@<xsl:value-of select="name()" />
</xsl:when>
<xsl:otherwise>
<xsl:text>@*[local-name()='</xsl:text>
<xsl:value-of select="local-name()" />
<xsl:text>' and namespace-uri()='</xsl:text>
<xsl:value-of select="namespace-uri()" />
<xsl:text>']</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--MODE: SCHEMATRON-FULL-PATH-2-->
<!--This mode can be used to generate prefixed XPath for humans-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-2">
<xsl:for-each select="ancestor-or-self::*">
<xsl:text>/</xsl:text>
<xsl:value-of select="name(.)" />
<xsl:if test="preceding-sibling::*[name(.)=name(current())]">
<xsl:text>[</xsl:text>
<xsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1" />
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="not(self::*)">
<xsl:text />/@<xsl:value-of select="name(.)" />
</xsl:if>
</xsl:template>
<!--MODE: SCHEMATRON-FULL-PATH-3-->
<!--This mode can be used to generate prefixed XPath for humans
(Top-level element has index)-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-3">
<xsl:for-each select="ancestor-or-self::*">
<xsl:text>/</xsl:text>
<xsl:value-of select="name(.)" />
<xsl:if test="parent::*">
<xsl:text>[</xsl:text>
<xsl:value-of select="count(preceding-sibling::*[name(.)=name(current())])+1" />
<xsl:text>]</xsl:text>
</xsl:if>
</xsl:for-each>
<xsl:if test="not(self::*)">
<xsl:text />/@<xsl:value-of select="name(.)" />
</xsl:if>
</xsl:template>
<!--MODE: GENERATE-ID-FROM-PATH -->
<xsl:template match="/" mode="generate-id-from-path" />
<xsl:template match="text()" mode="generate-id-from-path">
<xsl:apply-templates mode="generate-id-from-path" select="parent::*" />
<xsl:value-of select="concat('.text-', 1+count(preceding-sibling::text()), '-')" />
</xsl:template>
<xsl:template match="comment()" mode="generate-id-from-path">
<xsl:apply-templates mode="generate-id-from-path" select="parent::*" />
<xsl:value-of select="concat('.comment-', 1+count(preceding-sibling::comment()), '-')" />
</xsl:template>
<xsl:template match="processing-instruction()" mode="generate-id-from-path">
<xsl:apply-templates mode="generate-id-from-path" select="parent::*" />
<xsl:value-of select="concat('.processing-instruction-', 1+count(preceding-sibling::processing-instruction()), '-')" />
</xsl:template>
<xsl:template match="@*" mode="generate-id-from-path">
<xsl:apply-templates mode="generate-id-from-path" select="parent::*" />
<xsl:value-of select="concat('.@', name())" />
</xsl:template>
<xsl:template match="*" mode="generate-id-from-path" priority="-0.5">
<xsl:apply-templates mode="generate-id-from-path" select="parent::*" />
<xsl:text>.</xsl:text>
<xsl:value-of select="concat('.',name(),'-',1+count(preceding-sibling::*[name()=name(current())]),'-')" />
</xsl:template>
<!--MODE: GENERATE-ID-2 -->
<xsl:template match="/" mode="generate-id-2">U</xsl:template>
<xsl:template match="*" mode="generate-id-2" priority="2">
<xsl:text>U</xsl:text>
<xsl:number count="*" level="multiple" />
</xsl:template>
<xsl:template match="node()" mode="generate-id-2">
<xsl:text>U.</xsl:text>
<xsl:number count="*" level="multiple" />
<xsl:text>n</xsl:text>
<xsl:number count="node()" />
</xsl:template>
<xsl:template match="@*" mode="generate-id-2">
<xsl:text>U.</xsl:text>
<xsl:number count="*" level="multiple" />
<xsl:text>_</xsl:text>
<xsl:value-of select="string-length(local-name(.))" />
<xsl:text>_</xsl:text>
<xsl:value-of select="translate(name(),':','.')" />
</xsl:template>
<!--Strip characters--> <xsl:template match="text()" priority="-1" />
<!--SCHEMA SETUP-->
<xsl:template match="/">
<svrl:schematron-output schemaVersion="2.0.0" title="Schematron Version 1.3.0 - XRechnung&#xA; 1.2.2 compatible - CII">
<xsl:comment>
<xsl:value-of select="$archiveDirParameter" />  
<xsl:value-of select="$archiveNameParameter" />  
<xsl:value-of select="$fileNameParameter" />  
<xsl:value-of select="$fileDirParameter" />
</xsl:comment>
<svrl:ns-prefix-in-attribute-values prefix="rsm" uri="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" />
<svrl:ns-prefix-in-attribute-values prefix="ccts" uri="urn:un:unece:uncefact:documentation:standard:CoreComponentsTechnicalSpecification:2" />
<svrl:ns-prefix-in-attribute-values prefix="udt" uri="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" />
<svrl:ns-prefix-in-attribute-values prefix="qdt" uri="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" />
<svrl:ns-prefix-in-attribute-values prefix="ram" uri="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" />
<svrl:active-pattern>
<xsl:attribute name="document">
<xsl:value-of select="document-uri(/)" />
</xsl:attribute>
<xsl:attribute name="id">CII-model</xsl:attribute>
<xsl:attribute name="name">CII-model</xsl:attribute>
<xsl:apply-templates />
</svrl:active-pattern>
<xsl:apply-templates mode="M7" select="/" />
</svrl:schematron-output>
</xsl:template>
<!--SCHEMATRON PATTERNS-->
<svrl:text>Schematron Version 1.3.0 - XRechnung
1.2.2 compatible - CII</svrl:text>
<!--PATTERN CII-model-->
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice" mode="M7" priority="1008">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans" />
<xsl:otherwise>
<svrl:failed-assert test="rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans">
<xsl:attribute name="id">BR-DE-1</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-1] Eine Rechnung (INVOICE) muss Angaben zu "PAYMENT INSTRUCTIONS" (BG-16) enthalten.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="count((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayeePartyCreditorFinancialAccount)[1]) + count(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:ApplicableTradeSettlementFinancialCard) + count((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID, rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:CreditorReferenceID, rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayerPartyDebtorFinancialAccount/ram:IBANID)[1]) = 1" />
<xsl:otherwise>
<svrl:failed-assert test="count((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayeePartyCreditorFinancialAccount)[1]) + count(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:ApplicableTradeSettlementFinancialCard) + count((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:DirectDebitMandateID, rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:CreditorReferenceID, rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans/ram:PayerPartyDebtorFinancialAccount/ram:IBANID)[1]) = 1">
<xsl:attribute name="id">BR-DE-13</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-13] In der Rechnung müssen Angaben zu genau einer der drei Gruppen "CREDIT TRANSFER" (BG-17), "PAYMENT CARD INFORMATION" (BG-18) oder "DIRECT DEBIT" (BG-19) übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerReference[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerReference[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-15</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-15] Das Element "Buyer reference" (BT-10) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID='VA' or @schemeID='VAT' or @schemeID='FC'][boolean(normalize-space(.))], rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty)" />
<xsl:otherwise>
<svrl:failed-assert test="(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[@schemeID='VA' or @schemeID='VAT' or @schemeID='FC'][boolean(normalize-space(.))], rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty)">
<xsl:attribute name="id">BR-DE-16</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-16] In der Rechnung muss mindestens eines der Elemente "Seller VAT identifier" (BT-31), "Seller tax registration identifier" (BT-32) oder "SELLER TAX REPRESENTATIVE PARTY" (BG-11) übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="rsm:ExchangedDocument/ram:TypeCode = ('326', '380', '384', '389', '381', '875', '876', '877')" />
<xsl:otherwise>
<svrl:failed-assert test="rsm:ExchangedDocument/ram:TypeCode = ('326', '380', '384', '389', '381', '875', '876', '877')">
<xsl:attribute name="id">BR-DE-17</xsl:attribute>
<xsl:attribute name="flag">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-17] Mit dem Element "Invoice type code" (BT-3) sollen ausschließlich folgende Codes aus der Codeliste UNTDID 1001 übermittelt werden: 326 (Partial invoice), 380 (Commercial invoice), 384 (Corrected invoice), 389 (Self-billed invoice) und 381 (Credit note),875 (Partial construction invoice), 876 (Partial final construction invoice), 877 (Final construction invoice).</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="every $line in rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:Description/tokenize(.,'(\r\n|\r|\n)') satisfies if(count(tokenize($line,'#')) > 1) then tokenize($line,'#')[1]='' and (tokenize($line,'#')[2]='SKONTO' or tokenize($line,'#')[2]='VERZUG') and string-length(replace(tokenize($line,'#')[3],'TAGE=[0-9]+',''))=0 and string-length(replace(tokenize($line,'#')[4],'PROZENT=[0-9]+\.[0-9]{2}',''))=0 and (tokenize($line,'#')[5]='' and empty(tokenize($line,'#')[6]) or string-length(replace(tokenize($line,'#')[5],'BASISBETRAG=[0-9]+\.[0-9]{2}',''))=0 and tokenize($line,'#')[6]='' and empty(tokenize($line,'#')[7])) else true()" />
<xsl:otherwise>
<svrl:failed-assert test="every $line in rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradePaymentTerms/ram:Description/tokenize(.,'(\r\n|\r|\n)') satisfies if(count(tokenize($line,'#')) > 1) then tokenize($line,'#')[1]='' and (tokenize($line,'#')[2]='SKONTO' or tokenize($line,'#')[2]='VERZUG') and string-length(replace(tokenize($line,'#')[3],'TAGE=[0-9]+',''))=0 and string-length(replace(tokenize($line,'#')[4],'PROZENT=[0-9]+\.[0-9]{2}',''))=0 and (tokenize($line,'#')[5]='' and empty(tokenize($line,'#')[6]) or string-length(replace(tokenize($line,'#')[5],'BASISBETRAG=[0-9]+\.[0-9]{2}',''))=0 and tokenize($line,'#')[6]='' and empty(tokenize($line,'#')[7])) else true()">
<xsl:attribute name="id">BR-DE-18</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-18] Die Informationen zur Gewährung von Skonto oder zur Berechnung von Verzugszinsen müssen wie folgt im Element "Payment terms" (BT-20) übermittelt werden: Anzugeben ist im ersten Segment "SKONTO" oder "VERZUG", im zweiten "TAGE=n", im dritten "PROZENT=n". Prozentzahlen sind ohne Vorzeichen sowie mit Punkt getrennt von zwei Nachkommastellen anzugeben. Liegt dem zu berechnenden Betrag nicht BT-115, "fälliger Betrag" zugrunde, sondern nur ein Teil des fälligen Betrags der Rechnung, ist der Grundwert zur Berechnung von Skonto oder Verzugszins als viertes Segment "BASISBETRAG=n" gemäß dem semantischen Datentypen Amount anzugeben. Jeder Eintrag beginnt mit einer #, die Segmente sind mit einer # getrennt und eine Zeile schließt mit einer # ab. Am Ende einer vollständigen Skonto oder Verzugsangabe muss ein XML-konformer Zeilenumbruch folgen. Alle Angaben zur Gewährung von Skonto oder zur Berechnung von Verzugszinsen müssen in Großbuchstaben gemacht werden. Zusätzliches Whitespace (Leerzeichen, Tabulatoren oder Zeilenumbrüche) ist nicht zulässig. Andere Zeichen oder Texte als in den oberen Vorgaben genannt sind nicht zulässig.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext" mode="M7" priority="1007">
<svrl:fired-rule context="/rsm:CrossIndustryInvoice/rsm:ExchangedDocumentContext" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2'" />
<xsl:otherwise>
<svrl:failed-assert test="ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = 'urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2'">
<xsl:attribute name="id">BR-DE-21</xsl:attribute>
<xsl:attribute name="flag">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-21] Das Element "Specification identifier" (BT-24) soll syntaktisch der Kennung des Standards XRechnung entsprechen.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty" mode="M7" priority="1006">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:DefinedTradeContact" />
<xsl:otherwise>
<svrl:failed-assert test="ram:DefinedTradeContact">
<xsl:attribute name="id">BR-DE-2</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-2] Die Gruppe "SELLER CONTACT" (BG-6) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:PostalTradeAddress" mode="M7" priority="1005">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:PostalTradeAddress" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:CityName[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:CityName[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-3</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-3] Das Element "Seller city" (BT-37) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:PostcodeCode[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:PostcodeCode[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-4</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-4] Das Element "Seller post code" (BT-38) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact" mode="M7" priority="1004">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:DefinedTradeContact" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="(ram:PersonName,ram:DepartmentName)[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="(ram:PersonName,ram:DepartmentName)[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-5</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-5] Das Element "Seller contact point" (BT-41) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:TelephoneUniversalCommunication/ram:CompleteNumber[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:TelephoneUniversalCommunication/ram:CompleteNumber[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-6</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-6] Das Element "Seller contact telephone number" (BT-42) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:EmailURIUniversalCommunication/ram:URIID[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:EmailURIUniversalCommunication/ram:URIID[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-7</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-7] Das Element "Seller contact email address" (BT-43) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:PostalTradeAddress" mode="M7" priority="1003">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:PostalTradeAddress" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:CityName[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:CityName[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-8</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-8] Das Element "Buyer city" (BT-52) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:PostcodeCode[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:PostcodeCode[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-9</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-9] Das Element "Buyer post code" (BT-53) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty/ram:PostalTradeAddress" mode="M7" priority="1002">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeDelivery/ram:ShipToTradeParty/ram:PostalTradeAddress" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:CityName[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:CityName[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-10</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-10] Das Element "Deliver to city" (BT-77) muss übermittelt werden, wenn die Gruppe "DELIVER TO ADDRESS" (BG-15) übermittelt wird.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:PostcodeCode[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:PostcodeCode[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-11</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-11] Das Element "Deliver to post code" (BT-78) muss übermittelt werden, wenn die Gruppe "DELIVER TO ADDRESS" (BG-15) übermittelt wird.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans" mode="M7" priority="1001">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test=" not(ram:TypeCode = '58') or matches(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer( replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( upper-case(concat(substring(ram:PayeePartyCreditorFinancialAccount/ram:IBANID,5),substring(ram:PayeePartyCreditorFinancialAccount/ram:IBANID,1,4))) ,'A','10'),'B','11'),'C','12'),'D','13'),'E','14'),'F','15'),'G','16'),'H','17'),'I','18'),'J','19'),'K','20'),'L','21'),'M','22') ,'N','23'),'O','24'),'P','25'),'Q','26'),'R','27'),'S','28'),'T','29'),'U','30'),'V','31'),'W','32'),'X','33'),'Y','34'),'Z','35') ) mod 97 = 1 " />
<xsl:otherwise>
<svrl:failed-assert test="not(ram:TypeCode = '58') or matches(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer( replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( upper-case(concat(substring(ram:PayeePartyCreditorFinancialAccount/ram:IBANID,5),substring(ram:PayeePartyCreditorFinancialAccount/ram:IBANID,1,4))) ,'A','10'),'B','11'),'C','12'),'D','13'),'E','14'),'F','15'),'G','16'),'H','17'),'I','18'),'J','19'),'K','20'),'L','21'),'M','22') ,'N','23'),'O','24'),'P','25'),'Q','26'),'R','27'),'S','28'),'T','29'),'U','30'),'V','31'),'W','32'),'X','33'),'Y','34'),'Z','35') ) mod 97 = 1">
<xsl:attribute name="id">BR-DE-19</xsl:attribute>
<xsl:attribute name="flag">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-19] "Payment account identifier" (BT-84) soll eine korrekte IBAN enthalten, wenn in "Payment means type code" (BT-81) mit dem Code 58 SEPA als Zahlungsmittel gefordert wird.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<!--ASSERT -->
<xsl:choose>
<xsl:when test=" not(ram:TypeCode = '59') or matches(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer( replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( upper-case(concat(substring(ram:PayerPartyDebtorFinancialAccount/ram:IBANID,5),substring(ram:PayerPartyDebtorFinancialAccount/ram:IBANID,1,4))) ,'A','10'),'B','11'),'C','12'),'D','13'),'E','14'),'F','15'),'G','16'),'H','17'),'I','18'),'J','19'),'K','20'),'L','21'),'M','22') ,'N','23'),'O','24'),'P','25'),'Q','26'),'R','27'),'S','28'),'T','29'),'U','30'),'V','31'),'W','32'),'X','33'),'Y','34'),'Z','35') ) mod 97 = 1" />
<xsl:otherwise>
<svrl:failed-assert test="not(ram:TypeCode = '59') or matches(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer( replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace( upper-case(concat(substring(ram:PayerPartyDebtorFinancialAccount/ram:IBANID,5),substring(ram:PayerPartyDebtorFinancialAccount/ram:IBANID,1,4))) ,'A','10'),'B','11'),'C','12'),'D','13'),'E','14'),'F','15'),'G','16'),'H','17'),'I','18'),'J','19'),'K','20'),'L','21'),'M','22') ,'N','23'),'O','24'),'P','25'),'Q','26'),'R','27'),'S','28'),'T','29'),'U','30'),'V','31'),'W','32'),'X','33'),'Y','34'),'Z','35') ) mod 97 = 1">
<xsl:attribute name="id">BR-DE-20</xsl:attribute>
<xsl:attribute name="flag">warning</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-20] "Debited account identifier" (BT-91) soll eine korrekte IBAN enthalten, wenn in "Payment means type code" (BT-81) mit dem Code 59 SEPA als Zahlungsmittel gefordert wird.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<!--RULE -->
<xsl:template match="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax" mode="M7" priority="1000">
<svrl:fired-rule context="//rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax" />
<!--ASSERT -->
<xsl:choose>
<xsl:when test="ram:RateApplicablePercent[boolean(normalize-space(.))]" />
<xsl:otherwise>
<svrl:failed-assert test="ram:RateApplicablePercent[boolean(normalize-space(.))]">
<xsl:attribute name="id">BR-DE-14</xsl:attribute>
<xsl:attribute name="flag">fatal</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates mode="schematron-select-full-path" select="." />
</xsl:attribute>
<svrl:text>[BR-DE-14] Das Element "VAT category rate" (BT-119) muss übermittelt werden.</svrl:text>
</svrl:failed-assert>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
<xsl:template match="text()" mode="M7" priority="-1" />
<xsl:template match="@*|node()" mode="M7" priority="-2">
<xsl:apply-templates mode="M7" select="*|comment()|processing-instruction()" />
</xsl:template>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
package org.mustangproject.library.extended;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class MiscValidatorTest extends ResourceCase {
public void testInvalidFileValidation() {
ZUGFeRDValidator zfv=new ZUGFeRDValidator();
String res=zfv.validate(null);
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\"\" datetime=\".*?\">\n" +
" <messages>\n" +
" <error type=\"10\">Filename not specified</error> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n" +
""));
res=zfv.validate("/dhfkbv/sfjkh");
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\"sfjkh\" datetime=\".*?\">\n" +
" <messages>\n" +
" <error type=\"1\">File not found</error> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n"));
boolean noExceptionOccurred=true;
File tempFile=null;
try {
tempFile = File.createTempFile("hello", ".tmp");
} catch (IOException e) {
noExceptionOccurred=true;
}
assertTrue(noExceptionOccurred);
res=zfv.validate(tempFile.getAbsolutePath());
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\".*\" datetime=\".*\">\n" +
" <messages>\n" +
" <error type=\"5\">File too small</error> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n" +
""));
String fileContent = "ladhvkdbfk wkhfbkhdhkb svbkfsvbksfbvk sdvsdvbksjdvbkfdsv sdvbskdvbsjhkvbfskh dvbskfvbkfsbvke"
+ "ladhvkdbfk wkhfbkhdhkb svbkfsvbksfbvk sdvsdvbksjdvbkfdsv sdvbskdvbsjhkvbfskh dvbskfvbkfsbvke";
noExceptionOccurred=true;
BufferedWriter writer;
try {
writer = new BufferedWriter(new FileWriter(tempFile));
writer.write(fileContent);
writer.close();
} catch (IOException e) {
noExceptionOccurred=false;
}
assertTrue(noExceptionOccurred);
res=zfv.validate(tempFile.getAbsolutePath());
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\".*\" datetime=\".*\">\n" +
" <messages>\n" +
" <exception type=\"8\">File does not look like PDF nor XML \\(contains neither %PDF nor &lt;\\?xml\\)</exception> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n" +
""));
// clean up
tempFile.delete();
}
}

View File

@@ -0,0 +1,139 @@
package org.mustangproject.library.extended;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PDFValidatorTest extends ResourceCase {
private static final Logger LOGGER = LoggerFactory.getLogger(ZUGFeRDValidator.class.getCanonicalName()); // log
public void testPDFValidation() {
ValidationContext vc = new ValidationContext(null);
PDFValidator pv = new PDFValidator(vc);
try {
File tempFile = getResourceAsFile("XMLinvalidV2PDF.pdf");// need a more invalid file here
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
// assertEquals("", pv.getXMLResult());
//
tempFile = getResourceAsFile("Facture_F20180027.pdf");
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
String actual = pv.getXMLResult();
assertEquals(true, actual.contains("summary status='valid"));
assertEquals(false, actual.contains("summary status='invalid"));
XMLValidator xv = new XMLValidator(vc);
xv.setStringContent(pv.getRawXML());
xv.validate();
actual = vc.getXMLResult();
assertEquals(true, actual.contains("validationReport profileName=\"PDF/A-3"));
assertEquals(true, actual.contains("batchSummary totalJobs=\"1\" failedToParse=\"0\" encrypted=\"0\""));
assertEquals(true,
actual.contains("validationReports compliant=\"1\" nonCompliant=\"0\" failedJobs=\"0\">"));
// test some xml
// assertEquals(true, actual.contains("<error
// location=\"/*:CrossIndustryInvoice[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:SupplyChainTradeTransaction[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:ApplicableHeaderTradeSettlement[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:SpecifiedTradeSettlementHeaderMonetarySummation[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:DuePayableAmount[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]\"
// criterion=\"not(@currencyID)\">[CII-DT-031] - currencyID should not be
// present</error>"));
// test some binary signature recognition
assertEquals(true, actual.contains("<version>2</version>"));
// valid one
tempFile = getResourceAsFile("validV2PDF.pdf");
pv.setFilename(tempFile.getAbsolutePath());
vc.clear();
pv.validate();
actual = pv.getXMLResult();
assertEquals(true, actual.contains("validationReport profileName=\"PDF/A-3"));
assertEquals(true, actual.contains("batchSummary totalJobs=\"1\" failedToParse=\"0\" encrypted=\"0\""));
assertEquals(true,
actual.contains("validationReports compliant=\"1\" nonCompliant=\"0\" failedJobs=\"0\">"));
assertEquals(false, actual.contains("<error"));
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
public void testPDFXMLValidation() {
ValidationContext vc = new ValidationContext(null);
try {
PDFValidator pv = new PDFValidator(vc);
File tempFile = getResourceAsFile("attributeBasedXMP_zugferd_2p0_EN16931_Einfach.pdf");// need a more
// invalid file here
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
String pdfvres = pv.getXMLResult();
XMLValidator xv = new XMLValidator(vc);
xv.setStringContent(pv.getRawXML());
xv.validate();
String xmlvres = xv.getXMLResult();
assertEquals(true, pdfvres.contains("valid") && !pdfvres.contains("invalid"));
assertEquals(true, xmlvres.contains("invalid"));
vc.clear();
tempFile = getResourceAsFile("validV1WithAdditionalData.pdf");// need a more invalid file here
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
pdfvres = pv.getXMLResult();
xv = new XMLValidator(vc);
xv.setStringContent(pv.getRawXML());
xv.validate();
xmlvres = xv.getXMLResult();
assertEquals(true, pdfvres.contains("valid") && !pdfvres.contains("invalid"));
assertEquals(true, xmlvres.contains("valid") && !xmlvres.contains("invalid"));
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
public void testXMPValidation() {
ValidationContext vc = new ValidationContext(null);
PDFValidator pv = new PDFValidator(vc);
try {
File tempFile = getResourceAsFile("invalidXMP.pdf");
pv.setFilename(tempFile.getAbsolutePath());
vc.clear();
pv.validate();
String actual = pv.getXMLResult();
assertEquals(true, actual
.contains("<error type=\"12\">XMP Metadata: ConformanceLevel contains invalid value</error>"));
tempFile = getResourceAsFile("attributeBasedXMP_zugferd_2p0_EN16931_Einfach.pdf");
pv.setFilename(tempFile.getAbsolutePath());
vc.clear();
pv.validate();
actual = pv.getXMLResult();
assertEquals(false, actual.contains("<error"));// issue 18: "ConformanceLevel not found" should not be
// reported since it's actually there
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
}

View File

@@ -0,0 +1,41 @@
package org.mustangproject.library.extended;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.TestCase;
public class ResourceCase extends TestCase {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceCase.class.getCanonicalName()); // log output is
public static File getResourceAsFile(String resourcePath) {
try {
InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream(resourcePath);
if (in == null) {
return null;
}
File tempFile = File.createTempFile(String.valueOf(in.hashCode()), ".tmp");
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
// copy stream
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
}
return tempFile;
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
return null;
}
}
}

View File

@@ -0,0 +1,195 @@
package org.mustangproject.library.extended;
import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.transform.Source;
import org.xmlunit.builder.Input;
import org.xmlunit.xpath.JAXPXPathEngine;
import org.xmlunit.xpath.XPathEngine;
public class XMLValidatorTest extends ResourceCase {
public void testZF2XMLValidation() {
// ignored for the
// time being
ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx);
XPathEngine xpath = new JAXPXPathEngine();
File tempFile = getResourceAsFile("invalidV2.xml");
Source source;
String content;
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
/*
* assertEquals(true, xv.getXMLResult().
* contains("<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:LineTotalAmount)\">\n"
* +
* " Eine Rechnung (INVOICE) muss die Summe der Rechnungspositionen-Nettobeträge „Sum of Invoice line net amount“ (BT-106) enthalten.</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount + ram:ChargeTotalAmount) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount) and not (ram:ChargeTotalAmount)) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount + ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount)) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount) and not (ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount))\">\n"
* +
* " Der Inhalt des Elementes „Invoice total amount without VAT“ (BT-109) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131) abzüglich der Summe aller in der Rechnung enthaltenen Nachlässe der Dokumentenebene „Sum of allowances on document level“ (BT-107) zuzüglich der Summe aller in der Rechnung enthaltenen Abgaben der Dokumentenebene „Sum of charges on document level“ (BT-108).</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:GrandTotalAmount = round(ram:TaxBasisTotalAmount*100 + ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode]*100 +0) div 100) or ((ram:GrandTotalAmount = ram:TaxBasisTotalAmount) and not (ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode]))\">\n"
* +
* " Der Inhalt des Elementes „Invoice total amount with VAT“ (BT-112) entspricht der Summe des Inhalts des Elementes „Invoice total amount without VAT“ (BT-109) und des Elementes „Invoice total VAT amount“ (BT-110).</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"ram:LineTotalAmount = (round(sum(../../ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount) * 10 * 10)div 100)\">\n"
* +
* " Der Inhalt des Elementes „Sum of Invoice line net amount“ (BT-106) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131).</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']\" criterion=\"(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:Name!='')\">\n"
* +
* " Eine Rechnung (INVOICE) muss den Erwerbernamen „Buyer name“ (BT-44) enthalten.</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeAgreement']/*[local-name()='BuyerTradeParty']\" criterion=\"count(ram:Name)=1\">\n"
* + " Das Element 'ram:Name' muss genau 1 mal auftreten.</error>\n" +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"count(ram:LineTotalAmount)=1\">\n"
* + " Das Element 'ram:LineTotalAmount' muss genau 1 mal auftreten.</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='IncludedSupplyChainTradeLineItem'][2]/*[local-name()='SpecifiedLineTradeDelivery']/*[local-name()='BilledQuantity']\" criterion=\"document('zugferd2p0_extended_codedb.xml')//cl[@id=7]/enumeration[@value=$codeValue7]\">\n"
* + " Wert von '@unitCode' ist unzulässig.</error>\n" +
* "</messages><summary status='invalid'/>"));
*
*/
tempFile = getResourceAsFile("invalidV2Profile.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
assertTrue(xv.getXMLResult().contains("<error type=\"25\""));
ctx.clear();
try {
tempFile = getResourceAsFile("FAIL_zugferd_2p1_MINIMUM_Rechnung_380.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
String res = xv.getXMLResult();
/*OutputStream os = null;
try {
os = new FileOutputStream(new File("return.xml"));
os.write(res.getBytes(), 0, res.length());
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}*/
content = "<validation>" + res + "</validation>";
assertThat(content).valueByXPath("count(//error)")
.asInt()
.isGreaterThan(1); //2 errors are OK because there is a known bug
assertThat(content).valueByXPath("//error[@type=\"4\"]")
.asString()
.contains(
"In Deutschland sind die Profile MINIMUM und BASIC WL nur als Buchungshilfe (TypeCode: 751) zugelassen.");
ctx.clear();
tempFile = getResourceAsFile("validV2Basic.xml");
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
ctx.clear();
tempFile = getResourceAsFile("ZUGFeRD-invoice_rabatte_3_abschlag_duepayableamount.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
ctx.clear();
tempFile = getResourceAsFile("valid_Avoir_FR_type380_minimum_factur-x.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
content = xpath.evaluate("/validation/summary/@status", source);
assertEquals("invalid", content);
// assertEquals(true, xv.getXMLResult().contains("valid") &&
// !xv.getXMLResult().contains("invalid"));
/*
* this test failure might have to be upstreamed ctx.clear(); tempFile =
* getResourceAsFile(
* "ZUGFeRD-invoice_rabatte_4_abschlag_taxbasistotalamount.xml");
* xv.setFilename(tempFile.getAbsolutePath()); xv.validate(); assertEquals(true,
* xv.getXMLResult().contains("valid") &&
* !xv.getXMLResult().contains("invalid"));
*/
ctx.clear();
tempFile = getResourceAsFile("attributeBasedXMP_zugferd_2p0_EN16931_Einfach_corrected.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
ctx.clear();
tempFile = getResourceAsFile("validZREtestZugferd.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
content = xpath.evaluate("/validation/summary/@status", source);
assertEquals("invalid", content);
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
public void testZF1XMLValidation() {
ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx);
File tempFile = getResourceAsFile("validV1.xml");
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
tempFile = getResourceAsFile("invalidV1ExtraTags.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("invalid"));
tempFile = getResourceAsFile("invalidV1TooMinimal.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("<error type=\"26\""));
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
}

View File

@@ -0,0 +1,83 @@
package org.mustangproject.library.extended;
import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.xmlunit.builder.Input;
import org.xmlunit.xpath.JAXPXPathEngine;
import org.xmlunit.xpath.XPathEngine;
import static org.xmlunit.assertj.XmlAssert.assertThat;
public class ZUGFeRDValidatorTest extends ResourceCase {
public void testPDFValidation() {
File tempFile = getResourceAsFile("invalidPDF.pdf");
/**used to be Rule Status
Specification: ISO 19005-3:2012, Clause: 6.2.11.4, Test number: 4
If the FontDescriptor dictionary of an embedded CID font contains a CIDSet stream, then it shall identify all CIDs which are present in the font program, regardless of whether a CID in the font is referenced or used by the PDF or not. Failed
2 occurrences Hide
PDCIDFont
fontFile_size == 0 || fontName.search(/[A-Z]{6}\+/) != 0 || CIDSet_size == 0 || cidSetListsAllGlyphs == true
root/document[0]/pages[1](9 0 obj PDPage)/contentStream[0](18 0 obj PDContentStream)/operators[166]/font[0](WIUIIO+CIDFont+F2)/DescendantFonts[0](WIUIIO+CIDFont+F2)
root/document[0]/pages[1](9 0 obj PDPage)/contentStream[0](18 0 obj PDContentStream)/operators[192]/font[0](VEXQUA+CIDFont+F1)/DescendantFonts[0](VEXQUA+CIDFont+F1)
but new sample since that has been downgraded to warning
*/
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("/validation/pdf/summary/@status")
.isEqualTo("invalid");
assertThat(res).valueByXPath("/validation/xml/summary/@status")
.isEqualTo("valid");
assertThat(res).valueByXPath("/validation/summary/@status")
.isEqualTo("invalid");
tempFile = getResourceAsFile("validAvoir_FR_type380_BASICWL.pdf");
zfv = new ZUGFeRDValidator();
res = zfv.validate(tempFile.getAbsolutePath());
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
tempFile = getResourceAsFile("validAvoir_FR_type380_BASICWL.pdf");
zfv = new ZUGFeRDValidator();
res = zfv.validate(tempFile.getAbsolutePath());
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
}
/***
* the XMLValidatorTests only cover the <xml></xml> part, this one includes the root element and
* the global <summary></summary> part as well
*/
public void testXMLValidation() {
File tempFile = getResourceAsFile("validV2.xml");
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("count(//error)")
.asInt()
.isEqualTo(0);
assertThat(res).valueByXPath("count(//notice)")
.asInt()
.isEqualTo(3); // 3 notices RE XRechnung
assertThat(res).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo("valid");// expect to be valid because XR notices are, well, only notices
assertThat(res).valueByXPath("/validation/xml/summary/@status")
.asString()
.isEqualTo("valid");
}
}

View File

@@ -0,0 +1,88 @@
package org.mustangproject.validator;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class MiscValidatorTest extends ResourceCase {
public void testInvalidFileValidation() {
ZUGFeRDValidator zfv=new ZUGFeRDValidator();
String res=zfv.validate(null);
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\"\" datetime=\".*?\">\n" +
" <messages>\n" +
" <error type=\"10\">Filename not specified</error> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n" +
""));
res=zfv.validate("/dhfkbv/sfjkh");
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\"sfjkh\" datetime=\".*?\">\n" +
" <messages>\n" +
" <error type=\"1\">File not found</error> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n"));
boolean noExceptionOccurred=true;
File tempFile=null;
try {
tempFile = File.createTempFile("hello", ".tmp");
} catch (IOException e) {
noExceptionOccurred=true;
}
assertTrue(noExceptionOccurred);
res=zfv.validate(tempFile.getAbsolutePath());
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\".*\" datetime=\".*\">\n" +
" <messages>\n" +
" <error type=\"5\">File too small</error> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n" +
""));
String fileContent = "ladhvkdbfk wkhfbkhdhkb svbkfsvbksfbvk sdvsdvbksjdvbkfdsv sdvbskdvbsjhkvbfskh dvbskfvbkfsbvke"
+ "ladhvkdbfk wkhfbkhdhkb svbkfsvbksfbvk sdvsdvbksjdvbkfdsv sdvbskdvbsjhkvbfskh dvbskfvbkfsbvke";
noExceptionOccurred=true;
BufferedWriter writer;
try {
writer = new BufferedWriter(new FileWriter(tempFile));
writer.write(fileContent);
writer.close();
} catch (IOException e) {
noExceptionOccurred=false;
}
assertTrue(noExceptionOccurred);
res=zfv.validate(tempFile.getAbsolutePath());
assertTrue(res.matches("<\\?xml version=\"1.0\" encoding=\"UTF-8\"\\?>\n" +
"\n" +
"<validation filename=\".*\" datetime=\".*\">\n" +
" <messages>\n" +
" <exception type=\"8\">File does not look like PDF nor XML \\(contains neither %PDF nor &lt;\\?xml\\)</exception> \n" +
" </messages>\n" +
" <summary status=\"invalid\"/>\n" +
"</validation>\n" +
""));
// clean up
tempFile.delete();
}
}

View File

@@ -0,0 +1,139 @@
package org.mustangproject.validator;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PDFValidatorTest extends ResourceCase {
private static final Logger LOGGER = LoggerFactory.getLogger(ZUGFeRDValidator.class.getCanonicalName()); // log
public void testPDFValidation() {
ValidationContext vc = new ValidationContext(null);
PDFValidator pv = new PDFValidator(vc);
try {
File tempFile = getResourceAsFile("XMLinvalidV2PDF.pdf");// need a more invalid file here
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
// assertEquals("", pv.getXMLResult());
//
tempFile = getResourceAsFile("Facture_F20180027.pdf");
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
String actual = pv.getXMLResult();
assertEquals(true, actual.contains("summary status='valid"));
assertEquals(false, actual.contains("summary status='invalid"));
XMLValidator xv = new XMLValidator(vc);
xv.setStringContent(pv.getRawXML());
xv.validate();
actual = vc.getXMLResult();
assertEquals(true, actual.contains("validationReport profileName=\"PDF/A-3"));
assertEquals(true, actual.contains("batchSummary totalJobs=\"1\" failedToParse=\"0\" encrypted=\"0\""));
assertEquals(true,
actual.contains("validationReports compliant=\"1\" nonCompliant=\"0\" failedJobs=\"0\">"));
// test some xml
// assertEquals(true, actual.contains("<error
// location=\"/*:CrossIndustryInvoice[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:SupplyChainTradeTransaction[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:ApplicableHeaderTradeSettlement[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:SpecifiedTradeSettlementHeaderMonetarySummation[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:DuePayableAmount[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]\"
// criterion=\"not(@currencyID)\">[CII-DT-031] - currencyID should not be
// present</error>"));
// test some binary signature recognition
assertEquals(true, actual.contains("<version>2</version>"));
// valid one
tempFile = getResourceAsFile("validV2PDF.pdf");
pv.setFilename(tempFile.getAbsolutePath());
vc.clear();
pv.validate();
actual = pv.getXMLResult();
assertEquals(true, actual.contains("validationReport profileName=\"PDF/A-3"));
assertEquals(true, actual.contains("batchSummary totalJobs=\"1\" failedToParse=\"0\" encrypted=\"0\""));
assertEquals(true,
actual.contains("validationReports compliant=\"1\" nonCompliant=\"0\" failedJobs=\"0\">"));
assertEquals(false, actual.contains("<error"));
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
public void testPDFXMLValidation() {
ValidationContext vc = new ValidationContext(null);
try {
PDFValidator pv = new PDFValidator(vc);
File tempFile = getResourceAsFile("attributeBasedXMP_zugferd_2p0_EN16931_Einfach.pdf");// need a more
// invalid file here
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
String pdfvres = pv.getXMLResult();
XMLValidator xv = new XMLValidator(vc);
xv.setStringContent(pv.getRawXML());
xv.validate();
String xmlvres = xv.getXMLResult();
assertEquals(true, pdfvres.contains("valid") && !pdfvres.contains("invalid"));
assertEquals(true, xmlvres.contains("invalid"));
vc.clear();
tempFile = getResourceAsFile("validV1WithAdditionalData.pdf");// need a more invalid file here
pv.setFilename(tempFile.getAbsolutePath());
pv.validate();
pdfvres = pv.getXMLResult();
xv = new XMLValidator(vc);
xv.setStringContent(pv.getRawXML());
xv.validate();
xmlvres = xv.getXMLResult();
assertEquals(true, pdfvres.contains("valid") && !pdfvres.contains("invalid"));
assertEquals(true, xmlvres.contains("valid") && !xmlvres.contains("invalid"));
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
public void testXMPValidation() {
ValidationContext vc = new ValidationContext(null);
PDFValidator pv = new PDFValidator(vc);
try {
File tempFile = getResourceAsFile("invalidXMP.pdf");
pv.setFilename(tempFile.getAbsolutePath());
vc.clear();
pv.validate();
String actual = pv.getXMLResult();
assertEquals(true, actual
.contains("<error type=\"12\">XMP Metadata: ConformanceLevel contains invalid value</error>"));
tempFile = getResourceAsFile("attributeBasedXMP_zugferd_2p0_EN16931_Einfach.pdf");
pv.setFilename(tempFile.getAbsolutePath());
vc.clear();
pv.validate();
actual = pv.getXMLResult();
assertEquals(false, actual.contains("<error"));// issue 18: "ConformanceLevel not found" should not be
// reported since it's actually there
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
}

View File

@@ -0,0 +1,126 @@
package org.mustangproject.validator;
import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.junit.Before;
import org.junit.Test;
import org.xmlunit.xpath.JAXPXPathEngine;
import org.xmlunit.xpath.XPathEngine;
import junit.framework.TestCase;
public class PathTest extends TestCase {
TestFileWalker zfWalk;
@Before
public void beforeEachTestMethod() {
System.out.println("Invoked before each test method");
TestFileWalker zfWalk = new TestFileWalker();
}
@Test
public void testOfficialSamples() {
// ignored for the
// time being
Path startingDir = Paths.get(System.getProperty("user.dir") + "/../../Release/Beispiele/");
TestFileWalker zfWalk = new TestFileWalker();
try {
Files.walkFileTree(startingDir, zfWalk);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// XPathEngine xpath = new JAXPXPathEngine();
// File tempFile = getResourceAsFile("invalidV2.xml");
//https://stackoverflow.com/questions/16245914/execute-an-external-jar -> http://docs.oracle.com/javase/tutorial/deployment/jar/jarclassloader.html
/**
* assertThat(content).valueByXPath("count(//error)") .asInt()
* .isGreaterThan(1); //2 errors are OK because there is a known bug
*
*
* assertThat(content).valueByXPath("//error[@type=\"4\"]") .asString()
* .contains( "In Deutschland sind die Profile MINIMUM und BASIC WL nur als
* Buchungshilfe (TypeCode: 751) zugelassen.");
*
*/
}
@Test
public void testFacturX() {
TestFileWalker zfWalk = new TestFileWalker();
Path startingDir = Paths.get(System.getProperty("user.dir") + "/../../foreign_samples/fx/");
try {
Files.walkFileTree(startingDir, zfWalk);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// XPathEngine xpath = new JAXPXPathEngine();
// File tempFile = getResourceAsFile("invalidV2.xml");
//https://stackoverflow.com/questions/16245914/execute-an-external-jar -> http://docs.oracle.com/javase/tutorial/deployment/jar/jarclassloader.html
/**
* assertThat(content).valueByXPath("count(//error)") .asInt()
* .isGreaterThan(1); //2 errors are OK because there is a known bug
*
*
* assertThat(content).valueByXPath("//error[@type=\"4\"]") .asString()
* .contains( "In Deutschland sind die Profile MINIMUM und BASIC WL nur als
* Buchungshilfe (TypeCode: 751) zugelassen.");
*
*/
}
@Test
public void testTestFiles() {
// ignored for the
// time being
/*https://www.xoev.de/sixcms/media.php/13/XRechnung_Kompakt.pdf "Problem
Nur positive Beispiele als Testgrundlage
Negative Beispiele sind sehr wichtig!"*/
/* Path startingDir = Paths.get(System.getProperty("user.dir") + "/testfiles/toPass/");
try {
Files.walkFileTree(startingDir, zfWalk);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
*/
// XPathEngine xpath = new JAXPXPathEngine();
// File tempFile = getResourceAsFile("invalidV2.xml");
//https://stackoverflow.com/questions/16245914/execute-an-external-jar -> http://docs.oracle.com/javase/tutorial/deployment/jar/jarclassloader.html
/**
* assertThat(content).valueByXPath("count(//error)") .asInt()
* .isGreaterThan(1); //2 errors are OK because there is a known bug
*
*
* assertThat(content).valueByXPath("//error[@type=\"4\"]") .asString()
* .contains( "In Deutschland sind die Profile MINIMUM und BASIC WL nur als
* Buchungshilfe (TypeCode: 751) zugelassen.");
*
*/
}
}

View File

@@ -0,0 +1,40 @@
package org.mustangproject.validator;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import junit.framework.TestCase;
public class ResourceCase extends TestCase {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceCase.class.getCanonicalName()); // log output is
public static File getResourceAsFile(String resourcePath) {
try {
InputStream in = ClassLoader.getSystemClassLoader().getResourceAsStream(resourcePath);
if (in == null) {
return null;
}
File tempFile = File.createTempFile(String.valueOf(in.hashCode()), ".tmp");
tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) {
// copy stream
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
}
return tempFile;
} catch (IOException e) {
LOGGER.error(e.getMessage(), e);
return null;
}
}
}

View File

@@ -0,0 +1,69 @@
package org.mustangproject.validator;
import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class TestFileWalker
extends SimpleFileVisitor<Path> {
protected PathMatcher matcher;
protected ZUGFeRDValidator zul;
protected int fileCount=1;
public TestFileWalker() {
this.zul = new ZUGFeRDValidator();
;
matcher = FileSystems.getDefault().getPathMatcher("glob:*.{pdf,xml}");
}
// Print information about
// each type of file.
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attr) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//get current date time with Date()
Date date = new Date();
if ((attr!=null)&&(attr.isRegularFile())) {
if (matcher.matches(file.getFileName())) {
System.out.format("\n@%s Testing file %d: %s ", dateFormat.format(date), fileCount++, file);
assertThat(zul.validate(file.toAbsolutePath().toString())).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo(
"valid");
}
}
return FileVisitResult.CONTINUE;
}
// Print each directory visited.
@Override
public FileVisitResult postVisitDirectory(Path dir,
IOException exc) {
System.out.format("Directory: %s%n", dir);
return FileVisitResult.CONTINUE;
}
// If there is some error accessing
// the file, let the user know.
// If you don't override this method
// and an error occurs, an IOException
// is thrown.
@Override
public FileVisitResult visitFileFailed(Path file,
IOException exc) {
System.err.println(exc);
return FileVisitResult.CONTINUE;
}
}

View File

@@ -0,0 +1,194 @@
package org.mustangproject.validator;
import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.xml.transform.Source;
import org.xmlunit.builder.Input;
import org.xmlunit.xpath.JAXPXPathEngine;
import org.xmlunit.xpath.XPathEngine;
public class XMLValidatorTest extends ResourceCase {
public void testZF2XMLValidation() {
// ignored for the
// time being
ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx);
XPathEngine xpath = new JAXPXPathEngine();
File tempFile = getResourceAsFile("invalidV2.xml");
Source source;
String content;
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
/*
* assertEquals(true, xv.getXMLResult().
* contains("<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:LineTotalAmount)\">\n"
* +
* " Eine Rechnung (INVOICE) muss die Summe der Rechnungspositionen-Nettobeträge „Sum of Invoice line net amount“ (BT-106) enthalten.</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount + ram:ChargeTotalAmount) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount - ram:AllowanceTotalAmount) and not (ram:ChargeTotalAmount)) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount + ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount)) or ((ram:TaxBasisTotalAmount = ram:LineTotalAmount) and not (ram:ChargeTotalAmount) and not (ram:AllowanceTotalAmount))\">\n"
* +
* " Der Inhalt des Elementes „Invoice total amount without VAT“ (BT-109) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131) abzüglich der Summe aller in der Rechnung enthaltenen Nachlässe der Dokumentenebene „Sum of allowances on document level“ (BT-107) zuzüglich der Summe aller in der Rechnung enthaltenen Abgaben der Dokumentenebene „Sum of charges on document level“ (BT-108).</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"(ram:GrandTotalAmount = round(ram:TaxBasisTotalAmount*100 + ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode]*100 +0) div 100) or ((ram:GrandTotalAmount = ram:TaxBasisTotalAmount) and not (ram:TaxTotalAmount[@currencyID=/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceCurrencyCode]))\">\n"
* +
* " Der Inhalt des Elementes „Invoice total amount with VAT“ (BT-112) entspricht der Summe des Inhalts des Elementes „Invoice total amount without VAT“ (BT-109) und des Elementes „Invoice total VAT amount“ (BT-110).</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"ram:LineTotalAmount = (round(sum(../../ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount) * 10 * 10)div 100)\">\n"
* +
* " Der Inhalt des Elementes „Sum of Invoice line net amount“ (BT-106) entspricht der Summe aller Inhalte der Elemente „Invoice line net amount“ (BT-131).</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']\" criterion=\"(rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:BuyerTradeParty/ram:Name!='')\">\n"
* +
* " Eine Rechnung (INVOICE) muss den Erwerbernamen „Buyer name“ (BT-44) enthalten.</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeAgreement']/*[local-name()='BuyerTradeParty']\" criterion=\"count(ram:Name)=1\">\n"
* + " Das Element 'ram:Name' muss genau 1 mal auftreten.</error>\n" +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='SpecifiedTradeSettlementHeaderMonetarySummation']\" criterion=\"count(ram:LineTotalAmount)=1\">\n"
* + " Das Element 'ram:LineTotalAmount' muss genau 1 mal auftreten.</error>\n"
* +
* "<error location=\"/*[local-name()='CrossIndustryInvoice']/*[local-name()='SupplyChainTradeTransaction']/*[local-name()='IncludedSupplyChainTradeLineItem'][2]/*[local-name()='SpecifiedLineTradeDelivery']/*[local-name()='BilledQuantity']\" criterion=\"document('zugferd2p0_extended_codedb.xml')//cl[@id=7]/enumeration[@value=$codeValue7]\">\n"
* + " Wert von '@unitCode' ist unzulässig.</error>\n" +
* "</messages><summary status='invalid'/>"));
*
*/
tempFile = getResourceAsFile("invalidV2Profile.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
assertTrue(xv.getXMLResult().contains("<error type=\"25\""));
ctx.clear();
try {
tempFile = getResourceAsFile("FAIL_zugferd_2p1_MINIMUM_Rechnung_380.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
String res = xv.getXMLResult();
/*OutputStream os = null;
try {
os = new FileOutputStream(new File("return.xml"));
os.write(res.getBytes(), 0, res.length());
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}*/
content = "<validation>" + res + "</validation>";
assertThat(content).valueByXPath("count(//error)")
.asInt()
.isGreaterThan(1); //2 errors are OK because there is a known bug
assertThat(content).valueByXPath("//error[@type=\"4\"]")
.asString()
.contains(
"In Deutschland sind die Profile MINIMUM und BASIC WL nur als Buchungshilfe (TypeCode: 751) zugelassen.");
ctx.clear();
tempFile = getResourceAsFile("validV2Basic.xml");
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
ctx.clear();
tempFile = getResourceAsFile("ZUGFeRD-invoice_rabatte_3_abschlag_duepayableamount.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
ctx.clear();
tempFile = getResourceAsFile("valid_Avoir_FR_type380_minimum_factur-x.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
content = xpath.evaluate("/validation/summary/@status", source);
assertEquals("invalid", content);
// assertEquals(true, xv.getXMLResult().contains("valid") &&
// !xv.getXMLResult().contains("invalid"));
/*
* this test failure might have to be upstreamed ctx.clear(); tempFile =
* getResourceAsFile(
* "ZUGFeRD-invoice_rabatte_4_abschlag_taxbasistotalamount.xml");
* xv.setFilename(tempFile.getAbsolutePath()); xv.validate(); assertEquals(true,
* xv.getXMLResult().contains("valid") &&
* !xv.getXMLResult().contains("invalid"));
*/
ctx.clear();
tempFile = getResourceAsFile("attributeBasedXMP_zugferd_2p0_EN16931_Einfach_corrected.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
ctx.clear();
tempFile = getResourceAsFile("validZREtestZugferd.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
source = Input.fromString("<validation>" + xv.getXMLResult() + "</validation>").build();
content = xpath.evaluate("/validation/summary/@status", source);
assertEquals("invalid", content);
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
public void testZF1XMLValidation() {
ValidationContext ctx = new ValidationContext(null);
XMLValidator xv = new XMLValidator(ctx);
File tempFile = getResourceAsFile("validV1.xml");
try {
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("valid") && !xv.getXMLResult().contains("invalid"));
tempFile = getResourceAsFile("invalidV1ExtraTags.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("invalid"));
tempFile = getResourceAsFile("invalidV1TooMinimal.xml");
xv.setFilename(tempFile.getAbsolutePath());
xv.validate();
assertEquals(true, xv.getXMLResult().contains("<error type=\"26\""));
} catch (IrrecoverableValidationError e) {
// ignore, will be in XML output anyway
}
}
}

View File

@@ -0,0 +1,83 @@
package org.mustangproject.validator;
import static org.xmlunit.assertj.XmlAssert.assertThat;
import java.io.File;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.xmlunit.builder.Input;
import org.xmlunit.xpath.JAXPXPathEngine;
import org.xmlunit.xpath.XPathEngine;
import static org.xmlunit.assertj.XmlAssert.assertThat;
public class ZUGFeRDValidatorTest extends ResourceCase {
public void testPDFValidation() {
File tempFile = getResourceAsFile("invalidPDF.pdf");
/**used to be Rule Status
Specification: ISO 19005-3:2012, Clause: 6.2.11.4, Test number: 4
If the FontDescriptor dictionary of an embedded CID font contains a CIDSet stream, then it shall identify all CIDs which are present in the font program, regardless of whether a CID in the font is referenced or used by the PDF or not. Failed
2 occurrences Hide
PDCIDFont
fontFile_size == 0 || fontName.search(/[A-Z]{6}\+/) != 0 || CIDSet_size == 0 || cidSetListsAllGlyphs == true
root/document[0]/pages[1](9 0 obj PDPage)/contentStream[0](18 0 obj PDContentStream)/operators[166]/font[0](WIUIIO+CIDFont+F2)/DescendantFonts[0](WIUIIO+CIDFont+F2)
root/document[0]/pages[1](9 0 obj PDPage)/contentStream[0](18 0 obj PDContentStream)/operators[192]/font[0](VEXQUA+CIDFont+F1)/DescendantFonts[0](VEXQUA+CIDFont+F1)
but new sample since that has been downgraded to warning
*/
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("/validation/pdf/summary/@status")
.isEqualTo("invalid");
assertThat(res).valueByXPath("/validation/xml/summary/@status")
.isEqualTo("valid");
assertThat(res).valueByXPath("/validation/summary/@status")
.isEqualTo("invalid");
tempFile = getResourceAsFile("validAvoir_FR_type380_BASICWL.pdf");
zfv = new ZUGFeRDValidator();
res = zfv.validate(tempFile.getAbsolutePath());
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
tempFile = getResourceAsFile("validAvoir_FR_type380_BASICWL.pdf");
zfv = new ZUGFeRDValidator();
res = zfv.validate(tempFile.getAbsolutePath());
assertEquals(true, res.contains("status=\"valid\""));
assertEquals(false, res.contains("status=\"invalid\""));
}
/***
* the XMLValidatorTests only cover the <xml></xml> part, this one includes the root element and
* the global <summary></summary> part as well
*/
public void testXMLValidation() {
File tempFile = getResourceAsFile("validV2.xml");
ZUGFeRDValidator zfv = new ZUGFeRDValidator();
String res = zfv.validate(tempFile.getAbsolutePath());
assertThat(res).valueByXPath("count(//error)")
.asInt()
.isEqualTo(0);
assertThat(res).valueByXPath("count(//notice)")
.asInt()
.isEqualTo(3); // 3 notices RE XRechnung
assertThat(res).valueByXPath("/validation/summary/@status")
.asString()
.isEqualTo("valid");// expect to be valid because XR notices are, well, only notices
assertThat(res).valueByXPath("/validation/xml/summary/@status")
.asString()
.isEqualTo("valid");
}
}

View File

@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='UTF-8' ?>
<rsm:CrossIndustryInvoice xmlns:a="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:10" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
<rsm:ExchangedDocumentContext>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:factur-x.eu:1p0:minimum</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>471102</ram:ID>
<ram:TypeCode>380</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20200305</udt:DateTimeString>
</ram:IssueDateTime>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:ApplicableHeaderTradeAgreement>
<ram:SellerTradeParty>
<ram:Name>Lieferant GmbH</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>80333</ram:PostcodeCode>
<ram:LineOne>Lieferantenstraße 20</ram:LineOne>
<ram:CityName>München</ram:CityName>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="FC">201/113/40209</ram:ID>
</ram:SpecifiedTaxRegistration>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA">DE123456789</ram:ID>
</ram:SpecifiedTaxRegistration>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:Name>Kunden AG DE</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>85001</ram:PostcodeCode>
<ram:LineOne>Alexander Zahlt</ram:LineOne>
<ram:LineTwo>Im Hofbräuhaus 2</ram:LineTwo>
<ram:CityName>München</ram:CityName>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery>
</ram:ApplicableHeaderTradeDelivery>
<ram:ApplicableHeaderTradeSettlement>
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:LineTotalAmount>198.00</ram:LineTotalAmount>
<ram:TaxBasisTotalAmount>198.00</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="EUR">37.62</ram:TaxTotalAmount>
<ram:GrandTotalAmount>235.62</ram:GrandTotalAmount>
<ram:DuePayableAmount>235.62</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<rsm:CrossIndustryInvoice xmlns:a="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:10" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
<rsm:ExchangedDocumentContext>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:cen.eu:en16931:2017</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>ST-1499</ram:ID>
<ram:TypeCode>380</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20190726</udt:DateTimeString>
</ram:IssueDateTime>
<ram:IncludedNote>
<ram:Content>Rechnung</ram:Content>
</ram:IncludedNote>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>0004</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:SellerAssignedID>0004</ram:SellerAssignedID>
<ram:Name>pos 4</ram:Name>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount>20.00</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="H87">2.77</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount>55.40</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:ApplicableHeaderTradeAgreement>
<ram:SellerTradeParty>
<ram:Name>DATAflor Musterbetrieb</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>37079</ram:PostcodeCode>
<ram:LineOne>August-Spindler-Straße 20</ram:LineOne>
<ram:CityName>Göttingen</ram:CityName>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA">DE00000000</ram:ID>
</ram:SpecifiedTaxRegistration>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:Name>Thomas Adler</ram:Name>
<ram:PostalTradeAddress>
<ram:CountryID>DE</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery>
<ram:ActualDeliverySupplyChainEvent>
<ram:OccurrenceDateTime>
<udt:DateTimeString format="102">20190726</udt:DateTimeString>
</ram:OccurrenceDateTime>
</ram:ActualDeliverySupplyChainEvent>
</ram:ApplicableHeaderTradeDelivery>
<ram:ApplicableHeaderTradeSettlement>
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:ApplicableTradeTax>
<ram:CalculatedAmount>10.34</ram:CalculatedAmount>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:BasisAmount>54.40</ram:BasisAmount>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeAllowanceCharge>
<ram:ChargeIndicator>
<udt:Indicator>false</udt:Indicator>
</ram:ChargeIndicator>
<ram:ActualAmount>1.00</ram:ActualAmount>
<ram:Reason>sondernachlass</ram:Reason>
<ram:CategoryTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
</ram:CategoryTradeTax>
</ram:SpecifiedTradeAllowanceCharge>
<ram:SpecifiedTradePaymentTerms>
<ram:Description />
</ram:SpecifiedTradePaymentTerms>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:LineTotalAmount>55.40</ram:LineTotalAmount>
<ram:ChargeTotalAmount>0.00</ram:ChargeTotalAmount>
<ram:AllowanceTotalAmount>1.00</ram:AllowanceTotalAmount>
<ram:TaxBasisTotalAmount>54.40</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="EUR">10.34</ram:TaxTotalAmount>
<ram:GrandTotalAmount>64.74</ram:GrandTotalAmount>
<ram:TotalPrepaidAmount>50.00</ram:TotalPrepaidAmount>
<ram:DuePayableAmount>14.74</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

Some files were not shown because too many files have changed in this diff Show More