ConnectingEurope / eInvoicing-EN16931

Validation artefacts for the European eInvoicing standard EN 16931
Other
138 stars 54 forks source link

BIS3 UBL XML Invoices: question about namespaces #272

Closed skizub21 closed 3 years ago

skizub21 commented 3 years ago

Hello, I have a question about document namespaces. According to all examples available they must be defined as: xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" ...

so their corresponding usage in document will be: < cbc:ID >I0000001</cbc:ID> < cbc:IssueDate >2021-03-08</cbc:IssueDate>

Is it legal from EN16931 point of view to redefine namespaces?

For example: xmlns:myns1="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:myns2="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" .... so usage in document will be: < myns2:ID >I0000001</myns2:ID> < myns2:IssueDate >2021-03-08</myns2:IssueDate>

In case it is possible will schematron validation be able to validate document using different namespaces correctly?

phax commented 3 years ago

Yes this is totally valid. The namespace prefixes (cac, cbc, myns1, myns2) are just "text replacements" for underlying namespace URLs (like urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2) - you can pick whatever prefix you like here, as long as the other URL is correct.

The problem is, that certain Schematron rules (not in this project) are written very badly and refer to a specific prefix. But from this project's point of view, it is totally fine to use whatever prefix you like. Small side note: please don't use the "default" prefix (empty String) as it has a special meaning.

hth, Philip

skizub21 commented 3 years ago

Thank you Philip. I understand and fully agree that it is valid from XML document point of view.

But if it is also valid from project point of view(PEPPOL, [eInvoicing), then EU validations [should]https://www.itb.ec.europa.eu/invoice/upload produce same results, correct?

Below is a result of quick test I did (one of the files has customised names): customized-ns.pdf standard-ns.pdf

It produces different validation results I'm afraid...

phax commented 3 years ago

Weird - seems like a bug in their software. Can you please try with https://ecosio.com/en/peppol-and-xml-document-validator/ - thx

skizub21 commented 3 years ago

Philip, I'm getting exactly the same results when validating using Ecosio site.

ecosio_modified ecosio_standard

To me file having non-standard names of namespaces is not being fully validated and produces much better results than the same file having standard (cac, cbc, etc) namespaces.

phax commented 3 years ago

@skizub21 are you able to send me the examples files via email? See https://github.com/phax/ for the address - I am curious :)

oriol commented 3 years ago

We haven't been able to reproduce this error. If you can upload an example that fails, we will reopen the issue.