XmlDocument
From Liberty Unleashed Wiki
This function adds a XML Element to the document given.
Syntax
XmlElement XmlElement( string ElementName )
Arguments
- ElementName - The name of the element you wish to add.
Example
This will load an XML document into the scripts and add an element to it, setting element's attribute to current time.
function onScriptLoad() { local myDocument = XmlDocument(); myDocument.LoadFile( "Example.xml" ); local element = XmlElement("Info"); element.SetAttribute( "Time", GetFullTime() ); myDocument.LinkChild( element ); myDocument.SaveFile(); }
Output
<Info Time="Wed Jul 03 16:37:54 2013" />
Notes
The callback onScriptLoad and the functions XmlDocument, XmlDocument.LoadFile, XmlElement.SetAttribute,XmlDocument.SaveFile were used in this example. More info about it is available in the corresponding pages.
Related Functions
- XmlDocument
- XmlDocument.Clear
- XmlDocument.FirstChild
- XmlDocument.LinkChild
- XmlDocument.LoadFile
- XmlDocument.Name
- XmlDocument.SaveFile
- XmlElement
- XmlElement.Clear
- XmlElement.FirstChild
- XmlElement.GetAttribute
- XmlElement.LinkChild
- XmlElement.LinkSibling
- XmlElement.Name
- XmlElement.NextSibling
- XmlElement.Parent
- XmlElement.RemoveAttribute
- XmlElement.RemoveChild
- XmlElement.RemoveSibling
- XmlElement.SetAttribute
- XmlElement.Text