-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Mapping raw data to XML is ambiguous. There may be data that can't be mapped, or the user may want it to be mapped differently.
To make it easier to define how the data should be mapped, allow metainformation to be placed inside the schema, in xsd:annotation/xsd:appInfo tags. Define the data that can be specified in a schema, and support reading and interpreting it.
As an example, take this schema fragment:
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute use="required" type="xsd:string" name="key"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>This should be mapped to the following data (here represented in JSON):
{
"name" : "Frank",
"job" : "-",
"age" : 35
}There's no defined way to map this. To solve the problem, the following metainfo would be placed in the xsd:sequence element:
<xsd:annotation>
<xsd:appInfo>
<meta:transform>
<meta:hash-to-xml>
<meta:key xpath="@key"/>
<meta:value xpath="."/>
</meta:hash-to-xml>
</meta:transform>
</xsd:appInfo>
</xsd:annotation>These instructions would map the array to item elements, with the key as attribute and the value as element content:
<item key="name">Frank</item>
<item key="job">-</item>
<item key="age">35</item>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels