Views
Foundation Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlXmlDocument Class Reference

Default implementation for XML documents. More...

#include <ilog/xml.h>

Inheritance diagram for IlXmlDocument:
IlXmlDocumentI

Public Member Functions

virtual void addNode (IlXmlNodeI *)
 Adds a new node. More...
 
virtual IlXmlNodeIteratorIcreateNodesIterator () const
 Creates an iterator for the nodes of this document. More...
 
virtual void empty ()
 Empties this document. More...
 
IlXmlElementgetRootElement () const
 Gets the root element of this document. More...
 
virtual const char * getVersion () const
 Gets the version of the document. More...
 
- Public Member Functions inherited from IlXmlDocumentI
virtual ~IlXmlDocumentI ()
 Destructor. More...
 
virtual void attributeAdded (IlXmlElementI *element, IlXmlAttributeI *attribute)
 Receives notification of the creation of an attribute. More...
 
virtual void cDataAdded (IlXmlCDataI *cdata)
 Receives notification of the creation of a CDATA node. More...
 
virtual void charRefAdded (IlXmlCharRefI *charRef)
 Receives notification of the creation of a CharRef. More...
 
virtual void commentAdded (IlXmlCommentI *comment)
 Receives notification of the creation of a comment. More...
 
virtual IlXmlAttributeIcreateAttribute (IlXmlElementI *element, char *name, char *value) const
 Creates a new XML attribute for a given element. More...
 
virtual IlXmlCDataIcreateCData () const
 Creates a new XML CDATA node. More...
 
virtual IlXmlCharRefIcreateCharRef () const
 Creates a new XML CharRef node. More...
 
virtual IlXmlCommentIcreateComment () const
 Creates a new XML comment node. More...
 
virtual IlXmlElementIcreateElement (char *tag) const
 Creates a new XML element. More...
 
virtual IlXmlPIIcreatePI () const
 Creates a new XML processing instruction node. More...
 
virtual IlXmlTextIcreateText () const
 Creates a new XML text node. More...
 
virtual void endElement (IlXmlElementI *element)
 Receives notification of the end of an element. More...
 
virtual IlXmlNodeFactorygetNodeFactory () const
 Gets the node factory of this document. More...
 
virtual void processingInstructionAdded (IlXmlPII *pi)
 Receives notification of the creation of a processing instruction node. More...
 
void read (std::istream &stream)
 Reads an XML document. More...
 
virtual void startElement (IlXmlElementI *element)
 Receives notification of the creation of an element. More...
 
virtual void textAdded (IlXmlTextI *text)
 Receives notification of the creation of a text node. More...
 
virtual std::ostream & write (std::ostream &stream) const
 Writes an XML document. More...
 
virtual void writeNodes (std::ostream &stream) const
 Writes the XML nodes of this document. More...
 

Protected Member Functions

virtual void storeVersion (char *version)
 Stores the XML version. More...
 

Detailed Description

Default implementation for XML documents.

Library: ilog

This class can create, parse or output entire XML documents.
IlXmlDocument is a predefined type, derived from IlXmlDocumentI, that implements all the code that builds and holds a complete XML document that can be read from a stream.
You can use an XML document if you need a ready-to-use, efficient way of reading XML data that does not need streaming.

Member Function Documentation

◆ addNode()

virtual void IlXmlDocument::addNode ( IlXmlNodeI node)
virtual

Adds a new node.

This method is called when the XML parser creates a top-level node. It can be an element (then it is unique, and considered as the root element of the document), a comment or a processing instruction.

Parameters
nodeA pointer to the new node.

Implements IlXmlDocumentI.

◆ createNodesIterator()

virtual IlXmlNodeIteratorI* IlXmlDocument::createNodesIterator ( ) const
virtual

Creates an iterator for the nodes of this document.

Returns
A new instance of an iterator for all the nodes stored in this document. The caller is responsible for the destruction of this iterator.

Reimplemented from IlXmlDocumentI.

◆ empty()

virtual void IlXmlDocument::empty ( )
virtual

Empties this document.

Removes and destroys all the nodes stored in this document. The default implementation does nothing.

Reimplemented from IlXmlDocumentI.

◆ getRootElement()

IlXmlElement* IlXmlDocument::getRootElement ( ) const

Gets the root element of this document.

An XML document may have one and only one root element, that may store several child nodes.

Returns
A pointer to the first element located in this document (the first nodes that has the Element node type).

◆ getVersion()

virtual const char* IlXmlDocument::getVersion ( ) const
virtual

Gets the version of the document.

The default implementation returns the string "1.0".

Returns
A string that describes the version of this document. The string must not be deleted or modified.
See also
storeVersion().

Reimplemented from IlXmlDocumentI.

◆ storeVersion()

virtual void IlXmlDocument::storeVersion ( char *  version)
protectedvirtual

Stores the XML version.

The default implementation deletes the string and does not store it anywhere.

Parameters
versionThe new version of this document. The string is stored as is and is not copied by the document.

Reimplemented from IlXmlDocumentI.