Skip to content
highsource edited this page Jan 4, 2015 · 5 revisions

Compact Naming

Supported by Jsonix since version 2.1.0 and Jsonix Schema Compiler from version 2.2.0.

This feature is not backwards compatible - older Jsonix versions will not be able to read mappings with compact naming. However, newer version of Jsonix (2.1.0 and up) will stil read your "normal" (i.e. not compact) mappings. There are no plans to drop normal mappings.

Jsonix Schema Compiler 2.2.0 and up generate normal mappings by default but have a switch to generate compact mappings instead.

In order to reduce the size of mapping scripts, Jsonix offers compact naming. You can just replace long property names in mappings with their short versions.

Compact naming drastically reduces the size of the mapping files, you can expect 25-50% reduction in size.

The following sections list compact names corresponding to the full names as well as their default values.

Module

|Name|Compact name|Default value|Description|

----
-------------
-----------
name
defaultElementNamespaceURI
defaultAttributeNamespaceURI
typeInfos
elementInfos

Element infos

|Name|Compact name|Default value|Description|

----
-------------
-----------
defaultElementNamespaceURI
defaultAttributeNamespaceURI
elementName
If it is a string, the qualified name will be formed using the defaultElementNamespaceURI
typeInfo
substitutionHead
scope

Type infos

|Name|Compact name|Default value|Description|

----
-------------
-----------
type
classInfo
enumInfo
list
localName
name

List

|Name|Compact name|Default value|Description|

----
-------------
-----------
`baseTypeInfo
`
`
separator

Enum

|Name|Compact name|Default value|Description|

----
-------------
-----------
baseTypeInfo
values

Class

|Name|Compact name|Default value|Description|

----
-------------
-----------
defaultElementNamespaceURI
defaultAttributeNamespaceURI
baseTypeInfo
instanceFactory
properties

Properties

|Name|Compact name|Default value|Description|

----
-------------
-----------
name
defaultElementNamespaceURI
defaultAttributeNamespaceURI
collection
type

Mapping properties above apply to all properties.

Property types

|Name|Compact name|Default value|Description|

----
-------------
-----------
anyAttribute
anyElement
attribute
elementMap
element
elements
elementRef
elementRefs
value
Any attribute property

Any attribute property does not have any additional mapping parameters.

Any element property

|Name|Compact name|Default value|Description|

----
-------------
-----------
allowDom
allowTypedObject
mixed
Attribute property

|Name|Compact name|Default value|Description|

----
-------------
-----------
attributeName
typeInfo
Element map property

|Name|Compact name|Default value|Description|

----
-------------
-----------
elementName
wrapperElementName
key
value
Element property

|Name|Compact name|Default value|Description|

----
-------------
-----------
elementName
wrapperElementName
typeInfo
Elements property

|Name|Compact name|Default value|Description|

----
-------------
-----------
wrapperElementName
elementTypeInfos
Elements property - element type infos

|Name|Compact name|Default value|Description|

----
-------------
-----------
elementName
typeInfo
Element reference property

|Name|Compact name|Default value|Description|

----
-------------
-----------
elementName
wrapperElementName
mixed
Element references property

|Name|Compact name|Default value|Description|

----
-------------
-----------
wrapperElementName
mixed
elementTypeInfos
Element references property - element type infos

|Name|Compact name|Default value|Description|

----
-------------
-----------
elementName
typeInfo
Value property

|Name|Compact name|Default value|Description|

----
-------------
-----------
typeInfo

Qualified names

|Name|Compact name|Default value|Description|

----
-------------
-----------
localPart
namespaceURI
prefix

Type names

Since Jsonix version 2.1.0.

When referencing types within the same module, you can use the compact syntax .MyType instead of the full name MyModule.MyType.

Example:

Five = {
	n : 'Five',
	tis : [ {
		ln : 'ValueType',
		ps : [ {
			t : 'v',
			n : 'value'
		} ]
	}, {
		ln : 'ElementsType',
		ps : [ {
			t : 'es',
			n : 'ab',
			etis : [ {
				en : 'a',
				// We can use .ValueType instead of Five.ValueType
				ti : '.ValueType'
			}, {
				en : 'b',
				ti : 'Integer'
			} ]
		} /*...*/ ],
	} ],
	eis : [ /* ... */ ]
};

Clone this wiki locally