cachebox.system.core.conversion

Class XMLConverter

lucee.Component
    extended by cachebox.system.core.conversion.XMLConverter

A utility tool that can marshall data to XML

Class Attributes:
  • singleton
  •  
  • output : false
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Constructor Summary
    init()
    Method Summary
    string arrayToXML(array data, [boolean useCDATA='false'], string rootName='')
         Converts an array into XML with no headers.
    private Util getUtil()
         Create and return a util object.
    string objectToXML(any data, [boolean useCDATA='false'], string rootName='')
         Converts an object(entity) into XML by inspecting its properties and then calling the appropriate getters on it.
    string queryToXML(query data, [string CDATAColumns=''], [string columnlist='[runtime expression]'], [boolean useCDATA='false'], string rootName='')
         Converts a query to XML with no headers.
    private string safeText(string txt, [boolean useCDATA='false'])
         Create a safe xml text.
    string structToXML(any data, [boolean useCDATA='false'], string rootName='')
         Converts a struct into XML with no headers.
    string toXML(any data, [string columnlist], [boolean useCDATA='false'], [boolean addHeader='true'], string encoding='UTF-8', [string delimiter=','], string rootName='')
         Convert any type of data to XML.
    private any translateValue(struct args, any targetValue)
         Translate a value into XML.
    private string unicodeWin1252(string value)
         Converts MS-Windows superset characters (Windows-1252) into their XML friendly unicode counterparts.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()


    Method Detail

    arrayToXML

    public string arrayToXML(array data, [boolean useCDATA='false'], string rootName='')

    Converts an array into XML with no headers.

    Parameters:
    data - The array to convert
    useCDATA - Use CDATA content for ALL values. False by default
    rootName - The name of the root element, else it defaults to the internal defaults.

    getUtil

    private Util getUtil()

    Create and return a util object


    objectToXML

    public string objectToXML(any data, [boolean useCDATA='false'], string rootName='')

    Converts an object(entity) into XML by inspecting its properties and then calling the appropriate getters on it.

    Parameters:
    data - The structure, object, any to convert.
    useCDATA - Use CDATA content for ALL values
    rootName - The name of the root element, else it defaults to the internal defaults.

    queryToXML

    public string queryToXML(query data, [string CDATAColumns=''], [string columnlist='[runtime expression]'], [boolean useCDATA='false'], string rootName='')

    Converts a query to XML with no headers.

    Parameters:
    data - The query to convert
    CDATAColumns - Which columns to wrap in cdata tags
    columnlist - Choose which columns to include in the translation, by default it uses all the columns in the query
    useCDATA - Use CDATA content for ALL values
    rootName - The name of the root element, else it defaults to the internal defaults.

    safeText

    private string safeText(string txt, [boolean useCDATA='false'])

    Create a safe xml text

    Parameters:
    txt
    useCDATA - Use CDATA content for ALL values

    structToXML

    public string structToXML(any data, [boolean useCDATA='false'], string rootName='')

    Converts a struct into XML with no headers.

    Parameters:
    data - The structure, object, any to convert.
    useCDATA - Use CDATA content for ALL values
    rootName - The name of the root element, else it defaults to the internal defaults.

    toXML

    public string toXML(any data, [string columnlist], [boolean useCDATA='false'], [boolean addHeader='true'], string encoding='UTF-8', [string delimiter=','], string rootName='')

    Convert any type of data to XML. This method will auto-discover the type. Valid types are array,query,struct

    Parameters:
    data - The data to convert to xml
    columnlist - Choose which columns to inspect, by default it uses all the columns in the query, if using a query
    useCDATA - Use CDATA content for ALL values. The default is false
    addHeader - Add an xml header to the packet returned.
    encoding - The character encoding of the header. UTF-8 is the default
    delimiter - The delimiter in the list. Comma by default
    rootName - The name of the root element, else it defaults to the internal defaults.

    translateValue

    private any translateValue(struct args, any targetValue)

    Translate a value into XML

    Parameters:
    args - The original argument collection
    targetValue - The value to translate

    unicodeWin1252

    private string unicodeWin1252(string value)

    Converts MS-Windows superset characters (Windows-1252) into their XML friendly unicode counterparts

    Parameters:
    value