#include <judo.hpp>
Inheritance diagram for judo::Element:
Public Member Functions | |
Element (const std::string &name, const char **attribs=NULL) | |
Default constructor. | |
Element * | addElement (const std::string &name, const char **attribs=NULL) |
Add a new child element to "this" element. | |
Element * | addElement (const std::string &name, const std::string &cdata, bool escaped=false) |
Add a new child element with a solitary section of character data. | |
CDATA * | addCDATA (const char *data, int datasz, bool escaped=false) |
Add character data to "this" element. | |
void | putAttrib (const std::string &name, const std::string &value) |
Store an attribute (key/value pair) on this element. | |
std::string | getAttrib (const std::string &name) const |
Retrieve an attribute value. | |
void | delAttrib (const std::string &name) |
Delete an attribute key/value. | |
bool | cmpAttrib (const std::string &name, const std::string &value) const |
Compare an attribute value to a string. | |
std::string | toString () const |
Get a properly escaped XML string representation of this object. | |
std::string | toStringEx (bool recursive=false, bool closetag=false) const |
Custom version of Element::toString. | |
void | accumulate (XMLAccumulator &acc) const |
Accumulate a properly escaped XML string representation of this object. | |
std::string | getCDATA () const |
Retrieve the first CDATA child of this element. | |
void | appendChild (Node *child) |
Append child node to this Element. | |
Node * | detachChild (iterator it) |
Detach a child node from this element. | |
bool | empty () const |
Determine if this Element is empty (i.e. | |
int | size () const |
Determine the number of child nodes this Element has. | |
iterator | begin () |
Return an iterator to the first child Node. | |
const_iterator | begin () const |
Return a const iterator to the first child Node. | |
iterator | end () |
Return a iterator indicating the end of child nodes. | |
const_iterator | end () const |
Return a const iterator indicating the end of child nodes. | |
iterator | find (const std::string &name, Node::Type type=Node::ntElement) |
Locate the first child node which has the specified name and type. | |
const_iterator | find (const std::string &name, Node::Type type=Node::ntElement) const |
Locate the first child node which has the specified name and type. | |
void | Element::erase (Element::iterator it) |
Delete the child Node designated by the supplied iterator. | |
Element * | findElement (const std::string &name) |
Locate the first child node which has the specified name and is an Element. | |
const Element * | findElement (const std::string &name) const |
Locate the first child node which has the specified name and is an Element. | |
void | eraseElement (const std::string &name) |
Locate the first child Element which has the specified name and erase it. | |
std::string | getChildCData (const std::string &name) const |
Locate the first child node which has the specified name and extract the CDATA from it. | |
int | getChildCDataAsInt (const std::string &name, int defaultvalue) const |
Locate the first child node which has the specified name and extract the CDATA from it, converting the value into an integer. |
Definition at line 235 of file judo.hpp.
|
Default constructor.
Definition at line 57 of file Element.cpp. Referenced by addElement(). |
|
Accumulate a properly escaped XML string representation of this object.
Implements judo::Node. Definition at line 276 of file Element.cpp. References judo::Node::getName(). Referenced by toString(). |
|
Add character data to "this" element. This automatically merges adjacent sections of CDATA (if the parser splits them up).
Definition at line 154 of file Element.cpp. References judo::CDATA::appendText(). Referenced by addElement(). |
|
Add a new child element with a solitary section of character data.
Definition at line 137 of file Element.cpp. References addCDATA(), and addElement(). |
|
Add a new child element to "this" element.
Definition at line 122 of file Element.cpp. References Element(). Referenced by addElement(), jabberoo::Packet::addX(), jabberoo::DiscoDB::cache(), jabberoo::Roster::deleteUser(), jabberoo::Roster::fetch(), jabberoo::Message::Message(), jabberoo::Session::queryNamespace(), jabberoo::Message::setBody(), jabberoo::Presence::setPriority(), jabberoo::Presence::setShow(), jabberoo::Presence::setStatus(), jabberoo::Message::setSubject(), jabberoo::Message::setThread(), and jabberoo::Roster::update(). |
|
Append child node to this Element.
|
|
Return a const iterator to the first child Node.
|
|
Return an iterator to the first child Node.
Definition at line 294 of file judo.hpp. Referenced by jabberoo::Packet::eraseX(), find(), jabberoo::Packet::findX(), and jabberoo::Roster::update(). |
|
Compare an attribute value to a string.
Definition at line 211 of file Element.cpp. Referenced by jabberoo::Roster::update(). |
|
Delete an attribute key/value.
Definition at line 199 of file Element.cpp. |
|
Detach a child node from this element. The iterator is invalidated after this call.
Definition at line 398 of file Element.cpp. |
|
Delete the child Node designated by the supplied iterator.
Definition at line 322 of file judo.hpp. References Element::erase(). Referenced by Element::erase(). |
|
Determine if this Element is empty (i.e. has no child nodes)
|
|
Return a const iterator indicating the end of child nodes.
|
|
Return a iterator indicating the end of child nodes.
Definition at line 306 of file judo.hpp. Referenced by eraseElement(), jabberoo::Packet::eraseX(), find(), findElement(), jabberoo::Packet::findX(), and jabberoo::Roster::update(). |
|
Locate the first child Element which has the specified name and erase it. As a result of this, the child Element's sub-children are also removed. Definition at line 385 of file Element.cpp. |
|
Locate the first child node which has the specified name and type.
Definition at line 334 of file Element.cpp. |
|
Locate the first child node which has the specified name and type.
Definition at line 316 of file Element.cpp. References begin(), and end(). Referenced by eraseElement(), and findElement(). |
|
Locate the first child node which has the specified name and is an Element.
Definition at line 370 of file Element.cpp. |
|
Locate the first child node which has the specified name and is an Element.
Definition at line 354 of file Element.cpp. Referenced by getChildCData(), getChildCDataAsInt(), jabberoo::Packet::getErrorCode(), jabberoo::Message::setBody(), jabberoo::Message::setSubject(), and jabberoo::Message::setThread(). |
|
Retrieve an attribute value.
Definition at line 186 of file Element.cpp. Referenced by jabberoo::Packet::getFrom(), jabberoo::Packet::getID(), jabberoo::Packet::getTo(), jabberoo::Session::onDocumentStart(), and jabberoo::Roster::update(). |
|
Retrieve the first CDATA child of this element.
Definition at line 296 of file Element.cpp. Referenced by getChildCData(), and getChildCDataAsInt(). |
|
Locate the first child node which has the specified name and extract the CDATA from it.
Definition at line 412 of file Element.cpp. References findElement(), and getCDATA(). Referenced by jabberoo::Message::getBody(), jabberoo::Packet::getError(), jabberoo::Presence::getPriority(), jabberoo::Presence::getStatus(), jabberoo::Message::getSubject(), and jabberoo::Message::getThread(). |
|
Locate the first child node which has the specified name and extract the CDATA from it, converting the value into an integer.
Definition at line 429 of file Element.cpp. References findElement(), and getCDATA(). |
|
Store an attribute (key/value pair) on this element.
Definition at line 176 of file Element.cpp. Referenced by jabberoo::DiscoDB::cache(), jabberoo::Roster::deleteUser(), jabberoo::Roster::fetch(), jabberoo::Session::queryNamespace(), jabberoo::Packet::setFrom(), jabberoo::Packet::setID(), jabberoo::Packet::setTo(), jabberoo::Presence::setType(), jabberoo::Message::setType(), and jabberoo::Roster::update(). |
|
Determine the number of child nodes this Element has. Prefer ::empty to comparing size() == 0
|
|
Get a properly escaped XML string representation of this object.
Implements judo::Node. Definition at line 225 of file Element.cpp. References accumulate(). Referenced by jabberoo::DiscoDB::cache(), jabberoo::Roster::deleteUser(), jabberoo::Roster::fetch(), jabberoo::Session::queryNamespace(), jabberoo::Packet::toString(), and jabberoo::Roster::update(). |
|
Custom version of Element::toString. Permits non-recursive serialization of the Element to a properly escaped XML string representation.
Definition at line 245 of file Element.cpp. References judo::Node::getName(). |