LibXML-1.0 API Documentation

From WowAce Wiki
Jump to: navigation, search

API Documentation

Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.

:ToXML(value , name , indent)

Arguments

value
any type - the structure to convert.
name
[string] - optional: the name of the top level tag. Defaults to "array".
indent
[number] - optional: the initial number of indentation spaces. Defaults to 0.

Notes

  • Converts a LUA data structure to XML
  • Magic Key: ["_XML_NAME"] specifies how implicit indexed array elements should be named
  • Magic Key: ["_XML_TAG_variableName"] variableName will be considered a standalone XML tag with a value property rather than a property of the parent tag
  • ["_XML_TAG_numFingers"] = 5
    results in the same string as
    numFingers = { value = 5 }
    Use what fits your needs.

Returns

string - the XML string

Example

    tree = {
        numBranches = 10,
        ["branches"] = {
            ["_XML_NAME"] = "leaf",
            {
                ["color"] = "green",
                ["shape"] = "round",
            }
        }
        ["_XML_TAG_rind"] = "rough",
        height = { 
            value = 150
        }
    }
	XML = LibXML:ToXML(tree, "Root")
     <Root numBranches=10>
         <rind value="rough/>
         <branches>
             <leaf color="green" shape="round"/>
         </branches>
         <height value=150/>
     </Root>