- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Namespace List
- Namespace Members

# FUXmlWriter Namespace Reference
[Utility Classes.]

Common XML writing utility functions. More...

## Functions
FCOLLADA_EXPORT xmlNode * | CreateNode (const char *name)
| Creates a dangling XML tree node.
FCOLLADA_EXPORT void | AddChild (xmlNode *parent, xmlNode *child)
| Appends a dangling XML tree child node to a XML tree node.
FCOLLADA_EXPORT void | RenameNode (xmlNode *node, const char *newName)
| Rename the given node to the new name.
FCOLLADA_EXPORT xmlNode * | AddChild (xmlNode *parent, const char *name)
| Creates a child XML tree node within a XML tree node.
FCOLLADA_EXPORT xmlNode * | AddChild (xmlNode *parent, const char *name, const char *content)
| Creates a child XML tree node within a XML tree node.
FCOLLADA_EXPORT xmlNode * | AddChild (xmlNode *parent, const char *name, const fstring &content)
| See above.
xmlNode * | AddChild (xmlNode *parent, const char *name, const fm::string &content)
| See above.
xmlNode * | AddChild (xmlNode *parent, const char *name, FUSStringBuilder &content)
| See above.
FCOLLADA_EXPORT void | AddContentUnprocessed (xmlNode *node, const char *content)
| Appends an unprocessed content string to a XML tree node.
void | AddContentUnprocessed (xmlNode *node, const fm::string &content)
| See above.
void | AddContentUnprocessed (xmlNode *node, FUSStringBuilder &content)
| See above.
template<typename T>
xmlNode * | AddChild (xmlNode *parent, const char *name, const T &value)
| Creates a child XML tree node within a XML tree node.
FCOLLADA_EXPORT void | AddSibling (xmlNode *sibling, xmlNode *dangling)
| Appends a dangling XML tree node as a sibling of a XML tree node.
FCOLLADA_EXPORT xmlNode * | AddSibling (xmlNode *sibling, const char *name)
| Creates a XML tree node as a sibling of a XML tree node.
FCOLLADA_EXPORT xmlNode * | InsertChild (xmlNode *parent, xmlNode *sibling, const char *name)
| Inserts a XML tree node before the given XML tree child node.
FCOLLADA_EXPORT xmlNode * | AddChildOnce (xmlNode *parent, const char *name, const char *content=NULL)
| Returns a child XML tree node within a XML tree node.
xmlNode * | AddChildOnce (xmlNode *parent, const char *name, const fm::string &content)
| See above.
xmlNode * | AddChildOnce (xmlNode *parent, const char *name, FUSStringBuilder &content)
| See above.
template<typename T>
xmlNode * | AddChildOnce (xmlNode *parent, const char *name, const T &value)
| Returns a child XML tree node within a XML tree node.
FCOLLADA_EXPORT void | AddContent (xmlNode *node, const char *content)
| Appends a content string to a XML tree node.
FCOLLADA_EXPORT void | AddContent (xmlNode *node, const fstring &content)
| See above.
void | AddContent (xmlNode *node, const fm::string &content)
| See above.
void | AddContent (xmlNode *node, FUSStringBuilder &content)
| See above.
FCOLLADA_EXPORT void | ConvertFilename (fstring &str)
| Converts all the spaces and other characters not acceptable in filenames, into their hex-equivalent.
template<typename T>
void | AddContent (xmlNode *node, const T &value)
| Appends a primitive value to a XML tree node.
FCOLLADA_EXPORT void | AddAttribute (xmlNode *node, const char *attributeName, const char *attributeValue)
| Appends a XML attribute to a XML tree node.
FCOLLADA_EXPORT void | AddAttribute (xmlNode *node, const char *attributeName, const fstring &attributeValue)
| See above.
void | AddAttribute (xmlNode *node, const char *attributeName, FUSStringBuilder &attributeValue)
| See above.
void | AddAttribute (xmlNode *node, const char *attributeName, const fm::string &attributeValue)
| See above.
template<typename T>
void | AddAttribute (xmlNode *node, const char *attributeName, const T &attributeValue)
| Appends a XML attribute to a XML tree node.
FCOLLADA_EXPORT void | RemoveAttribute (xmlNode *node, const char *attributeName)
| Removes a XML attribute from a XML tree node.
FCOLLADA_EXPORT void | AddChildSorted (xmlNode *parent, xmlNode *child)
| Appends a dangling XML tree node to a XML tree node The dangling XML tree node is inserted in lexical order, after all the sibling XML tree node with the same name.
FCOLLADA_EXPORT xmlNode * | AddChildSorted (xmlNode *parent, const char *name, const char *content=NULL)
| Creates a new child XML tree node of a XML tree node The new child XML tree node is inserted in lexical order, after all the sibling XML tree node with the same name.
FCOLLADA_EXPORT void | ReParentNode (xmlNode *node, xmlNode *newParent)
| Detaches a XML tree node from its current parent and adds it as the child of another XML tree node.

## Detailed Description

Common XML writing utility functions.

Based on top of the LibXML2 library. This whole namespace is considered internal and should only be used by the FCollada library.

## Function Documentation

template<typename T>
void FUXmlWriter::AddAttribute | ( | xmlNode * | node,
|  | const char * | attributeName,
|  | const T & | attributeValue
| ) | `[inline]`

  | Appends a XML attribute to a XML tree node. A XML attribute appears in the form <node name="value"@/>. Parameters:
  | node | The XML tree node.
  | attributeName | The name of the XML attribute.
  | attributeValue | A primitive value. The value is stringified and set as the value of the XML attribute.

FCOLLADA_EXPORT void FUXmlWriter::AddAttribute | ( | xmlNode * | node,
|  | const char * | attributeName,
|  | const char * | attributeValue
| ) |

  | Appends a XML attribute to a XML tree node. A XML attribute appears in the form <node name="value"/>. Parameters:
  | node | The XML tree node.
  | attributeName | The name of the XML attribute.
  | attributeValue | The value of the XML attribute.

template<typename T>
xmlNode* FUXmlWriter::AddChild | ( | xmlNode * | parent,
|  | const char * | name,
|  | const T & | value
| ) | `[inline]`

  | Creates a child XML tree node within a XML tree node. The child XML tree node is added at the end of the parent XML tree node children list. The given content value is added, in string-form, to the returned child XML tree node. Parameters:
  | parent | The parent XML tree node.
  | name | The name of the new child XML tree node.
  | value | A primitive value. This value is stringified and added, as content, to the new child XML tree node.
Returns: The new child XML tree node.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::AddChild | ( | xmlNode * | parent,
|  | const char * | name,
|  | const char * | content
| ) |

  | Creates a child XML tree node within a XML tree node. The child XML tree node is added at the end of the parent XML tree node children list. The given content string is added to the returned child XML tree node. Parameters:
  | parent | The parent XML tree node.
  | name | The name of the new child XML tree node.
  | content | The content to add to the new child XML tree node.
Returns: The new child XML tree node.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::AddChild | ( | xmlNode * | parent,
|  | const char * | name
| ) |

  | Creates a child XML tree node within a XML tree node. The child XML tree node is added at the end of the parent XML tree node children list. Parameters:
  | parent | The parent XML tree node.
  | name | The name of the new child node.
Returns: The new child XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::AddChild | ( | xmlNode * | parent,
|  | xmlNode * | child
| ) |

  | Appends a dangling XML tree child node to a XML tree node. The child XML tree node is added at the end of the parent XML tree node children list. Parameters:
  | parent | The parent XML tree node.
  | child | The child XML tree node.

template<typename T>
xmlNode* FUXmlWriter::AddChildOnce | ( | xmlNode * | parent,
|  | const char * | name,
|  | const T & | value
| ) | `[inline]`

  | Returns a child XML tree node within a XML tree node. If the child XML tree node with the given name does not exists, it is created and the given content is added to the new XML tree node. Parameters:
  | parent | The parent XML tree node.
  | name | The name of the child XML tree node.
  | value | A primitive value. If the child XML tree node must be created: this value is stringified and added as content.
Returns: The child XML tree node.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::AddChildOnce | ( | xmlNode * | parent,
|  | const char * | name,
|  | const char * | content = `NULL`
| ) |

  | Returns a child XML tree node within a XML tree node. If the child XML tree node with the given name does not exists, it is created and the given content is added to the new XML tree node. Parameters:
  | parent | The parent XML tree node.
  | name | The name of the child XML tree node.
  | content | The content to add to the child XML tree node, if it must be created.
Returns: The child XML tree node.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::AddChildSorted | ( | xmlNode * | parent,
|  | const char * | name,
|  | const char * | content = `NULL`
| ) |

  | Creates a new child XML tree node of a XML tree node The new child XML tree node is inserted in lexical order, after all the sibling XML tree node with the same name. Parameters:
  | parent | The XML tree node onto which the new XML node tree is created.
  | name | The name of the new child XML tree node.
  | content | A content string to be added to the child XML tree node.
Returns: The new child XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::AddChildSorted | ( | xmlNode * | parent,
|  | xmlNode * | child
| ) |

  | Appends a dangling XML tree node to a XML tree node The dangling XML tree node is inserted in lexical order, after all the sibling XML tree node with the same name. Parameters:
  | parent | The XML tree node onto which the dangling XML node tree is appended.
  | child | The dangling XML tree node.

template<typename T>
void FUXmlWriter::AddContent | ( | xmlNode * | node,
|  | const T & | value
| ) | `[inline]`

  | Appends a primitive value to a XML tree node. The primitive value is added at the end of the XML tree node's content, with no special characters added. Parameters:
  | node | The XML tree node.
  | value | A primitive value. The value is stringified and added as content to the XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::AddContent | ( | xmlNode * | node,
|  | const char * | content
| ) |

  | Appends a content string to a XML tree node. The content string is added at the end of the XML tree node's content, with no special characters added. The content string will be processed for non-UTF8 characters. Parameters:
  | node | The XML tree node.
  | content | The content to add to the XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::AddContentUnprocessed | ( | xmlNode * | node,
|  | const char * | content
| ) |

  | Appends an unprocessed content string to a XML tree node. The content string is added at the end of the XML tree node's content, with no special characters added. Parameters:
  | node | The XML tree node.
  | content | The content to add to the XML tree node.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::AddSibling | ( | xmlNode * | sibling,
|  | const char * | name
| ) |

  | Creates a XML tree node as a sibling of a XML tree node. Two sibling XML tree nodes have the same parent XML tree node. The new XML tree node is added at the end of the parent XML tree node children list. Parameters:
  | sibling | The sibling XML tree node. It must have a valid parent XML tree node.
  | name | The name of the new XML tree node.
Returns: The new sibling XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::AddSibling | ( | xmlNode * | sibling,
|  | xmlNode * | dangling
| ) |

  | Appends a dangling XML tree node as a sibling of a XML tree node. Two sibling XML tree nodes have the same parent XML tree node. The dangling XML tree node is added at the end of the parent XML tree node children list. Parameters:
  | sibling | The sibling XML tree node. It must have a valid parent XML tree node.
  | dangling | The dangling XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::ConvertFilename | ( | fstring & | str | ) |

  | Converts all the spaces and other characters not acceptable in filenames, into their hex-equivalent. Example: 20 for spaces. Parameters:
  | str | The string with the spaces to convert.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::CreateNode | ( | const char * | name | ) |

  | Creates a dangling XML tree node. Parameters:
  | name | The name of the new XML tree node.
Returns: The new XML tree node. This pointer should never be NULL.

FCOLLADA_EXPORT xmlNode* FUXmlWriter::InsertChild | ( | xmlNode * | parent,
|  | xmlNode * | sibling,
|  | const char * | name
| ) |

  | Inserts a XML tree node before the given XML tree child node. Parameters:
  | parent | The parent XML tree node.
  | sibling | The sibling XML tree node. It must be parented to the given parent XML tree node.
  | name | The name of the new XML tree node.
Returns: The inserted sibling XML tree node.

FCOLLADA_EXPORT void FUXmlWriter::RemoveAttribute | ( | xmlNode * | node,
|  | const char * | attributeName
| ) |

  | Removes a XML attribute from a XML tree node. Parameters:
  | node | The XML tree node with the unwanted attribute.
  | attributeName | The name of the XML attribute to remove.

FCOLLADA_EXPORT void FUXmlWriter::RenameNode | ( | xmlNode * | node,
|  | const char * | newName
| ) |

  | Rename the given node to the new name. Parameters:
  | node | The XML tree node to rename
  | newName | The new name for the XML tree node

FCOLLADA_EXPORT void FUXmlWriter::ReParentNode | ( | xmlNode * | node,
|  | xmlNode * | newParent
| ) |

  | Detaches a XML tree node from its current parent and adds it as the child of another XML tree node. Parameters:
  | node | The XML tree node to reparent.
  | newParent | The new parent XML tree node.