Share

XML file

[Desktop Automation]

An XML file object contains the full information of an XML file. It is used to read XML information from the disk as well as output information in the XML format to disk or to stdout.

Properties

Property Read/write Type Description
childcount read-only Number Returns the number of XML nodes of the root entry
root read Object Query the root node as XMLNode object
rootname read/write String Section name of the root entry
useattributesaschildren Read/write Boolean Should attributes be treated as child nodes?

Back to top

Methods

Name Syntax Description
addchild xmlfile:Addchild(childname:string, adddouble:Boolean); Adds child node, adddouble allows for duplicates
addvalue xmlfile:addvalue(nodename:string, value:string/int); Adds a value to the XML file
childexists xmlfile:childexists(nodename:string); Returns if nodename in the XML file exists
dump xmlfile:dump() Dumps the XML file on stdout even when the cloud utilities are in quiet mode.
findchild Childnode = xmlfile:Findchild(childname:string); Finds child node of specified name
getchildint ChildIntvalue = xmlfile:Getchildint(child:string); Gets the integer value of child node
getchildindexed Childvalue = xmlfile:Getchildindexed(childindex:string); Returns child value by index
getchildintdef ChildIntvalue = xmlfile:Getchildintdef(child:string;value:number); Gets the Integer value of child or value
getchildfloat ChildIntvalue = xmlfile:Getchildfloat(child:string); Gets Float value of child node
getchildfloatdef ChildFloatvalue = xmlfile:Getchildintdef(child:string;value:number); Gets Float value of child node or value
getchildvalue Childvalue = xmlfile:Getchildvalue(childname:string); Returns child value
savetofile xmlfile:savetofile(filename:string); Writes the XML file to disk
writetostring xmlfile:writetostring() Returns a string with the contents of the XML

Back to top

Examples

Name Syntax Description
childexists xmlfile:childexists("parameters/fixingmode", 2); Boolean: returns true when the desired node exists
addvalue xmlfile:addvalue("parameters/fixingmode", 2); -
savetofile xmlfile:savetofile("var/log/test.xml"); -
dump xmlfile:dump() -

Back to top

Was this information helpful?