![]() |
Elm
2
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 kind_t |
enum kind_t |
References Node::setNode().
Detach the current node from its parent.
References Node::node.
Test if the current and the passed nodes are equals, that is, they are the same object.
References Node::node.
Get the XOM object linked with this parser representation node.
xml_node | Parser node. |
References Node::make().
Referenced by Element::getAttribute(), Node::getDocument(), and Document::getRootElement().
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 Attribute, and Document.
References Node::node.
|
pure virtual |
Returns the child of this node at the specified position.
position | the index of the child node to return |
Implemented in UnsupportedNode, Attribute, Comment, ParentNode, and Text.
|
pure virtual |
Implemented in UnsupportedNode, Attribute, Comment, ParentNode, and Text.
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::get(), and Node::node.
Referenced by Node::internToXML(), and XOMUnserializer::XOMUnserializer().
References Node::node.
Referenced by Element::addAttribute(), ParentNode::appendChild(), Document::Document(), Element::Element(), ParentNode::indexOf(), ParentNode::insertChild(), ParentNode::removeChild(), ParentNode::replaceChild(), Document::setRootElement(), and XSLTransform::transformDocument().
|
virtual |
|
protected |
Referenced by Text::getChild(), Comment::getChild(), and UnsupportedNode::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 Text::getChildCount(), Comment::getChildCount(), and UnsupportedNode::getChildCount().
References Node::node.
Referenced by Text::getValue(), Attribute::getValue(), Element::getValue(), and UnsupportedNode::getValue().
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 Node::getDocument(), and Node::node.
Referenced by Text::toXML(), Comment::toXML(), and UnsupportedNode::toXML().
Node::kind_t kind | ( | void | ) | const |
Get the kind of node.
References Node::ATTRIBUTE, Node::COMMENT, Node::DOCUMENT, Node::ELEMENT, Node::node, Node::NONE, Node::PROCESSING_INSTRUCTION, and Node::TEXT.
Referenced by XOMUnserializer::beginCompound(), XOMUnserializer::countItems(), XOMUnserializer::flush(), XOMUnserializer::nextItem(), Element::parse(), PCDATAContent::parse(), XSLTransform::toDocument(), Serializer::writeChild(), Serializer::writeEndTag(), and Serializer::writeStartTag().
int line | ( | void | ) | const |
Get the line of the node in the source file (if any).
References Node::node.
Build the XOM tree from the parser nodes.
node | Parser node. |
References NodeFactory::makeComment(), NodeFactory::makeElement(), NodeFactory::makeText(), and Node::node.
Referenced by Node::get(), ParentNode::getChild(), Element::getChildElements(), Element::getFirstChildElement(), and Node::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 |
Set the actual libxml node.
_node | Node to set. |
Referenced by Element::addAttribute(), ParentNode::appendChild(), and Node::Node().
|
protected |
Referenced by Element::addAttribute(), Element::addNamespaceDeclaration(), ParentNode::appendChild(), Element::appendChild(), Comment::Comment(), UnsupportedNode::copy(), Parser::current(), Node::detach(), Document::Document(), Element::Element(), Node::equals(), Node::freeNode(), Element::getAttribute(), Element::getAttributeCount(), Element::getAttributeValue(), Document::getBaseURI(), Node::getBaseURI(), ParentNode::getChild(), ParentNode::getChildCount(), Element::getChildElements(), Node::getDocument(), Element::getFirstChildElement(), Attribute::getLocalName(), Element::getLocalName(), Element::getNamespaceDeclarationCount(), Element::getNamespacePrefix(), Attribute::getNamespaceURI(), Element::getNamespaceURI(), Node::getNode(), Node::getParent(), Element::getQualifiedName(), Document::getRootElement(), Text::getText(), Comment::getText(), ParentNode::indexOf(), ParentNode::insertChild(), Element::insertChild(), Node::internGetValue(), Node::internToXML(), Node::kind(), Node::line(), Node::make(), Element::makeNS(), Document::setBaseURI(), Document::setRootElement(), Text::setValue(), Comment::setValue(), Text::Text(), and Document::~Document().