-
Notifications
You must be signed in to change notification settings - Fork 82
Simplified Mapping Style
highsource edited this page Feb 28, 2015
·
6 revisions
Simplified mapping style differs from the standard mapping style in the way the root element and element references are mapped. Instead of using name/value structure:
{ name : <elementName>, value: <elementValue> }the simplified mapping style just does
{ <elementName> : <elementValue> }The <elementName> is turned into string using the configured namespace prefixes.
This also applies to the any attribute property.
- Root element
- Attributes
- Elements
Example.
XML:
<value attribute="check">test</value>JS:
{
value : {
value : "test",
attribute : "check"
}
}Example.
Fragment of the mapping:
{
name: "otherAttributes",
type: "anyAttribute"
}XML:
<anyAttribute xmlns:a="urn:a" xmlns:b="urn:b" a:a="a" b:b="b">test</anyAttribute>JS:
{
otherAttributes : {
"xmlns:a" : "urn:a",
"xmlns:b" : "urn:b",
"a:a" : "a",
"b:b" : "b"
}
}Fragment of the mapping:
{
name: 'base',
collection: true,
elementName: 'base',
typeInfo: 'Zero.BaseType',
type: 'elementRef'
}XML:
<elementRef><base><alpha>one</alpha><beta>2</beta></base></elementRef>JS:
{
base : [ {
base : {
alpha : "one",
beta : [ 2 ]
}
} ]
}Fragment of the mapping:
{
name: 'alphaOrBeta',
collection: true,
elementTypeInfos: [{
elementName: 'beta',
typeInfo: 'Zero.ValueType'
}, {
elementName: 'alpha',
typeInfo: 'Zero.ValueType'
}],
type: 'elementRefs'
}XML:
<elementRefs><alpha>one</alpha><beta>2</beta></elementRefs>JS:
{
alphaOrBeta : [ {
alpha : {
value : "one"
}
}, {
beta : {
value : "2"
}
} ]
}Fragment of the mapping:
{
name: 'any',
domAllowed: true,
typedObjectAllowed: true,
type: 'anyElement'
}XML:
<anyElementLax><string>test</string></anyElementLax>JS:
{
any : {
string : "test"
}
}