This ticket contains documentation on functions that manipulate XML data.
(typGetXML {unid}) -> XML data reference
: This function returns a reference to XML data representing the type's source code.(xmlAppendSubElement {xml} {subelement} [index]) -> True/Nil
Inserts an XML element in another XML element as a subelement before any existing subelement atindex
(0-indexed). Ifindex
is not specified, then the subelement is appended to the end.(xmlAppendText {xml} {text} [index]) -> True/Nil
: Appends string text to an XML element before any existing subelement atindex
(0-indexed). Ifindex
is not specified, the text is appended to the end. Text resides between subelements, though typically an element should not contain both text and subelements.(xmlCreate {xml}) -> xml
: If given XML data, then creates a copy of it and returns a reference to that copy. Functions applied to such a reference will not affect the original data. If given string data, attempts to convert the string to XML data (ensuring that it is well-formed) and returns a reference if successful and an error otherwise.(xmlDeleteSubElement {element} {index}) -> True/Nil
: Deletes the XMLelement
's subelement at the specifiedindex
(0-indexed), returningTrue
ifindex
is lower than theelement
's subelement count (thus referring to a valid subelement) andNil
otherwise.(xmlGetAttrib {element} {attrib}) -> value
: Returns the value of the XMLelement
's specified attribute, orNil
if the attribute is not defined.(xmlGetAttribList {element}) -> string list
: Returns a string list containing the names of all attributes defined on the XMLelement
.(xmlGetSubElement {element} {tag|index}) -> subelement
: Retrieves from the XMLelement
a reference to the first subelement with the giventag
or the subelement at the specifiedindex
(if within range), if any exist. ReturnsNil
otherwise. Any functions applied to the subelement will affect the XML element that it came from.(xmlGetSubElementCount {element}) -> number of subelements
: Counts the subelements inelement
.(xmlGetSubElementList {element} [tag]) -> list of subelements
: Returns a list of references to the XML data of all the subelements inelement
. Any functions applied to the items will affectelement
.(xmlGetTag {xml}) -> tag
Thetag
of anelement
is the name of that element. For instance, the tag of<Events></Events>
isEvents
.(xmlGetText {element} {index}) -> text
: Gets theelement
's text data located before the subelement at the specified index. Typically, XML elements should not contain both subelements and text, so the index is usually 0.(xmlSetAttrib {element} {attrib} {value}) -> value
: Sets the attribute and its value in the specifiedelement
, overwriting any existing attribute.(xmlSetText {element} {text} [index]) -> True/Nil
: Sets theelement
's text data located before the subelement at the specifiedindex
. Text data includes the newlines and whitespace between subelements, and any code block contained in the element. Typically, XML elements should not contain both subelements and text, so the index is usually 0.
relanat 22 Mar 2019:
Excellent work. Very handy. Thanks.
Resolve
Archive
Reopen
Create
Edit
Save
Attach File
Cancel Edit