[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Problems on Translating UBL XSD Schema into Relax NG (2/6)
Hi, I send the report 2/6 about Problems on Translating UBL XSD Schema into Relax NG. I hope to get your advice and comment. Please see the following page to understand Relax NG features. http://www.xml.com/pub/a/2002/01/23/relaxng.html ------------------------------------------------------------- 2. Distinguish between pattern names for elements and types 2.1 The UBL Schema Description using XSD With UBL XSD Schema, names of elements and types are separately managed with symbol space, so a element can be defined along with a type which has a same name with the element. In most cases, elements and types in UBL XSD schemas have different names, only except for NumericType and CodeType . Codes from common/UBL-CoreComponentTypes-1.0-beta.xsd <xsd:element name="NumericType" type="cct:NumericType" /> <xsd:simpleType name="NumericType"> <xsd:restriction base="xsd:decimal"/> </xsd:simpleType> Codes from common/UBL-RepresentationTerms-1.0-beta.xsd <xsd:element name="CodeType" type="rt:CodeType" /> <xsd:complexType name="CodeType"> <xsd:simpleContent> <xsd:extension base="rt:CodeContentType"/> </xsd:simpleContent> </xsd:complexType> 2.2 The UBL Schema Description using Relax NG 1) Problem With Relax NG, as explained at 1.1, named patterns corresponding to UBL XSD elements and types are defined using <define> elements in a uniform way, then names for the patterns element must be different to each other. But names of elements and types for NumericType and CodeType are same, so if pattern names for elements and types of NumericType and CodeType were generated according as the rule at 1.2, syntax errors would be occurred. 2) Solution In order to distinguish these pattern names for elements and types, a additional string "-element" is added to the names for these elements, such as "ubl-cct-NumericType-element" and "ubl-rt-CodeType-element". Generated Codes in UBL-CoreComponentTypes-1.0-beta.rng <define name="ubl-cct-NumericType-element"> <element name="NumericType"> <ref name="ubl-cct-NumericType"/> </element> </define> <define name="ubl-cct-NumericType"> <data type="decimal"/> </define> Generated Codes in UBL-RepresentationTerms-1.0-beta.rng <define name="ubl-rt-CodeType-element"> <element name="CodeType"> <ref name="ubl-rt-CodeType"/> </element> </define> <define name="ubl-rt-CodeType"> <ref name="ubl-rt-CodeContentType"/> </define> 2.3 Proposition to change UBL XSD schema If XSD name for element "NumericType" were changed to "Numeric" and XSD name for element "CodeType" were changed to "Code", there would be no need for special naming rule which was applied for "NumericType" and "Numeric" explained above. Proposed Codes for common/UBL-CoreComponentTypes-1.0-beta.xsd <xsd:element name="Numeric" type="cct:NumericType" /> <xsd:simpleType name="NumericType"> <xsd:restriction base="xsd:decimal"/> </xsd:simpleType> Proposed Codes for common/UBL-RepresentationTerms-1.0-beta.xsd <xsd:element name="Code" type="rt:CodeType" /> <xsd:complexType name="CodeType"> <xsd:simpleContent> <xsd:extension base="rt:CodeContentType"/> </xsd:simpleContent> </xsd:complexType> There is a another "CodeType" Type in CoreComponentTypes schema defined as following, but this is not referenced in other schemas. Why is types in Codelists derived not from cct:CodeType, but from rt:CodeType? Codes from common/UBL-CoreComponentTypes-1.0-beta.xsd <!-- ===== CCT: CodeType ===== --> <xsd:element name="Code" type="cct:CodeType" /> <xsd:complexType name="CodeType"> <xsd:simpleContent> <xsd:extension base="xsd:token"> <xsd:attribute name="listID" type="xsd:token" use="optional"/> <xsd:attribute name="listAgencyID" type="xsd:token" use="optional"/> <xsd:attribute name="listAgencyName" type="xsd:token" use="optional"/> <xsd:attribute name="listName" type="xsd:token" use="optional"/> <xsd:attribute name="listVersionID" type="xsd:token" use="optional"/> <xsd:attribute name="name" type="xsd:token" use="optional"/> <xsd:attribute name="languageID" type="xsd:language" use="optional"/> <xsd:attribute name="listURI" type="xsd:anyURI" use="optional"/> <xsd:attribute name="listSchemeURI" type="xsd:anyURI" use="optional"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> ------------------------------------------------------------- Thanks ----- Hiroshi Naito, Osaka Institute of Technology <http://www.oit.ac.jp/>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]