Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Document Class Reference

#include "elm/xom.h"

+ Inheritance diagram for Document:

Public Member Functions

 Document (Document *document)
 
 Document (Element *root_element)
 
virtual ~Document (void)
 
virtual Nodecopy (void)
 
virtual String getBaseURI (void)
 
virtual ElementgetRootElement (void)
 
virtual String getValue (void)
 
virtual void replaceChild (Node *old_child, Node *new_child)
 
virtual void setBaseURI (String uri)
 
virtual void setRootElement (Element *root)
 
virtual String toString (void)
 
virtual String toXML (void)
 
- Public Member Functions inherited from ParentNode
virtual void appendChild (Node *child)
 
virtual int indexOf (Node *child)
 
virtual void insertChild (Node *child, int position)
 
virtual NoderemoveChild (int position)
 
virtual NoderemoveChild (Node *child)
 
virtual NodegetChild (int index)
 
virtual int getChildCount (void)
 
- Public Member Functions inherited from Node
virtual ~Node (void)
 
voidgetNode (void) const
 
kind_t kind (void) const
 
void detach (void)
 
bool equals (const Node *node) const
 
virtual DocumentgetDocument (void)
 
virtual ParentNodegetParent (void)
 
virtual Nodesquery (const String &xpath)
 
virtual Nodesquery (const String &xpath, XPathContext *context)
 
int line (void) const
 

Protected Member Functions

 Document (void *node, NodeFactory *fact)
 
- Protected Member Functions inherited from ParentNode
 ParentNode (void *node)
 
void internSetBaseURI (String URI)
 
- Protected Member Functions inherited from Node
 Node (void *_node)
 
void setNode (void *_node)
 
Nodemake (void *node)
 
Nodeget (void *node)
 
NodeinternCopy (void)
 
NodeinternGetChild (int index)
 
int internGetChildCount (void)
 
String internGetValue (void)
 
String internToXML (void)
 

Additional Inherited Members

- Public Types inherited from Node
enum  kind_t {
  NONE = 0, ELEMENT, DOCUMENT, TEXT,
  COMMENT, ATTRIBUTE, PROCESSING_INSTRUCTION, DOCTYPE,
  NAMESPACE
}
 
typedef enum elm::xom::Node::kind_t kind_t
 
- Static Protected Member Functions inherited from Node
static void freeNode (void *node)
 
- Protected Attributes inherited from Node
voidnode
 

Detailed Description

The root object of an XML document.

Constructor & Destructor Documentation

◆ Document() [1/3]

Document ( void node,
NodeFactory factory 
)
protected

Build a document from a reader node.

Parameters
nodeParser node.

References Node::node.

◆ Document() [2/3]

Document ( Document document)

◆ Document() [3/3]

Document ( Element root_element)

Creates a new Document object with the specified root element.

Parameters
root- the root element of this document
Warning
Fails if root already has a parent.

References Node::getNode(), and Document::setRootElement().

◆ ~Document()

~Document ( void  )
virtual

References Node::node.

Member Function Documentation

◆ copy()

Node * copy ( void  )
virtual

Implements Node.

◆ getBaseURI()

String getBaseURI ( void  )
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.

The base URI of a non-parent node is the base URI of the element containing the node. The base URI of a document node is the URI from which the document was parsed, or which was set by calling setBaseURI on on the document.

The base URI of an element is determined as follows:

  • If the element has an xml:base attribute, then the value of that attribute is converted from an IRI to a URI, absolutized if possible, and returned.

Otherwise, if any ancestor element of the element loaded from the same entity has an xml:base attribute, then the value of that attribute from the nearest such ancestor is converted from an IRI to a URI, absolutized if possible, and returned. xml:base attributes from other entities are not considered.

  • Otherwise, if setBaseURI() has been invoked on this element, then the URI most recently passed to that method is absolutized if possible and returned.
  • Otherwise, if the element comes from an externally parsed entity or the document entity, and the original base URI has not been changed by invoking setBaseURI(), then the URI of that entity is returned.
  • Otherwise, (the element was created by a constructor rather then being parsed from an existing document), the base URI of the nearest ancestor that does have a base URI is returned. If no ancestors have a base URI, then the empty string is returned. Absolutization takes place as specified by the XML Base specification. However, it is not always possible to absolutize a relative URI, in which case the empty string will be returned.
    Returns
    the base URI of this node

Reimplemented from Node.

References Node::node.

◆ getRootElement()

Element * getRootElement ( void  )
virtual

Get the root element of the document.

Returns
Root element or null.

References Node::get(), and Node::node.

Referenced by XOMUnserializer::flush(), Element::parse(), and Serializer::write().

◆ getValue()

String getValue ( void  )
virtual

Get the node as a string with markup removed.

Returns
Text value of the node. The returned string must be fried by the caller.

Implements Node.

◆ replaceChild()

void replaceChild ( Node old_child,
Node new_child 
)
virtual

Replaces an existing child with a new child node. If oldChild is not a child of this node, then a NoSuchChildException is thrown.

Parameters
oldChildthe node removed from the tree
newChildthe node inserted into the tree
Exceptions
MultipleParentExceptionif newChild already has a parent.
IllegalAddExceptionif this node cannot have children of the type of newChild.

Reimplemented from ParentNode.

◆ setBaseURI()

void setBaseURI ( String  uri)
virtual

Implements ParentNode.

References Node::node.

◆ setRootElement()

void setRootElement ( Element root)
virtual

◆ toString()

String toString ( void  )
virtual

Referenced by XSLTransform::toString().

◆ toXML()

String toXML ( void  )
virtual

Implements Node.


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