-
Notifications
You must be signed in to change notification settings - Fork 82
Standard Mapping Style
highsource edited this page Feb 27, 2015
·
20 revisions
Standard mapping style is a mapping style used by Jsonix by default.
- Root element
- Character content
- Attributes
- Elements
Example.
XML:
<value attribute="check">test</value>
JS:
{
name : { localPart : "value", namespaceURI : "", prefix : "" },
value : ...
}
Example.
Fragment of the mapping:
{
name: 'value',
typeInfo: 'String',
type: 'value'
}
XML:
<value attribute="check">test</value>
JS:
{
value : "test"
}
# Attributes
## Attribute property
Example.
Fragment of the mapping:
```javascript
{
name: 'string',
attributeName: 'string',
type: 'attribute'
}
XML:
<attribute string="zero" integers="1 2">test</attribute>
JS:
{
string : "zero"
}
Example.
Fragment of the mapping:
{
name: 'otherAttributes',
type: 'anyAttribute'
}
XML:
<anyAttribute a="a" b="b">test</anyAttribute>
JS:
{
otherAttributes : {
a : "a",
b : "b"
}
}
Fragment of the mapping:
{
type: 'element',
name: 'element',
elementName: 'element',
typeInfo: 'String'
}
XML:
<element><element>one</element></element>
JS:
{
element : "one"
}
Fragment of the mapping:
{
name: 'stringOrInteger',
collection: true,
elementTypeInfos: [{
elementName: 'string',
typeInfo: 'String'
}, {
elementName: 'integer',
typeInfo: 'Integer'
}],
type: 'elements'
}
XML:
<elements><string>one</string><integer>2</integer></elements>
JS:
{
stringOrInteger : [ "one", 2 ]
}
Fragment of the mapping:
TODO
XML:
TODO
JS:
TODO
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 : [ {
name : { localPart : "base", namespaceURI : "", prefix : "" },
value : {
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 : [ {
name : { localPart : "alpha", namespaceURI : "", prefix : "" },
value : {
value : "one"
}
}, {
name : { localPart : "beta", namespaceURI : "", prefix : "" },
value : {
value : "2"
}
} ]
}
Fragment of the mapping:
{
name: 'any',
domAllowed: true,
typedObjectAllowed: true,
type: 'anyElement'
}
XML:
<anyElementLax><string>test</string></anyElementLax>
JS:
{
any : {
name : { localPart : "string", namespaceURI : "", prefix : "" },
value : "test"
}
}