# PXMLElement Class Reference

`#include <pxml.h>`

Inheritance diagram for PXMLElement:

List of all members.

## Public Member Functions

| PXMLElement (PXMLElement *parent, const char *name=NULL)
| PXMLElement (PXMLElement *parent, const PString &name, const PString &data)
PBoolean | IsElement () const
void | PrintOn (ostream &strm) const
| Output the contents of the object to the stream.
void | Output (ostream &strm, const PXMLBase &xml, int indent) const
PCaselessString | GetName () const
PCaselessString | GetPathName () const
| Get the completely qualified name for the element inside the XML tree, for example "root:trunk:branch:subbranch:leaf".
void | SetName (const PString &v)
PINDEX | GetSize () const
PXMLObject * | AddSubObject (PXMLObject *elem, bool dirty=true)
PXMLElement * | AddChild (PXMLElement *elem, bool dirty=true)
PXMLData * | AddChild (PXMLData *elem, bool dirty=true)
PXMLElement * | AddElement (const char *name)
PXMLElement * | AddElement (const PString &name, const PString &data)
PXMLElement * | AddElement (const PString &name, const PString &attrName, const PString &attrVal)
void | SetAttribute (const PCaselessString &key, const PString &value, bool setDirty=true)
PString | GetAttribute (const PCaselessString &key) const
PString | GetKeyAttribute (PINDEX idx) const
PString | GetDataAttribute (PINDEX idx) const
bool | HasAttribute (const PCaselessString &key) const
bool | HasAttributes () const
PINDEX | GetNumAttributes () const
PXMLElement * | GetElement (const PCaselessString &name, const PCaselessString &attr, const PString &attrval) const
PXMLElement * | GetElement (const PCaselessString &name, PINDEX idx=0) const
PXMLObject * | GetElement (PINDEX idx=0) const
bool | RemoveElement (PINDEX idx)
PINDEX | FindObject (const PXMLObject *ptr) const
bool | HasSubObjects () const
PXMLObjectArray | GetSubObjects () const
PXMLObject * | GetSubObject (PINDEX idx=0) const
PString | GetData () const
void | SetData (const PString &data)
void | AddData (const PString &data)
PXMLObject * | Clone (PXMLElement *parent) const
void | GetFilePosition (unsigned &col, unsigned &line) const
void | SetFilePosition (unsigned col, unsigned line)
void | AddNamespace (const PString &prefix, const PString &uri)
void | RemoveNamespace (const PString &prefix)
bool | GetDefaultNamespace (PCaselessString &str) const
bool | GetNamespace (const PCaselessString &prefix, PCaselessString &str) const
PCaselessString | PrependNamespace (const PCaselessString &name) const
bool | GetURIForNamespace (const PCaselessString &prefix, PCaselessString &uri)

## Protected Attributes

PCaselessString | name
PStringToString | attributes
PXMLObjectArray | subObjects
bool | dirty
unsigned | column
unsigned | lineNumber
PStringToString | m_nameSpaces
PCaselessString | m_defaultNamespace

## Constructor & Destructor Documentation

PXMLElement::PXMLElement | ( | PXMLElement * | parent,
|  | const char * | name = `NULL` |
| ) |  |  |

PXMLElement::PXMLElement | ( | PXMLElement * | parent,
|  | const PString & | name,
|  | const PString & | data |
| ) |  |  |

## Member Function Documentation

PXMLData* PXMLElement::AddChild | ( | PXMLData * | elem,
|  | bool | dirty = `true` |
| ) |  |  |

PXMLElement* PXMLElement::AddChild | ( | PXMLElement * | elem,
|  | bool | dirty = `true` |
| ) |  |  |

void PXMLElement::AddData | ( | const PString & | data | ) |

PXMLElement* PXMLElement::AddElement | ( | const PString & | name,
|  | const PString & | attrName,
|  | const PString & | attrVal |
| ) |  |  |

PXMLElement* PXMLElement::AddElement | ( | const PString & | name,
|  | const PString & | data |
| ) |  |  |

PXMLElement* PXMLElement::AddElement | ( | const char * | name | ) |

void PXMLElement::AddNamespace | ( | const PString & | prefix,
|  | const PString & | uri |
| ) |  |  |

PXMLObject* PXMLElement::AddSubObject | ( | PXMLObject * | elem,
|  | bool | dirty = `true` |
| ) |  |  |

PXMLObject* PXMLElement::Clone | ( | PXMLElement * | parent | ) | const`[virtual]`

Implements PXMLObject.

PINDEX PXMLElement::FindObject | ( | const PXMLObject * | ptr | ) | const

PString PXMLElement::GetAttribute | ( | const PCaselessString & | key | ) | const

PString PXMLElement::GetData | ( |  | ) | const

PString PXMLElement::GetDataAttribute | ( | PINDEX | idx | ) | const

bool PXMLElement::GetDefaultNamespace | ( | PCaselessString & | str | ) | const

PXMLObject* PXMLElement::GetElement | ( | PINDEX | idx = `0` | ) | const

PXMLElement* PXMLElement::GetElement | ( | const PCaselessString & | name,
|  | PINDEX | idx = `0` |
| ) |  |  | const

PXMLElement* PXMLElement::GetElement | ( | const PCaselessString & | name,
|  | const PCaselessString & | attr,
|  | const PString & | attrval |
| ) |  |  | const

void PXMLElement::GetFilePosition | ( | unsigned & | col,
|  | unsigned & | line |
| ) |  |  | const`[inline]`

PString PXMLElement::GetKeyAttribute | ( | PINDEX | idx | ) | const

PCaselessString PXMLElement::GetName | ( |  | ) | const`[inline]`

bool PXMLElement::GetNamespace | ( | const PCaselessString & | prefix,
|  | PCaselessString & | str |
| ) |  |  | const

PINDEX PXMLElement::GetNumAttributes | ( |  | ) | const`[inline]`

PCaselessString PXMLElement::GetPathName | ( |  | ) | const

Get the completely qualified name for the element inside the XML tree, for example "root:trunk:branch:subbranch:leaf".

PINDEX PXMLElement::GetSize | ( |  | ) | const`[inline]`

PXMLObject* PXMLElement::GetSubObject | ( | PINDEX | idx = `0` | ) | const`[inline]`

PXMLObjectArray PXMLElement::GetSubObjects | ( |  | ) | const`[inline]`

bool PXMLElement::GetURIForNamespace | ( | const PCaselessString & | prefix,
|  | PCaselessString & | uri |
| ) |  |  |

bool PXMLElement::HasAttribute | ( | const PCaselessString & | key | ) | const

bool PXMLElement::HasAttributes | ( |  | ) | const`[inline]`

bool PXMLElement::HasSubObjects | ( |  | ) | const`[inline]`

PBoolean PXMLElement::IsElement | ( |  | ) | const`[inline, virtual]`

Implements PXMLObject.

void PXMLElement::Output | ( | ostream & | strm,
|  | const PXMLBase & | xml,
|  | int | indent |
| ) |  |  | const`[virtual]`

Implements PXMLObject.

PCaselessString PXMLElement::PrependNamespace | ( | const PCaselessString & | name | ) | const

void PXMLElement::PrintOn | ( | ostream & | strm | ) | const`[virtual]`

Output the contents of the object to the stream.

The exact output is dependent on the exact semantics of the descendent class. This is primarily used by the standard `operator<<` function.

The default behaviour is to print the class name.

Reimplemented from PObject.

bool PXMLElement::RemoveElement | ( | PINDEX | idx | ) |

void PXMLElement::RemoveNamespace | ( | const PString & | prefix | ) |

void PXMLElement::SetAttribute | ( | const PCaselessString & | key,
|  | const PString & | value,
|  | bool | setDirty = `true` |
| ) |  |  |

void PXMLElement::SetData | ( | const PString & | data | ) |

void PXMLElement::SetFilePosition | ( | unsigned | col,
|  | unsigned | line |
| ) |  |  | `[inline]`

void PXMLElement::SetName | ( | const PString & | v | ) | `[inline]`

## Member Data Documentation

PStringToString PXMLElement::attributes `[protected]`

unsigned PXMLElement::column `[protected]`

bool PXMLElement::dirty `[protected]`

Reimplemented from PXMLObject.

unsigned PXMLElement::lineNumber `[protected]`

PCaselessString PXMLElement::m_defaultNamespace `[protected]`

PStringToString PXMLElement::m_nameSpaces `[protected]`

PCaselessString PXMLElement::name `[protected]`

PXMLObjectArray PXMLElement::subObjects `[protected]`

The documentation for this class was generated from the following file:

- pxml.h