Download presentation
Presentation is loading. Please wait.
1
Discussion on XSD open issues
PRO Discussion on XSD open issues Group Name: PRO WG Source: Qualcomm Inc., Wolfgang Granzow Meeting Date: PRO#24.2, Agenda Item: TS-0004 / XSD
2
Background Contribution PRO suggested a number of changes required to handle <flexContainer> specializations, which may use namespace prefixes other than “m2m:”: as children of <CSEBase>, <remoteCSE>, <AE> and <container> resources when included into primitiveContent At PRO#24, required corrections to TS-0004 have been agreed However, the decision was postponed how to update the XSD to reflect the TS-0004 changes, simply due to lack of discussion time There are essentially two XML concepts suitable to address the problem: use of substitution groups use of wildcard elements This contribution reviews both concepts and proposes a solution how to change the XSD © 2016 oneM2M Partners PRO
3
Use of substitution groups
A substitution group is a feature of XML schema that allows to specify global elements which can replace another global element in an XML representation The replaceable element is called head element of the substitution group Each element of a substitution group must be derived from the same datatype as the head element The inheritance model used for grouping of common and universal attributes lends itself to the creation of substitution groups © 2016 oneM2M Partners PRO
4
Definition of substitution groups
The following XSD global element declarations define suitable head elements which can be used as placeholders for a corresponding resource type prefix “sg_” is used here to emphasize that each element defines a head element of a substitution group (the name “resource” cannot be reused because it is already defined for another purpose) <xs:element name="sg_resource" type="m2m:resource" abstract="true" /> <xs:element name="sg_regularResource" type="m2m:regularResource" abstract="true" /> <xs:element name="sg_announcedResource" type="m2m:announcedResource" abstract="true" /> <xs:element name="sg_announceableResource" type="m2m:announceableResource" abstract="true"/> <xs:element name="sg_subordinateResource" type="m2m:subordinateResource" abstract="true" /> <xs:element name="sg_announceableSubordinateResource" type="m2m:announceableSubordinateResource" abstract="true" /> <xs:element name="sg_announcedSubordinateResource" type="m2m:announcedSubordinateResource" abstract="true" /> <xs:element name="sg_mgmtResource" type="m2m:mgmtResource" abstract="true" /> <xs:element name="sg_announcedMgmtResoure" type="m2m:announcedMgmtResource" abstract="true" /> <xs:element name="sg_flexContainerResource" type="m2m:flexContainerResource" abstract="true" /> <xs:element name="sg_announcedFlexContainerResource" type="m2m:announcedFlexContainerResource" abstract="true" /> Global elements defined in each resourceType-specific XSD file, need to be assigned to a substitution group (i.e. both normal and announced resource type names: <xs:element name="container" substitutionGroup="m2m:sg_announceableResource"> <xs:complexType> <xs:complexContent> <xs:extension base="m2m:announceableResource"> <xs:sequence> … </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element> © 2016 oneM2M Partners PRO
5
Use of substitution groups
Allows more compact representation of datatypes which otherwise consist of long lists of references to resource types Example: datatype m2m:resourceWrapper Present definition: <xs:complexType name="resourceWrapper"> <xs:sequence> <xs:choice minOccurs="1" maxOccurs="1"> <xs:element ref="m2m:accessControlPolicy" /> <xs:element ref="m2m:activeCmdhPolicy" /> <xs:element ref="m2m:AE" /> … <xs:element ref="m2m:software" /> <xs:element ref="m2m:statsCollect" /> <xs:element ref="m2m:statsConfig" /> <xs:element ref="m2m:subscription" /> </xs:choice> <xs:element name="URI" type="xs:anyURI" /> </xs:sequence> </xs:complexType> © 2016 oneM2M Partners PRO
6
Use of substitution groups
Redefinition of m2m:resourceWrapper based on substitution groups: <xs:complexType name="resourceWrapper"> <xs:sequence> <xs:choice minOccurs="1" maxOccurs="1"> <xs:element ref="m2m:sg_resource" /> <xs:element ref="m2m:sg_regularResource" /> <xs:element ref="m2m:sg_announceableResource" /> <xs:element ref="m2m:sg_announcedResource" /> <xs:element ref="m2m:sg_subordinateResource" /> <xs:element ref="m2m:sg_announcedSubordinateResource" /> <xs:element ref="m2m:sg_announceableSubordinateResource" /> <xs:element ref="m2m:sg_mgmtResource" /> <xs:element ref="m2m:sg_announcedMgmtResoure" /> <xs:element ref="m2m:sg_flexContainerResource" /> <xs:element ref="m2m:sg_announcedFlexContainerResource" /> </xs:choice> <xs:element name="URI" type="xs:anyURI" /> </xs:sequence> </xs:complexType> © 2016 oneM2M Partners PRO
7
Use of substitution groups
When substituting a head element in an XML representation by some other global element, the XSD of that global element must be known to the schema validation tool There is no way to skip schema validation for undefined elements Elements not found cause schema validation errors This means the schema of all applicable global elements still must be made available to the XML processor for schema validation © 2016 oneM2M Partners PRO
8
Use of wildcard elements
Wildcard elements is a feature of XML schema that allows to include global elements with yet unspecified XSD The current definition of datatype m2m:primitiveContent uses such wildcard element: <xs:complexType name="primitiveContent"> <xs:sequence> <xs:any namespace=" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> processContents attribute set to “lax” means that the XML processor will validate elements and attributes for which it can obtain schema information, but it will not signal errors for those it cannot obtain any schema information © 2016 oneM2M Partners PRO
9
Use of wildcard elements
The present definition of m2m:primitiveContent does not allow to include elements with a namespace prefix other than “m2m:” This can be fixed as follows: <xs:complexType name="primitiveContent"> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:any namespace=" processContents="lax" /> <xs:any namespace="##other" processContents="lax" /> </xs:choice> </xs:complexType> In a future XSD version, the wildcard used for elements with m2m: prefix should be replaced by explicit references to the permitted global elements as defined in Tables and 7.5.2‑2 of TS-0004. © 2016 oneM2M Partners PRO
10
Proposal (1) Define substitution groups in CDT-commonTypes as shown on slide 4 Apply substitution groups to redefine m2m:resourceWrapper in CDT-primitiveContent as shown on slide 6 to include flexContainer specializations in CDT-CSEBase, CDT-remoteCSE, CDT-AE and CDT-container by adding child resource references <xs:element ref="m2m:sg_flexContainerResource" /> (for both normal and announced types) <xs:element ref="m2m:sg_announcedFlexContainerResource" /> (for announced types) In each XSD file which defines a resource type, add the assignment of the substitution group to each global element declaration, e.g. in CDT-container: <xs:element name="container" substitutionGroup="m2m:sg_announceableResource"> <xs:element name="containerAnnc“ substitutionGroup="m2m:sg_announcedResource"> © 2016 oneM2M Partners PRO
11
Proposal (2) NOTE: Addition of substitutionGroup attribute needs to be done also for resource types associated with TS-0023 (Home Appliances) Redefine m2m:primitiveContent in CDT-commonTypes as shown on slide 9 by adding wildcard choice enabling elements with prefix other than “m2m:” © 2016 oneM2M Partners PRO
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.