TorqueScript Reference

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
SimXMLDocument Class Reference

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
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)
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]*)
Boolean | save (fileName, [selectedOnly]?)
void | addFieldFilter (fieldName)
void | removeFieldFilter (fieldName)

## Member Function Documentation

void addComment | ( | string | comment | ) |

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

Parameters

  comment | The desired comment to add

Returns
  No return value.

void addData | ( | string | text | ) |

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

Parameters

  The | desired text to add

Returns
  No return value

void addHeader | ( |  | ) |

Add XML header to document.

Returns
  No return value.

void addNewElement | ( | string | name | ) |

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

Parameters

  name | The anme of the new element

Returns
  No return value

void addText | ( | string | text | ) |

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

Parameters

  text | The desired text to add

Returns
  No return value.

String attribute | ( | string | attribute | ) |

Get attribute value if it exists.

Parameters

  attribute | The desired SimXMLDocument attribute

Returns
  Returns the value of the attribute as a string, or an empty string on failure

Boolean attributeExists | ( | string | attribute | ) |

Get true if named attribute exists.

Parameters

  attribute | The desired attribute's name

Returns
  Returns true if attribute exists and false otherwise

Float attributeF32 | ( | string | attribute | ) |

Get attribute value if it exists.

Parameters

  attribute | The desired SimXMLDocument attribute

Returns
  Returns the value of the attribute converted to 32-bit floating-point value from string

Integer attributeS32 | ( | string | attribute | ) |

Get attribute value if it exists.

Parameters

  attribute | The desired SimXMLDocument attribute

Returns
  Returns the value of the attribute converted to 32-bit integer value from string

void clear | ( |  | ) |

Clear contents of XML document.

Returns
  No return value

void clearError | ( |  | ) |

Clear error description.

Returns
  No return value

String elementValue | ( |  | ) |

Get element value if it exists.

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

String firstAttribute | ( |  | ) |

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

Returns
  A string with the name of the first attribute

String getData | ( |  | ) |

Gets the text from the current stack element.

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

String getErrorDesc | ( |  | ) |

Get current error description.

Returns
  Returns a string with the error description

String getText | ( |  | ) |

Gets the text from the current stack element.

Returns
  Returns the desired text, or empty string on failure

String lastAttribute | ( |  | ) |

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

Returns
  A string with the name of the last attribute

Integer loadFile | ( | string | fileName | ) |

Load file from given filename.

Parameters

  fileName | The name of the desired file

Returns
  Returns 1 on success and 0 otherwise

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

Boolean nextSiblingElement | ( | string | name | ) |

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

Parameters

  name | The name of the element.

Returns
  Returns true on success, false otherwise

Integer parse | ( | string | txtXML | ) |

Create document from XML string.

Parameters

  txtXML | The text of the XML document

Returns
  Returns 1 on success

void popElement | ( |  | ) |

Pop last element off of stack.

Returns
  No return value

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

Boolean pushChildElement | ( | int | index | ) |

Push the child element at the given index onto stack.

Parameters

  index | A nonnegative integer representing the index of the child element

Returns
  Returns true on success, and false otherwise

Boolean pushFirstChildElement | ( | string | name | ) |

Push first child element with given name onto stack.

Parameters

  name | The name of the child element

Returns
  returns true on success, false otherwise.

void pushNewElement | ( | string | name | ) |

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

Parameters

  name | The anme of the new element

Returns
  No return value

String readComment | ( | S32 | index | ) |

Returns the comment at the specified index.

Parameters

  index | The index of the desired comment as a nonnegative integer value

Returns
  The comment as a string

void removeText | ( |  | ) |

Remove any text on the current stack element.

Returns
  No return value

void reset | ( |  | ) |

Set this to default state at construction.

Returns
  No return value

Integer saveFile | ( | string | fileName | ) |

Save file to given filename.

Parameters

  fileName | A string presenting the filename to save the XML document as

Returns
  Returns 1 on success, and 0 otherwise

void setAttribute | ( | string | attributeName,
|  | string | attributeValue
| ) |  |

Set attribute of top stack element to given value.

Parameters

  attributeName | The name of the attribute of the element you wish to set
  attributeValue | The value you wish to set the given attribute to

Returns
  No return value.

void setObjectAttributes | ( | string | attributeValue | ) |

Set attribute of top stack element to given value.

Parameters

  attributeValue | The value you wish to set the given attribute to

Returns
  No return value.