About data types - tooltwist/xdata GitHub Wiki
An XData object has to ability to store it's data in multiple formats at the same time.
Typically, it will contain a string version of the data, and also a parsed version which can be used to access specific elements within the data.
Each data type has a base type, and a subtype. For example, for xml-string the base type is xml and the subtype is string. Every base type will have a data type with a subtype of string.
Every data type that is not of subtype string will have the ability to convert it's base type from it's string representation to it's internal parsed format and back again.
Selecting data from the XData object is only possible with a non-string data type, which supports the XSelectable interface.
The XD Class
The XD class maintains a list with one slot for each know data type. These slots are mostly empty but there will always be at least one slot that is not empty.
If you call data.getString(), the XD object will look through the list for a slot containing a string representation of the data. If none can be found it looks through the list again to see if data exists in a non-string data format, which it will convert into a string and place in a string data type's slot.
Similarly, if you wish to access a specific non-string data type, it will look in the slot for that data type. If the slot is empty it will look in the string version of that base type, and convert the string into an non-string object which it will place into the appropriate slot.
In short - if you ask for a specific data type, it will convert types as required.
Built-In Data Types
By default, the XData package supports the following types:
xml-string xml-dom xml-fast json-string json-fast
Adding Data Types
Custom data types can be added at any time by registering them