LibXML-1.0 API Documentation
From WowAce Wiki
Contents |
[edit]
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
[edit]
:ToXML(value , name , indent)
[edit]
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.
[edit]
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 asnumFingers = { value = 5 }Use what fits your needs.
[edit]
Returns
string - the XML string
[edit]
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>

