Jsonix Any Attribute Property
HTML
<script src="https://rawgithub.com/highsource/jsonix/master/dist/Jsonix-all.js"></script>
JavaScript
var MyModule = {
name: 'MyModule',
typeInfos: [{
type: 'classInfo',
localName: 'AnyAttributeType',
propertyInfos: [{
type: 'anyAttribute',
name: 'attributes'
}]
}],
elementInfos: [{
elementName: 'anyAttribute',
typeInfo: 'MyModule.AnyAttributeType'
}]
};
var context = new Jsonix.Context([MyModule], {
namespacePrefixes: {
'as': 'b',
'ed': 'c'
}
});
var unmarshaller = context.createUnmarshaller();
var unmarshalled = unmarshaller.unmarshalString('<anyAttribute xmlns:b="as" xmlns:c="ed" a="a" b:as="b" c:ed="c"/>');
console.log(unmarshalled);
var marshaller = context.createMarshaller();
var marshalled = marshaller.marshalString({
name: {
localPart: 'anyAttribute'
},
value: {
attributes: {
a: 'a',
'{urn:b}b': 'b',
'{urn:c}c': 'c'
}
}
});
console.log(marshalled);