Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::xom::Document Class Reference

#include "elm/xom.h"

+ Inheritance diagram for elm::xom::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 elm::xom::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 elm::xom::Node
virtual ~Node (void)
 
void * getNode (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 elm::xom::ParentNode
 ParentNode (void *node)
 
void internSetBaseURI (String URI)
 
- Protected Member Functions inherited from elm::xom::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 elm::xom::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 elm::xom::Node
static void freeNode (void *node)
 
- Protected Attributes inherited from elm::xom::Node
void * node
 

Detailed Description

The root object of an XML document.

Constructor & Destructor Documentation

elm::xom::Document::Document ( void *  node,
NodeFactory factory 
)
protected

Build a document from a reader node.

Parameters
nodeParser node.
elm::xom::Document::Document ( Document document)
elm::xom::Document::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 elm::xom::Node::getNode(), and setRootElement().

elm::xom::Document::~Document ( void  )
virtual

References elm::xom::Node::node.

Member Function Documentation

Node * elm::xom::Document::copy ( void  )
virtual

Implements elm::xom::Node.

String elm::xom::Document::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 elm::xom::Node.

References elm::xom::Node::node.

String elm::xom::Document::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 elm::xom::Node.

void elm::xom::Document::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 elm::xom::ParentNode.

void elm::xom::Document::setBaseURI ( String  uri)
virtual

Implements elm::xom::ParentNode.

References elm::xom::Node::node.

void elm::xom::Document::setRootElement ( Element root)
virtual
String elm::xom::Document::toString ( void  )
virtual
String elm::xom::Document::toXML ( void  )
virtual

Implements elm::xom::Node.


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