[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Examples for Proposed Single-pass Extension Validation
Per my task from the last teleconference, I have created an example of what my proposal would look like for handling extensions in a single pass. The easiest way to demonstrate this is to unzip the contents of the attached file into your UBL PRD1 directory. You can then modify the "include" element in UBL-CommonExtensionComponents-2.1.xsd to point to either UBL-ExtensionContentDataType-2.1.klv.xsd or UBL- ExtensionContentDataType-2.1.klv-cust.xsd. The files should then be good to play with (with one note below). Descriptions for each file are: UBL-ExtensionContentDataType-2.1.klv.xsd This is the proposed STANDARD schema file that would be distributed. It defines the ExtensionContentType datatype and references the digital signature namespace. (Obviously, the namespace reference would be removed, if we moved signatures into the main body). If you evaluate Example-Invoice-2.1.klv.xml with the CommonExtensionComponents-2.1.xsd including this file, it will pass validation, but none of the extensions will be checked as the namespaces will not be recognized by the validator; instead, the extensions are simply skipped. UBL-ExtensionContentDataType-2.1.klv-cust.xsd This is an example customization of the standard file above. An implementor would customize the file to 1) define the customization namespaces that the implementation can recognize and 2) import the customization schemas containing the specific elements that can be included as extensions That is the only customization needed; and technically, the namespaces do not need to be declared since they are not actually referenced in the schema; they are only provided for readability. If you evaluate Example-Invoice-2.1.klv.xml with the CommonExtensionComponents-2.1.xsd including this file, the content of the defined CorpX and RegionY extensions will be checked - this can be shown by playing with the values in the example XML document as described in the comments embedded within the file. CorpX.xsd An example of a schema containing a customized extension. RegionY.xsd A second example of a schema containing a customized extension; the second example demonstrates that a single instance file can reference multiple custom extensions and they are all validated in a single pass. Example-Invoice-2.1.klv.xml The example XML document to play around with. As is, it should validate with either Extension Content Data Type schema; but if you change the extension content when using the customized Extension Content Data Type schema, errors will be flagged. The example also includes an extension from a third (undefined) namespace to demonstrate that this extension will be skipped over while still validating the recognized extensions. =========== NOTE NOTE NOTE =================== As near as I can tell, it SHOULD work as described above. For some reason, XMLSpy would not check the content of the Extensions as these files are written... I had to change the namespace for the UBL Invoice schema in both the XML instance document and the UBL Invoice schema for it to work as described. I spent about 3 hours trying to figure out why it was not checking the content only to stumble upon this work-around. It works if I simply change the namespace (i.e., the full URN) to have a 3 at the end instead of a 2... I can not figure out why this would be a problem, my working theory is that it is some bug within XMLSpy itself (perhaps it is stuck on the old definition of the namespace referring to the old Extension??? But I rebooted my machine and still had the problem...). In short, I was unable to think of any reason that the namespace would pose a real problem and I am suspecting that it is unique to XMLSpy (older version) and/or my machine - but if you do not see it checking content when it should, please let me know and perhaps we can figure out why this anomaly occurred. Actually, if it does work for you, I'd be interested in knowing as well and what software you are using... 3 hours is too much time to spend chasing down a fake problem! ==================================================== The attached file is in zip format
KLV UBL Extensions Example.zzz.zip
Regards, Ken Vaughn Trevilon Corporation 12906 Pinecrest Rd Herndon, VA 20171 +1-703-390-1053 +1-571-331-5670 cell www.trevilon.com
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]