← Prev in month
← Prev in thread
Next in thread →
Next in month →
Idenitifying a need for an alternative way to include XPathexpressions in UBL documents
[I submit this comment now because it does not so much concern the additional features added to UBL in in-progress version 2.1 so much as existing features of UBL 2.0 so it seemed less appropriate to wait for the UBL 2.1 second public review.] In UBL 2.x there is an XPath BBIE which allows an XPath expression to be included in a UBL document. It is used in the DocumentReference. Currently it has one deficiency which might introduce unexpected errors: It does not include any supplementary components to allow the version of XPath to be declared. Users of documents which include DocumentReference would need to make clear which version of XPath is used and possibly would need to make this clear for future understanding of those documents. The use of XPath without version information may result in different results for the same expression and the same target document with the same XPath evaluation tools depending on which XPath version is assumed. There is also to some extent a deficiency in that bindings of namespaces to prefixes in the XPath expression must be determined before the XPath expression can be evaluated but if XPath 2.0 is assumed then there may be built-in assumptions made in the way tools evaluate a default namespace without a prefix. The absence of clear guidance on how tools must determine these bindings can leave room for unexpected results and lack of assurance of correct results in future interpretation of the document. I suggest that improvements would be possible to some extent if a new ABIE were introduced to allow implementers to replace the use of this XPath BBIE with the use of rather more rigorous XQuery expressions which are able to include XPath 2.0(+) expressions (a subset of XQuery 1.0+) but are less ambiguous with regard to namespace bindings and versions. Here is a suggestion for inclusion of such an ABIE, although of course (defined here using suggested additions to the schema modules, but of course this would be more properly defined using the model). It does not require the addition of any new qualified datatypes (but one of two alternatives suggested is to add a new codelist). <!-- ------------------------------- --> <!-- UBL-CommonAggregateComponents-2 --> <!-- ------------------------------- --> <!-- ... --> <!-- addition --> <xsd:element name="XmlExpression" type="XmlExpressionType"/> <!-- ... --> <!-- extension --> <xsd:complexType name="DocumentReferenceType"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" ref="cbc:ID"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:CopyIndicator"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:UUID"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:IssueDate"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:IssueTime"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:DocumentTypeCode"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:DocumentType"/> <xsd:element maxOccurs="unbounded" minOccurs="0" ref="cbc:XPath"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:LanguageID"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:LocaleCode"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:VersionID"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:DocumentStatusCode"/> <xsd:element maxOccurs="unbounded" minOccurs="0" ref="cbc:DocumentDescription"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cac:Attachment"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cac:ValidityPeriod"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cac:IssuerParty"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cac:ResultOfVerification"/> <!-- addition --> <xsd:element maxOccurs="1" minOccurs="0" ref="cac:XmlExpression"/> </xsd:sequence> </xsd:complexType> <!-- ... --> <!-- addition --> <xsd:complexType name="XmlExpressionType"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" ref="cbc:XmlExpressionLanguageID"/> <xsd:element maxOccurs="1" minOccurs="0" ref="cbc:XmlExpressionLanguageVersionID"/> <xsd:element maxOccurs="unbounded" minOccurs="1" ref="cbc:XmlExpressionString"/> </xsd:sequence> </xsd:complexType> <!-- alternative addition --> <xsd:complexType name="XmlExpressionType"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="1" ref="cbc:XmlExpressionLanguageCode"/> <xsd:element maxOccurs="unbounded" minOccurs="1" ref="cbc:XmlExpressionString"/> </xsd:sequence> </xsd:complexType> <!-- ... --> <!-- --------------------------- --> <!-- UBL-CommonBasicComponents-2 --> <!-- --------------------------- --> <!-- ... --> <!-- additions --> <!-- needs specification of how to use spec URIs and version IDs for XQuery, etc here --> <xsd:element name="XmlExpressionLanguageID" type="LanguageIDType"/> <xsd:element name="XmlExpressionLanguageVersionID" type="VersionIDType"/> <!-- alternative additions --> <!-- needs a codelist, e.g. XPath2XPath1CompatibilityMode, XQuery1, XPath2, XQuery2, XPath3 ... --> <xsd:element name="XmlExpressionLanguageCode" type="XmlExpressionLanguageCodeType"/> <!-- ... --> <xsd:complexType name="XmlExpressionLanguageCodeType"> <xsd:simpleContent> <xsd:extension base="udt:CodeType"/> </xsd:simpleContent> </xsd:complexType> <!-- ... --> <!-- addition --> <xsd:element name="XmlExpressionString" type="XmlExpressionStringType"/> <!-- ... --> <!-- addition --> <xsd:complexType name="XmlExpressionStringType"> <xsd:simpleContent> <xsd:extension base="udt:TextType"/> </xsd:simpleContent> </xsd:complexType> <!-- ... --> This would give a way to include an adequately declared XPath 2.0 expression in a UBL document: <cac:XmlExpression> <cbc:XmlExpressionLanguageID>http://www.w3.org/TR/xquery/</cbc:XmlExpressionLanguageID> <cbc:XmlExpressionLanguageVersionID>1.0</cbc:XmlExpressionLanguageVersionID> <cbc:XmlExpressionString>declare default element namespace "urn:oasis:names:specification:ubl:schema:xsd:Invoice- 2"; declare namespace cbc = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"; (/Invoice/cbc:ID)[1]</cbc:XmlExpressionString> </cac:XmlExpression> Since XQuery itself allows the version information to be declared in the expression itself, the XmlExpressionLanguageVersionID could be optional and that version information included in the XQuery expession: <cac:XmlExpression> <cbc:XmlExpressionLanguageID>http://www.w3.org/TR/xquery/</cbc:XmlExpressionLanguageID> <cbc:XmlExpressionString>xquery version "1.0"; declare default element namespace "urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"; declare namespace cbc = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"; (/Invoice/cbc:ID)[1] </cbc:XmlExpressionString> </cac:XmlExpression> Best regards ---- Stephen D Green
← Prev in month
← Prev in thread
Next in thread →
Next in month →