This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Xml Class

Interface for xml manipulation.

To use this class, include the UnigineXml.h file.

Xml Class

Members


Xml ()

Default constructor that creates an empty instance.

Xml (const char * name, const char * args = 0)

Creates an Xml tree with a given node as a root.

Arguments

  • const char * name - Name of the node that will be a root.
  • const char * args - Optional arguments to the root node. If provided, they should be in this form:

    arg1=\"value1\" arg2=\"value2\" …

    If values do not contain spaces, escaped quotes can be omitted.

Xml (const Ptr<Xml> & xml)

Arguments

  • const Ptr<Xml> & xml

int setBoolArg (const char * name, int value)

Sets a boolean as xml argument.

Arguments

  • const char * name - The xml argument name.
  • int value - The xml argument value.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

int setArg (const char * name, const char * value)

Sets an xml argument.

Arguments

  • const char * name - The xml argument name.
  • const char * value - The xml argument value.

Return value

Returns 1 if the argument is set successfully; otherwise, 0.

String decode (const char * arg1)

Decodes special xml characters (less-than, greater-than, ampersand, double-quote and apostrophe) and numeric character references.

Arguments

  • const char * arg1 - Data to decode.

Return value

Decoded string.

void clearChildren ()

Clears all children of the current xml node.

int getIntArg (const char * name)

Gets an integer xml argument.

Arguments

  • const char * name - The xml argument name.

Return value

The result.

int getDoubleArrayData (out double[] dest)

Arguments

  • out double[] dest

Return value

Math::dmat4 getDMat4Arg (const char * name)

Returns a value of a given dmat4 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

int setDoubleArrayData (double[] src)

Arguments

  • double[] src

Return value

String getSubTree (const char * path = 0)

Converts an xml tree into the string.

Arguments

  • const char * path - Path to xml sub-tree.

Return value

The result.

int getIntData ()

Gets an integer xml data.

Return value

The result.

int getIntArrayData (out int[] dest)

Gets an array of integers from xml data.

Arguments

  • out int[] dest

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

int setIntArrayData (int[] src, int radix = 10)

Sets an array of integers as xml data in a given number notation. By default, the decimal number notation is used.

Arguments

  • int[] src
  • int radix

Return value

1 if the array is set successfully; otherwise, 0.

void setArgName (int num, const char * name)

Sets the xml argument name.

Arguments

  • int num - The argument number.
  • const char * name - The argument name.

int isArg (const char * name)

Checks if the xml has specified argument.

Arguments

  • const char * name - Name of xml argument.

Return value

The result.

int getStringArrayData (Vector< String > & dest)

Arguments

  • Vector< String > & dest

Return value

int getNumArgs ()

Returns the number of xml arguments.

Return value

The result.

float getFloatData ()

Returns a float interpretation of data stored in the node.

Return value

Data stored in the node.

int setIVec3Arg (const char * name, const Math::ivec3 & value)

Sets a value of a given ivec3 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::ivec3 & value - Value of an argument.

Return value

Always 1.

int setStringArrayData (const Vector< String > & src)

Arguments

  • const Vector< String > & src

Return value

int setDoubleArrayArg (const char * name, double[] src)

Arguments

  • const char * name
  • double[] src

Return value

const char * getArg (const char * name)

Gets an xml argument.

Arguments

  • const char * name - The xml argument name.

Return value

Value of the argument, if it is found; otherwise, NULL.

Math::dvec4 getDVec4Data ()

Returns a dvec4 interpretation of data stored in the node.

Return value

Data stored in the node.

Ptr<Xml> removeChild (const Ptr<Xml> & xml)

Removes an xml sub-tree.

Arguments

  • const Ptr<Xml> & xml - Xml sub-tree smart pointer.

Return value

Removed xml sub-tree.

int getBoolArg (const char * name, int value)

Gets a boolean xml argument.

Arguments

  • const char * name - Name of a target argument.
  • int value - Default value of the argument.

Return value

The result.

float getFloatArg (const char * name, float value)

Returns a value of a given float argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.
  • float value - Default value of the argument.

Return value

Argument value.

Math::dmat4 getDMat4Data ()

Returns a dmat4 matrix interpretation of data stored in the node.

Return value

Data stored in the node.

double getDoubleData ()

Returns a double interpretation of data stored in the node.

Return value

Data stored in the node.

String symbols (const char * arg1)

Replaces ampersand characters with character entity references.

Arguments

  • const char * arg1 - to encode.

Return value

String which contains replaced ampersand characters with character entity references.

int setFloatArrayData (float[] src)

Arguments

  • float[] src

Return value

int getFloatArrayData (out float[] dest)

Arguments

  • out float[] dest

Return value

void clearUnusedData ()

Clears the unused nodes and arguments.

double getDoubleArg (const char * name, double value)

Returns a value of a given double argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.
  • double value - Default value of the argument.

Return value

Argument value.

void setVec4Data (const Math::vec4 & data)

Sets a vec4 content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::vec4 & data - Content to set.

void setIVec4Data (const Math::ivec4 & data)

Sets a ivec4 content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::ivec4 & data - Content to set.

Math::vec4 getVec4Data ()

Returns a vec4 interpretation of data stored in the node.

Return value

Data stored in the node.

int getDoubleArrayArg (const char * name, out double[] dest)

Arguments

  • const char * name
  • out double[] dest

Return value

int setRawData (const char * data)

Sets a xml raw data.

Arguments

  • const char * data - The xml raw data.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

int getStringArrayArg (const char * name, Vector< String > & dest)

Arguments

  • const char * name
  • Vector< String > & dest

Return value

int setFloatArrayArg (const char * name, float[] src)

Arguments

  • const char * name
  • float[] src

Return value

void setDMat4Data (const Math::dmat4 & data)

Sets a dmat4 matrix content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::dmat4 & data - Content to set.

Math::vec4 getVec4Arg (const char * name)

Returns a value of a given vec4 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

Math::dvec4 getDVec4Arg (const char * name)

Returns a value of a given dvec4 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

void setData (const char * data)

Sets a xml data.

Arguments

  • const char * data - The xml data.

void setBoolData (int data)

Sets a boolean as xml data.

Arguments

  • int data - The xml argument value.

int findArg (const char * name)

Finds a xml argument by its name.

Arguments

  • const char * name - Xml argument name.

Return value

Xml argument number.

int setMat4Arg (const char * name, const Math::mat4 & value)

Sets a value of a given mat4 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::mat4 & value - Value of an argument.

Return value

Always 1.

Math::quat getQuatData ()

Returns a quaternion interpretation of data stored in the node.

Return value

Data stored in the node.

int setIVec4Arg (const char * name, const Math::ivec4 & value)

Sets a value of a given ivec4 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::ivec4 & value - Value of an argument.

Return value

Always 1.

void setDoubleData (double data)

Sets a double content for the node. This can be done only for nodes with no children.

Arguments

  • double data - Content to set.

Math::ivec3 getIVec3Data ()

Returns a ivec3 interpretation of data stored in the node.

Return value

Data stored in the node.

const char * getName ()

Returns the xml node name.

Return value

The result.

Math::mat4 getMat4Data ()

Returns a mat4 matrix interpretation of data stored in the node.

Return value

Data stored in the node.

void setArgValue (int num, const char * value)

Sets the xml argument value.

Arguments

  • int num - The argument number.
  • const char * value - The argument value.

Math::ivec4 getIVec4Data ()

Returns a ivec4 interpretation of data stored in the node.

Return value

Data stored in the node.

void setFloatData (float data)

Sets a float content for the node. This can be done only for nodes with no children.

Arguments

  • float data - Content to set.

const char * getArgValue (int num)

Returns the xml argument value.

Arguments

  • int num - The argument number.

Return value

The result.

void printUnusedData (const char * name)

Prints the unused nodes and arguments.

Arguments

  • const char * name - Name of the xml file.

Ptr<Xml> getChild (const char * name)

Returns the child of the xml tree.

Arguments

  • const char * name - The child number.

Return value

The result.

int getIntArrayArg (const char * name, out int[] dest)

Gets an array of integers from xml argument.

Arguments

  • const char * name
  • out int[] dest

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

int setStringArrayArg (const char * name, const Vector< String > & src)

Arguments

  • const char * name
  • const Vector< String > & src

Return value

void setMat4Data (const Math::mat4 & data)

Sets a mat4 matrix content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::mat4 & data - Content to set.

void setQuatData (const Math::quat & data)

Sets a quaternion content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::quat & data - Content to set.

const char * getChildData (const char * name)

Allows to get the data from the xml child node.

Arguments

  • const char * name - Name of the child node.

Return value

The value of the child node.

Ptr<Xml> addChild (const Ptr<Xml> & xml)

Appends a new xml child.

Arguments

  • const Ptr<Xml> & xml - Xml sub-tree smart pointer.

Return value

Created xml node.

int getBoolArg (const char * name)

Gets a boolean xml argument.

Arguments

  • const char * name - The xml argument name.

Return value

The result.

int getBoolData ()

Gets a boolean xml data.

Return value

The result.

Math::dvec3 getDVec3Data ()

Returns a dvec3 interpretation of data stored in the node.

Return value

Data stored in the node.

String getFormattedSubTree (const char * path = 0)

Converts an xml tree into the formatted string.

Arguments

  • const char * path - Path to xml sub-tree.

Return value

The result.

int setFloatArg (const char * name, float value)

Sets a value of a given float argument.

Arguments

  • const char * name - Name of an argument.
  • float value - Value of an argument.

Return value

Always 1.

int parse (const char * src)

Parses string and creates the xml tree.

Arguments

  • const char * src - String pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

Math::quat getQuatArg (const char * name)

Returns a value of a given quat argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

int removeArg (const char * name)

Deletes an xml argument.

Arguments

  • const char * name - The xml argument name.

Return value

1 if the argument is deleted successfully; otherwise, 0.

Math::ivec3 getIVec3Arg (const char * name)

Returns a value of a given ivec3 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

int setIntArrayArg (const char * name, int[] src, int radix = 10)

Sets an array of integers as xml argument in a given number notation. By default, the decimal number notation is used.

Arguments

  • const char * name
  • int[] src
  • int radix

Return value

1 if the array is set successfully; otherwise, 0.

int findChild (const char * name)

Returns the number of the Xml node child by its name.

Arguments

  • const char * name - Name of the Xml node child.

Return value

The number of the Xml node child if it is exists; otherwise, -1.

int setQuatArg (const char * name, const Math::quat & value)

Sets a value of a given quat argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::quat & value - Value of an argument.

Return value

Always 1.

void setDVec4Data (const Math::dvec4 & data)

Sets a dvec4 content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::dvec4 & data - Content to set.

const char * getData ()

Gets a xml data.

Return value

The result.

Math::vec3 getVec3Arg (const char * name)

Returns a value of a given vec3 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

int setIntArg (const char * name, int value, int radix = 10)

Sets an integer as xml argument in a given number notation. By default, the decimal number notation is used.

Arguments

  • const char * name - The xml argument name.
  • int value - The xml argument value.
  • int radix - Radix to use when setting a value.

Return value

1 if the value is set successfully; otherwise, 0.

int setIntData (int value, int radix = 10)

Sets an integer as xml data in a given number notation. By default, the decimal number notation is used.

Arguments

  • int value - The xml argument value.
  • int radix - Radix to use when setting a value.

Return value

1 if the value is set successfully; otherwise, 0.

int load (const char * name)

Loads the xml tree from the specified file.

Arguments

  • const char * name - File name.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

Ptr<Xml> addChild (const char * name, const char * args = 0)

Appends a new xml child.

Arguments

  • const char * name - Name of the xml node.
  • const char * args - Arguments of the xml node.

Return value

Created xml node.

int getFloatArrayArg (const char * name, out float[] dest)

Arguments

  • const char * name
  • out float[] dest

Return value

int setVec4Arg (const char * name, const Math::vec4 & value)

Sets a value of a given vec4 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::vec4 & value - Value of an argument.

Return value

Always 1.

Ptr<Xml> find (const char * path)

Finds an xml sub-tree.

Arguments

  • const char * path - Path to the xml sub-tree.

Return value

The result.

Ptr<Xml> getParent ()

Returns the parent xml tree.

Return value

int getNumChildren ()

Returns the number of xml children.

Return value

The result.

int setDVec4Arg (const char * name, const Math::dvec4 & value)

Sets a value of a given dvec4 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::dvec4 & value - Value of an argument.

Return value

Always 1.

Ptr<Xml> getChild (int num)

Returns the child of the xml tree.

Arguments

  • int num - The child number.

Return value

The result.

int setDVec3Arg (const char * name, const Math::dvec3 & value)

Sets a value of a given dvec3 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::dvec3 & value - Value of an argument.

Return value

Always 1.

int setDMat4Arg (const char * name, const Math::dmat4 & value)

Sets a value of a given dmat4 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::dmat4 & value - Value of an argument.

Return value

Always 1.

void setDVec3Data (const Math::dvec3 & data)

Sets a dvec3 content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::dvec3 & data - Content to set.

Math::mat4 getMat4Arg (const char * name)

Returns a value of a given mat4 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

float getFloatArg (const char * name)

Returns a value of a given float argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

void clear ()

Clears the xml tree.

int isChild (const char * name)

Checks if the xml has specified child.

Arguments

  • const char * name - Name of the xml child.

Return value

The result.

int getIntArg (const char * name, int value)

Gets an integer xml argument.

Arguments

  • const char * name - Name of a target argument.
  • int value - Default value of the argument.

Return value

The result.

int save (const char * name, int binary = 0)

Saves the xml tree into the specified file.

Arguments

  • const char * name - File name.
  • int binary - Binary xml format.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

Math::dvec3 getDVec3Arg (const char * name)

Returns a value of a given dvec3 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

int setDoubleArg (const char * name, double value)

Sets a value of a given double argument.

Arguments

  • const char * name - Name of an argument.
  • double value - Value of an argument.

Return value

Always 1.

void setIVec3Data (const Math::ivec3 & data)

Sets a ivec3 content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::ivec3 & data - Content to set.

void copy (const Ptr<Xml> & source)

Copies all data (name, arguments, data, flags and a child hierarchy) from the source Xml node to the current one.

Arguments

  • const Ptr<Xml> & source - Source Xml node.

Math::ivec4 getIVec4Arg (const char * name)

Returns a value of a given ivec4 argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

Math::vec3 getVec3Data ()

Returns a vec3 interpretation of data stored in the node.

Return value

Data stored in the node.

int setXmlData (const char * data)

Sets a xml xml data.

Arguments

  • const char * data - The xml xml data.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

const char * getArgName (int num)

Returns the xml argument name.

Arguments

  • int num - The argument number.

Return value

The result.

int setVec3Arg (const char * name, const Math::vec3 & value)

Sets a value of a given vec3 argument.

Arguments

  • const char * name - Name of an argument.
  • const Math::vec3 & value - Value of an argument.

Return value

Always 1.

void setName (const char * name)

Sets the xml node name.

Arguments

  • const char * name - Name of the xml node.

String encode (const char * arg1)

Encodes special xml characters (less-than, greater-than, ampersand, double-quote and apostrophe) to their character entity reference.

Arguments

  • const char * arg1 - Data to encode.

Return value

Encoded string.

double getDoubleArg (const char * name)

Returns a value of a given double argument.
Notice
To check, if an argument exists, use the isArg() method.

Arguments

  • const char * name - Name of a target argument.

Return value

Argument value.

void setVec3Data (const Math::vec3 & data)

Sets a vec3 content for the node. This can be done only for nodes with no children.

Arguments

  • const Math::vec3 & data - Content to set.
Last update: 2017-07-03
Build: ()