Rogue Wave Views Foundation Package API Reference Guide |
Rogue Wave Views Documentation Home |
Interface for XML documents. More...
#include <ilog/xml.h>
Public Member Functions | |
virtual | ~IlXmlDocumentI () |
Destructor. More... | |
virtual void | addNode (IlXmlNodeI *node)=0 |
Adds a new node. 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 IlXmlAttributeI * | createAttribute (IlXmlElementI *element, char *name, char *value) const |
Creates a new XML attribute for a given element. More... | |
virtual IlXmlCDataI * | createCData () const |
Creates a new XML CDATA node. More... | |
virtual IlXmlCharRefI * | createCharRef () const |
Creates a new XML CharRef node. More... | |
virtual IlXmlCommentI * | createComment () const |
Creates a new XML comment node. More... | |
virtual IlXmlElementI * | createElement (char *tag) const |
Creates a new XML element. More... | |
virtual IlXmlNodeIteratorI * | createNodesIterator () const |
Creates an iterator for the nodes of this document. More... | |
virtual IlXmlPII * | createPI () const |
Creates a new XML processing instruction node. More... | |
virtual IlXmlTextI * | createText () const |
Creates a new XML text node. More... | |
virtual void | empty () |
Empties this document. More... | |
virtual void | endElement (IlXmlElementI *element) |
Receives notification of the end of an element. More... | |
virtual IlXmlNodeFactory * | getNodeFactory () const |
Gets the node factory of this document. More... | |
virtual const char * | getVersion () const |
Gets the version of the 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... | |
Interface for XML documents.
Library: ilog
This interface defines the entire interface of XML document objects.
An IlXmlDocumentI
can parse an XML file and produce XML nodes that you can work with.
It can also save itself as a valid XML document.
|
virtual |
Destructor.
The destructor must free all the nodes stored in this document. The default implementation does nothing, but subclasses of IlXmlDocumentI
should perform, in their destructor, a call to their implementation of empty
.
|
pure 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.
node | A pointer to the new node. |
Implemented in IlXmlDocument.
|
virtual |
Receives notification of the creation of an attribute.
This method is called when the XML parser creates a new attribute (that is, when it detects a name-attribute value pair within a tag). The attribute is initialized with the attribute name and its value, but is not stored in the node yet.
element | A pointer to the element where this attribute is stored. |
attribute | A pointer to the new attribute. |
|
virtual |
Receives notification of the creation of a CDATA node.
This method is called when the XML parser finds a CDATA chunk in its input stream (that is, a block surrounded by <![CDATA[... ]]>
). The CDATA node is initialized with the content that was found but is not stored in the document yet.
cdata | A pointer to the new CDATA node. |
|
virtual |
Receives notification of the creation of a CharRef
.
This method is called when the XML parser finds a CharRef
entity in its input stream (that is, a &#
, &#x
or &name
sequence). The CharRef
node is initialized with the reference that was found but is not stored in the document yet.
charRef | A pointer to the new CharRef node. |
|
virtual |
Receives notification of the creation of a comment.
This method is called when the XML parser finds a comment in its input stream (that is, a <!– ... –>
sequence). The comment node is initialized with the comment that was found but is not stored in the document yet.
comment | A pointer to the new comment node. |
|
virtual |
Creates a new XML attribute for a given element.
element | The element that will store the new attribute. |
name | The attribute name. |
value | The attribute value. |
IlXmlElementI::createAttribute()
on the indicated element with the provided attribute name and value parameters.0
, then the library calls IlXmlNodeFactory::createAttribute()
of this document node factory, if there is one.0
, a new IlXmlAttribute
object is created, initialized with name and value, then returned. getNodeFactory()
.
|
virtual |
Creates a new XML CDATA node.
IlXmlNodeFactory::createCData()
of this document node factory, if there is one.0
, a new IlXmlCData
object is created and returned. getNodeFactory()
.
|
virtual |
Creates a new XML CharRef node.
CharRef
node.IlXmlNodeFactory::createCharRef()
of this document node factory, if there is one.0
, a new empty IlXmlCharRef
object is created and returned. getNodeFactory()
.
|
virtual |
Creates a new XML comment node.
IlXmlNodeFactory::createComment()
of this document node factory, if there is one.0
, a new empty IlXmlComment
object is created and returned. getNodeFactory()
.
|
virtual |
Creates a new XML element.
tag | The tag name of the new element. This must be stored in the new element, or deleted if not used. |
IlXmlNodeFactory::createElement()
of this document node factory, if there is one.0
, the default implementation creates a new IlXmlElement
, initialized with the tag name tag.getNodeFactory()
.
|
virtual |
Creates an iterator for the nodes of this document.
Reimplemented in IlXmlDocument.
|
virtual |
Creates a new XML processing instruction node.
IlXmlNodeFactory::createPI()
of this document node factory, if there is one.0
, a new IlXmlPI
object is created and returned. getNodeFactory()
.
|
virtual |
Creates a new XML text node.
IlXmlNodeFactory::createText()
of this document node factory, if there is one.0
, a new empty IlXmlText
object is created and returned. getNodeFactory()
.
|
virtual |
Empties this document.
Removes and destroys all the nodes stored in this document. The default implementation does nothing.
Reimplemented in IlXmlDocument.
|
virtual |
Receives notification of the end of an element.
This method is called when the XML parser finds the closing tag (that is, a </tag>
sequence). The element is completely initialized (tag name and attributes), but is not stored in the document yet.
element | A pointer to the element that is ending. |
|
virtual |
Gets the node factory of this document.
The default implementation returns 0
.
0
if there is none.
|
virtual |
Gets the version of the document.
The default implementation returns the string "1.0"
.
storeVersion()
. Reimplemented in IlXmlDocument.
|
virtual |
Receives notification of the creation of a processing instruction node.
This method is called when the XML parser finds a processing instruction in its input stream (that is, a <? ... ?>
, sequence). The PI node is initialized with the processing instruction content that was found but is not stored in the document yet.
pi | A pointer to the new PI node. |
void IlXmlDocumentI::read | ( | std::istream & | stream | ) |
Reads an XML document.
This method empties the document (by calling the method empty()
), then reads the input stream in order to parse the XML content of it.
On Windows, if the stream is an ifstream
, it must be opened in binary mode.
stream | The input stream from which the XML data is read. |
|
virtual |
Receives notification of the creation of an element.
This method is called when the XML parser finds a starting tag (that is, a <tag>
sequence). The element is initialized with the tag name, but has no attributes, and is not stored in the document yet.
element | A pointer to the new element. |
|
protectedvirtual |
Stores the XML version.
The default implementation deletes the string and does not store it anywhere.
version | The new version of this document. The string is stored as is and is not copied by the document. |
Reimplemented in IlXmlDocument.
|
virtual |
Receives notification of the creation of a text node.
This method is called when the XML parser finds a text section in its input stream. The text node is initialized with the text that was found but is not stored in the document yet.
text | A pointer to the new text node. |
|
virtual |
Writes an XML document.
This method saves the entire document as a valid XML stream. After saving the XML file header, this member function calls writeNodes()
.
stream | The output stream where the XML data is output. |
|
virtual |
Writes the XML nodes of this document.
stream | The output stream where the XML data is output. |
© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.