Elm
1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/xom/Node.h>
Public Types | |
enum | kind_t { NONE = 0, ELEMENT, DOCUMENT, TEXT, COMMENT, ATTRIBUTE, PROCESSING_INSTRUCTION, DOCTYPE, NAMESPACE } |
typedef enum elm::xom::Node::kind_t | kind_t |
Public Member Functions | |
virtual | ~Node (void) |
void * | getNode (void) const |
kind_t | kind (void) const |
virtual Node * | copy (void)=0 |
void | detach (void) |
bool | equals (const Node *node) const |
virtual String | getBaseURI (void) |
virtual Node * | getChild (int index)=0 |
virtual int | getChildCount (void)=0 |
virtual Document * | getDocument (void) |
virtual ParentNode * | getParent (void) |
virtual String | getValue (void)=0 |
virtual Nodes * | query (const String &xpath) |
virtual Nodes * | query (const String &xpath, XPathContext *context) |
virtual String | toXML (void)=0 |
int | line (void) const |
Protected Member Functions | |
Node (void *_node) | |
void | setNode (void *_node) |
Node * | make (void *node) |
Node * | get (void *node) |
Node * | internCopy (void) |
Node * | internGetChild (int index) |
int | internGetChildCount (void) |
String | internGetValue (void) |
String | internToXML (void) |
Static Protected Member Functions | |
static void | freeNode (void *node) |
Protected Attributes | |
void * | node |
The base class of nodes of a XOM XML tree. Refer to http://www.xom.nu/ for more information.
typedef enum elm::xom::Node::kind_t elm::xom::Node::kind_t |
|
protected |
References setNode().
|
virtual |
|
pure virtual |
Implemented in elm::xom::Attribute, elm::xom::Comment, elm::xom::Element, elm::xom::Document, and elm::xom::Text.
void elm::xom::Node::detach | ( | void | ) |
Detach the current node from its parent.
References node.
bool elm::xom::Node::equals | ( | const Node * | node | ) | const |
Test if the current and the passed nodes are equals, that is, they are the same object.
References node.
|
staticprotected |
|
protected |
Get the XOM object linked with this parser representation node.
xml_node | Parser node. |
References make().
Referenced by elm::xom::XSLTransform::toDocument().
|
virtual |
Returns the base URI of this node as specified by XML Base, or the empty string if this is not known. In most cases, this is the URL against which relative URLs in this node should be resolved.
Reimplemented in elm::xom::Attribute, and elm::xom::Document.
References node.
|
pure virtual |
Returns the child of this node at the specified position.
position | the index of the child node to return |
Implemented in elm::xom::Attribute, elm::xom::Comment, elm::xom::ParentNode, and elm::xom::Text.
|
pure virtual |
Implemented in elm::xom::Attribute, elm::xom::Comment, elm::xom::ParentNode, and elm::xom::Text.
|
virtual |
Returns the document that contains this node, or null if this node is not currently part of a document. Each node belongs to no more than one document at a time. If this node is a Document, then it returns this node.
References node.
Referenced by internToXML().
void * elm::xom::Node::getNode | ( | void | ) | const |
References node.
Referenced by elm::xom::Element::addAttribute(), elm::xom::ParentNode::appendChild(), elm::xom::Document::Document(), elm::xom::Element::Element(), elm::xom::ParentNode::indexOf(), elm::xom::ParentNode::insertChild(), elm::xom::ParentNode::removeChild(), elm::xom::ParentNode::replaceChild(), and elm::xom::Document::setRootElement().
|
virtual |
|
pure virtual |
Get the node as a string with markup removed.
Implemented in elm::xom::Element, elm::xom::Attribute, elm::xom::Comment, elm::xom::Document, and elm::xom::Text.
|
protected |
|
protected |
Referenced by elm::xom::Text::getChild(), and elm::xom::Comment::getChild().
|
protected |
int Node::getChildCount(void); Returns the number of children of this node. This is always non-negative (greater than or equal to zero).
Referenced by elm::xom::Text::getChildCount(), and elm::xom::Comment::getChildCount().
|
protected |
References node.
Referenced by elm::xom::Text::getValue(), elm::xom::Attribute::getValue(), and elm::xom::Element::getValue().
|
protected |
String Node::toXML(void); Returns the actual XML form of this node, such as might be copied and pasted from the original document. However, this does not preserve semantically insignificant details such as white space inside tags or the use of empty-element tags vs. start-tag end-tag pairs.
References getDocument(), and node.
Referenced by elm::xom::Text::toXML(), and elm::xom::Comment::toXML().
Node::kind_t elm::xom::Node::kind | ( | void | ) | const |
Get the kind of node.
References ATTRIBUTE, COMMENT, DOCUMENT, ELEMENT, node, NONE, PROCESSING_INSTRUCTION, and TEXT.
Referenced by elm::serial2::XOMUnserializer::beginCompound(), elm::serial::XOMUnserializer::beginList(), elm::serial2::XOMUnserializer::countItems(), elm::serial2::XOMUnserializer::flush(), elm::serial2::XOMUnserializer::nextItem(), elm::serial::XOMUnserializer::nextItem(), elm::xom::Serializer::writeChild(), and elm::xom::Serializer::writeStartTag().
int elm::xom::Node::line | ( | void | ) | const |
Get the line of the node in the source file (if any).
References node.
|
protected |
Build the XOM tree from the parser nodes.
node | Parser node. |
References elm::xom::NodeFactory::makeComment(), elm::xom::NodeFactory::makeElement(), and elm::xom::NodeFactory::makeText().
Referenced by get(), elm::xom::ParentNode::getChild(), elm::xom::Element::getChildElements(), elm::xom::Element::getFirstChildElement(), and getParent().
Returns the nodes selected by the XPath expression in the context of this node in document order as defined by XSLT. This XPath expression must not contain any namespace prefixes.
xpath | the XPath expression to evaluate |
XPathException | if there's a syntax error in the expression; or the query returns something other than a node-set. |
Returns the nodes selected by the XPath expression in the context of this node in document order as defined in XSLT. All namespace prefixes used in the expression should be bound to namespace URIs by the second argument.
xpath | the XPath expression to evaluate |
namespaces | a collection of namespace prefix bindings used in the XPath expression |
XPathException | if there's a syntax error in the expression, the query returns something other than a node-set |
|
protected |
Set the actual libxml node.
_node | Node to set. |
Referenced by elm::xom::Element::addAttribute(), elm::xom::ParentNode::appendChild(), and Node().
|
pure virtual |
Implemented in elm::xom::Element, elm::xom::Attribute, elm::xom::Comment, elm::xom::Document, and elm::xom::Text.
|
protected |
Referenced by elm::xom::Element::addAttribute(), elm::xom::Element::addNamespaceDeclaration(), elm::xom::ParentNode::appendChild(), elm::xom::Element::appendChild(), elm::xom::Comment::Comment(), detach(), elm::xom::Element::Element(), equals(), freeNode(), elm::xom::Element::getAttribute(), elm::xom::Element::getAttributeCount(), elm::xom::Element::getAttributeValue(), elm::xom::Document::getBaseURI(), getBaseURI(), elm::xom::ParentNode::getChild(), elm::xom::ParentNode::getChildCount(), elm::xom::Element::getChildElements(), getDocument(), elm::xom::Element::getFirstChildElement(), elm::xom::Attribute::getLocalName(), elm::xom::Element::getLocalName(), elm::xom::Element::getNamespaceDeclarationCount(), elm::xom::Element::getNamespacePrefix(), elm::xom::Attribute::getNamespaceURI(), elm::xom::Element::getNamespaceURI(), getNode(), getParent(), elm::xom::Element::getQualifiedName(), elm::xom::Document::getRootElement(), elm::xom::Text::getText(), elm::xom::Comment::getText(), elm::xom::ParentNode::indexOf(), elm::xom::ParentNode::insertChild(), internGetValue(), internToXML(), kind(), line(), elm::xom::Element::makeNS(), elm::xom::XIncluder::resolveInPlace(), elm::xom::Document::setBaseURI(), elm::xom::Document::setRootElement(), elm::xom::Text::setValue(), elm::xom::Comment::setValue(), elm::xom::Text::Text(), and elm::xom::Document::~Document().