Standard XML Representations of Field Data: Difference between revisions
From IHRIS Wiki
Line 24: | Line 24: | ||
===I2CE_FormField_DB_INT=== | ===I2CE_FormField_DB_INT=== | ||
===I2CE_FormField_DB_STRING=== | ===I2CE_FormField_DB_STRING=== | ||
<field type='STRING'>YYYY</field> where YYYY is: | |||
*If the string is less than 1000 characters | *If the string is less than 1000 characters | ||
**If the string does not contain a "<" character, then | **If the string does not contain a "<" character, then YYYY = <value>$value</value> | ||
**If the string contains as "<", then follow the rules for >= 1000 characters | **If the string contains as "<", then follow the rules for >= 1000 characters | ||
*If the string is >= 1000 characters: | *If the string is >= 1000 characters: | ||
**If the $value contains CDATA a string, | **If the $value contains CDATA a string, then YYYY= <value encoding='base64'>base64($value)</value> | ||
**If the $value does not contains "CDATA" then | **If the $value does not contains "CDATA" then YYYY= <value><![CDATA[$value]]><value> | ||
===I2CE_FormField_DB_TEXT=== | ===I2CE_FormField_DB_TEXT=== |
Revision as of 13:31, 1 December 2011
API
I2CE_FormField
- add in a (final) method getXMLData($as_node = false). Calls _getXMLData(). If $as_node == false, the simply pass it along. If $as_node == true, first convert it to a DOMNode and return that
- add in a abstract method _getXMLData() which return strings
Sub-Classes of I2CE_FormField
- each non-abstract class should implement _getXMLData()
XML Format
Each _getXMLData() should return a string that looks like <field type='XXX'>YYYY<field> where XXX is the form field type such as MAP, STRING, DATE_YMD, etc and YYY is as defined below
I2CE_FormField_BINARY_FILE
I2CE_FormField_DB_BLOB
I2CE_FormField_DOCUMENT
I2CE_FormField_IMAGE
I2CE_FormField_ASSOC_FLOAT
I2CE_FormField_ASSOC_INT
I2CE_FormField_ASSOC_LIST
I2CE_FormField_ASSOC_PERCENT
I2CE_FormField_BOOL
I2CE_FormField_DATE_HMS
I2CE_FormField_DATE_MD
I2CE_FormField_DATE_TIME
I2CE_FormField_DATE_Y
I2CE_FormField_DATE_YMD
I2CE_FormField_DB_DATE
I2CE_FormField_DB_INT
I2CE_FormField_DB_STRING
<field type='STRING'>YYYY</field> where YYYY is:
- If the string is less than 1000 characters
- If the string does not contain a "<" character, then YYYY = <value>$value</value>
- If the string contains as "<", then follow the rules for >= 1000 characters
- If the string is >= 1000 characters:
- If the $value contains CDATA a string, then YYYY= <value encoding='base64'>base64($value)</value>
- If the $value does not contains "CDATA" then YYYY= <value><![CDATA[$value]]><value>