TorqueScript Reference
Public Member Functions | List of all members
SimXMLDocument Class Reference

#include <SimXMLDocument_ScriptBinding.h>

Inherits SimObject.

Public Member Functions

void addComment (string comment)
 
void addData (string text)
 
void addHeader ()
 
void addNewElement (string name)
 
void addText (string text)
 
String attribute (string attribute)
 
Boolean attributeExists (string attribute)
 
Float attributeF32 (string attribute)
 
Integer attributeS32 (string attribute)
 
void clear ()
 
void clearError ()
 
String elementValue ()
 
String firstAttribute ()
 
String getData ()
 
String getErrorDesc ()
 
String getText ()
 
String lastAttribute ()
 
Integer loadFile (string fileName)
 
String nextAttribute ()
 
Boolean nextSiblingElement (string name)
 
Integer parse (string txtXML)
 
void popElement ()
 
String prevAttribute ()
 
Boolean pushChildElement (int index)
 
Boolean pushFirstChildElement (string name)
 
void pushNewElement (string name)
 
String readComment (S32 index)
 
void removeText ()
 
void reset ()
 
Integer saveFile (string fileName)
 
void setAttribute (string attributeName, string attributeValue)
 
void setObjectAttributes (string attributeValue)
 
- Public Member Functions inherited from SimObject
void assignFieldsFrom (SimObject)
 
Integer clone ([copyDynamicFields=false]?)
 
void delete ()
 
Integer getId ()
 
void setName (newName)
 
String getName ()
 
String getClassNamespace ()
 
String getSuperClassNamespace ()
 
void setClassNamespace (nameSpace)
 
void setSuperClassNamespace ()
 
Boolean isMethod (string methodName)
 
String call (methodName, [args] *)
 
void dumpClassHierarchy ()
 
void dump ()
 
Boolean isMemberOfClass (string classname)
 
String getClassName ()
 
String getFieldValue (fieldName)
 
Boolean setFieldValue (fieldName, value)
 
Boolean setEditFieldValue (fieldName, value)
 
Integer getDynamicFieldCount ()
 
String getDynamicField (index)
 
Integer getFieldCount ()
 
String getField (int index)
 
void setProgenitorFile (file)
 
String getProgenitorFile ()
 
Integer getType ()
 
String getFieldType (fieldName)
 
void setInternalName (string InternalName)
 
String getInternalName ()
 
Boolean isChildOfGroup (groupID)
 
Integer getGroup ()
 
Boolean startTimer (callbackFunction, float timePeriod, [repeat]?)
 
void stopTimer ()
 
Boolean isTimerActive ()
 
Integer schedule (time, command, [arg] *)
 
void startListening (SimObject)
 
void stopListening (SimObject)
 
void addListener (SimObject)
 
void removeListener (SimObject)
 
void removeAllListeners ()
 
void postEvent (String eventName, String data)
 
Boolean save (fileName, [selectedOnly]?)
 
void addFieldFilter (fieldName)
 
void removeFieldFilter (fieldName)
 

Member Function Documentation

◆ addComment()

void addComment ( string  comment)

Add the given comment as a child of current stack element.

Parameters
commentThe desired comment to add
Returns
No return value.

◆ addData()

void addData ( string  text)

Add the given text as a child of current stack element.

Parameters
Thedesired text to add
Returns
No return value

◆ addHeader()

void addHeader ( )

Add XML header to document.

Returns
No return value.

◆ addNewElement()

void addNewElement ( string  name)

Create new element as child of current stack element and push new element on to stack.

Parameters
nameThe anme of the new element
Returns
No return value

◆ addText()

void addText ( string  text)

Add the given text as a child of current stack element.

Parameters
textThe desired text to add
Returns
No return value.

◆ attribute()

String attribute ( string  attribute)

Get attribute value if it exists.

Parameters
attributeThe desired SimXMLDocument attribute
Returns
Returns the value of the attribute as a string, or an empty string on failure

◆ attributeExists()

Boolean attributeExists ( string  attribute)

Get true if named attribute exists.

Parameters
attributeThe desired attribute's name
Returns
Returns true if attribute exists and false otherwise

◆ attributeF32()

Float attributeF32 ( string  attribute)

Get attribute value if it exists.

Parameters
attributeThe desired SimXMLDocument attribute
Returns
Returns the value of the attribute converted to 32-bit floating-point value from string

◆ attributeS32()

Integer attributeS32 ( string  attribute)

Get attribute value if it exists.

Parameters
attributeThe desired SimXMLDocument attribute
Returns
Returns the value of the attribute converted to 32-bit integer value from string

◆ clear()

void clear ( )

Clear contents of XML document.

Returns
No return value

◆ clearError()

void clearError ( )

Clear error description.

Returns
No return value

◆ elementValue()

String elementValue ( )

Get element value if it exists.

Returns
A string with the desired value, or empty if not found.

◆ firstAttribute()

String firstAttribute ( )

Obtain the name of the current element's first attribute.

Returns
A string with the name of the first attribute

◆ getData()

String getData ( )

Gets the text from the current stack element.

Returns
Returns the desired text or empty string if failed (no text)

◆ getErrorDesc()

String getErrorDesc ( )

Get current error description.

Returns
Returns a string with the error description

◆ getText()

String getText ( )

Gets the text from the current stack element.

Returns
Returns the desired text, or empty string on failure

◆ lastAttribute()

String lastAttribute ( )

Obtain the name of the current element's last attribute.

Returns
A string with the name of the last attribute

◆ loadFile()

Integer loadFile ( string  fileName)

Load file from given filename.

Parameters
fileNameThe name of the desired file
Returns
Returns 1 on success and 0 otherwise

◆ nextAttribute()

String nextAttribute ( )

Get the name of the next attribute for the current element after a call to firstAttribute().

Returns
A string with the name of the next attribute

◆ nextSiblingElement()

Boolean nextSiblingElement ( string  name)

Set top element on stack to next element with given name.

Parameters
nameThe name of the element.
Returns
Returns true on success, false otherwise

◆ parse()

Integer parse ( string  txtXML)

Create document from XML string.

Parameters
txtXMLThe text of the XML document
Returns
Returns 1 on success

◆ popElement()

void popElement ( )

Pop last element off of stack.

Returns
No return value

◆ prevAttribute()

String prevAttribute ( )

Get the name of the previous attribute for the current element after a call to lastAttribute().

Returns
A string with the name of the previous attribute

◆ pushChildElement()

Boolean pushChildElement ( int  index)

Push the child element at the given index onto stack.

Parameters
indexA nonnegative integer representing the index of the child element
Returns
Returns true on success, and false otherwise

◆ pushFirstChildElement()

Boolean pushFirstChildElement ( string  name)

Push first child element with given name onto stack.

Parameters
nameThe name of the child element
Returns
returns true on success, false otherwise.

◆ pushNewElement()

void pushNewElement ( string  name)

Create new element as child of current stack element and push new element on to stack.

Parameters
nameThe anme of the new element
Returns
No return value

◆ readComment()

String readComment ( S32  index)

Returns the comment at the specified index.

Parameters
indexThe index of the desired comment as a nonnegative integer value
Returns
The comment as a string

◆ removeText()

void removeText ( )

Remove any text on the current stack element.

Returns
No return value

◆ reset()

void reset ( )

Set this to default state at construction.

Returns
No return value

◆ saveFile()

Integer saveFile ( string  fileName)

Save file to given filename.

Parameters
fileNameA string presenting the filename to save the XML document as
Returns
Returns 1 on success, and 0 otherwise

◆ setAttribute()

void setAttribute ( string  attributeName,
string  attributeValue 
)

Set attribute of top stack element to given value.

Parameters
attributeNameThe name of the attribute of the element you wish to set
attributeValueThe value you wish to set the given attribute to
Returns
No return value.

◆ setObjectAttributes()

void setObjectAttributes ( string  attributeValue)

Set attribute of top stack element to given value.

Parameters
attributeValueThe value you wish to set the given attribute to
Returns
No return value.