rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
IlXmlElementI Class Referenceabstract

Interface for XML elements. More...

#include <ilog/xml.h>

Inheritance diagram for IlXmlElementI:
IlXmlNodeI IlXmlElement

Public Member Functions

virtual ~IlXmlElementI ()
 Destructor. More...
 
virtual void addAttribute (IlXmlAttributeI *attribute)
 Adds an attribute to this element. More...
 
virtual void addChild (IlXmlNodeI *node)
 Adds a child node to this element. More...
 
virtual IlXmlAttributeIcreateAttribute (char *name, char *value) const
 Creates an attribute for this element. More...
 
virtual IlXmlNodeIteratorIcreateAttributesIterator () const
 Creates an iterator for the attributes of this element. More...
 
virtual IlXmlElementIcreateChildElement (char *tag) const
 Creates a child element. More...
 
virtual IlXmlNodeIteratorIcreateChildrenIterator () const
 Creates an iterator for the child nodes of this element. More...
 
virtual IlBoolean doesPreserveWhiteSpaces () const
 Indicates if non-significant white spaces are kept. More...
 
virtual IlXmlAttributeIgetAttribute (const char *name) const
 Returns the attribute with the specified name. More...
 
const char * getAttributeValue (const char *name) const
 Returns the value of an attribute. More...
 
virtual const char * getTag () const =0
 Retrieves the tag name of this element. More...
 
virtual const char * getText () const
 Retrieves the content of the first Text node child. More...
 
virtual Type getType () const
 Retrieves the type of this element. More...
 
virtual void preserveWhiteSpaces (IlBoolean preserve)
 Forces non-significant white spaces to be kept or dropped. More...
 
virtual void setTag (const char *tag)
 Sets the tag name of this element. More...
 
virtual void storeAttribute (IlXmlDocumentI *document, char *name, char *value)
 Stores a new attribute that was just read. More...
 
virtual void storeTag (char *tag)
 Sets the tag name of this element. More...
 
virtual ostream & write (ostream &os) const
 Writes the XML representation of this element. More...
 
virtual void writeAttributes (ostream &os) const
 Writes the XML representation of the attributes of this element. More...
 
virtual IlBoolean writeChildren (ostream &os) const
 Writes the XML representation of the children of this element. More...
 

Additional Inherited Members

- Public Types inherited from IlXmlNodeI
enum  Type {
  Attribute, Element, Text, Comment,
  CData, PI, CharRef, EntityRef
}
 The different types of XML nodes. More...
 

Detailed Description

Interface for XML elements.

Library: ilog

Constructor & Destructor Documentation

virtual IlXmlElementI::~IlXmlElementI ( )
virtual

Destructor.

The destructor must destroy all the attributes and the child nodes of this element. The default implementation does nothing.

Member Function Documentation

virtual void IlXmlElementI::addAttribute ( IlXmlAttributeI attribute)
virtual

Adds an attribute to this element.

Parameters
attributeThe attribute to be added to this element. The node is responsible for the destruction of this attribute when this element is destroyed. The default implementation deletes this attribute.

Reimplemented in IlXmlElement.

virtual void IlXmlElementI::addChild ( IlXmlNodeI node)
virtual

Adds a child node to this element.

Parameters
nodeThe new node that is added to this element. The default implementation deletes this node.

Reimplemented in IlXmlElement.

virtual IlXmlAttributeI* IlXmlElementI::createAttribute ( char *  name,
char *  value 
) const
virtual

Creates an attribute for this element.

Parameters
nameThe name of the new attribute. The string is stored as is, that is, not copied. It is deleted using the delete operator.
valueThe value for the new attribute. The string is stored as is, that is, not copied. It is deleted using the delete operator.
Returns
A pointer to the created attribute. The default implementation returns 0.
virtual IlXmlNodeIteratorI* IlXmlElementI::createAttributesIterator ( ) const
virtual

Creates an iterator for the attributes of this element.

Returns
A new iterator for the attributes of this element. The default implementation returns 0.

Reimplemented in IlXmlElement.

virtual IlXmlElementI* IlXmlElementI::createChildElement ( char *  tag) const
virtual

Creates a child element.

This member function is called by the XML parser when a new element, child of this element, is read.
If no element is created (0 is returned), then the method IlvXmlDocumentI::createElement is called in order to create the child element of this node. The default implementation returns 0.

Parameters
tagThe tag name of this new element.
Returns
The new element that was created as the child of the current element object, or 0 if this creation is to be delegated to the document.
virtual IlXmlNodeIteratorI* IlXmlElementI::createChildrenIterator ( ) const
virtual

Creates an iterator for the child nodes of this element.

Returns
A new iterator for the child nodes of this element. The default implementation returns 0.

Reimplemented in IlXmlElement.

virtual IlBoolean IlXmlElementI::doesPreserveWhiteSpaces ( ) const
virtual

Indicates if non-significant white spaces are kept.

Returns
IlTrue if the non-significant white spaces (the ones at the beginning or at the end of the element content) are kept in the element, IlFalse otherwise.
See Also
preserveWhiteSpaces.

Reimplemented in IlXmlElement.

virtual IlXmlAttributeI* IlXmlElementI::getAttribute ( const char *  name) const
virtual

Returns the attribute with the specified name.

Parameters
nameThe name of the attribute that is requested.
Returns
The attribute of this element that has a name similar to (in the sense that strcmp defines) name, or 0 if no attribute has this name. The default implementation scans all the attributes that are accessed by the attributes iterator to find a match.

Reimplemented in IlXmlElement.

const char* IlXmlElementI::getAttributeValue ( const char *  name) const

Returns the value of an attribute.

Parameters
nameThe name of the attribute for which the value is requested.
Returns
The value of the attribute that has a name similar to (in the sense that strcmp defines) name, or 0 if no attribute has this name. The default implementation scans all the attributes that are accessed by the attributes iterator to find a match, then returns its value.
virtual const char* IlXmlElementI::getTag ( ) const
pure virtual

Retrieves the tag name of this element.

Returns
The tag name of this element. The returned string must not be deleted or modified.

Implemented in IlXmlElement.

virtual const char* IlXmlElementI::getText ( ) const
virtual

Retrieves the content of the first Text node child.

Returns
A string that contains the content of the first Text element of this element, or 0 if there are not any. The user must not modify or delete the returned string.

Reimplemented in IlXmlElement.

virtual Type IlXmlElementI::getType ( ) const
virtual

Retrieves the type of this element.

Returns
IlXmlNodeI::Element.

Implements IlXmlNodeI.

virtual void IlXmlElementI::preserveWhiteSpaces ( IlBoolean  preserve)
virtual

Forces non-significant white spaces to be kept or dropped.

Parameters
Ifset to IlTrue, even non-significant white spaces will be kept in the element content.
See Also
doesPreserveWhiteSpaces.

Reimplemented in IlXmlElement.

virtual void IlXmlElementI::setTag ( const char *  tag)
virtual

Sets the tag name of this element.

Parameters
tagThe new tag name of this element. The default implementation calls storeTag with a copy of the string tag.
virtual void IlXmlElementI::storeAttribute ( IlXmlDocumentI document,
char *  name,
char *  value 
)
virtual

Stores a new attribute that was just read.

The default implementation calls addAttribute with the attribute that is returned by a call to createAttribute.

Parameters
documentThe document instance that is used to create the attribute.
nameThe name of the attribute. You are responsible for destroying this string if you do not store it.
valueThe value of the attribute. You are responsible for destroying this string if you do not store it.
virtual void IlXmlElementI::storeTag ( char *  tag)
virtual

Sets the tag name of this element.

Parameters
tagThe new tag name of this element. The string is not copied before it is stored, but it is deleted (using delete []) by the destructor. The default implementation deletes this string and does nothing else with it.

Reimplemented in IlXmlElement.

virtual ostream& IlXmlElementI::write ( ostream &  os) const
virtual

Writes the XML representation of this element.

The default implementation writes the number of spaces indicated by getIndent(), then an open square bracket (<) and the tag name.
writeAttributes is called to save the attributes description.
writeChildren is called to save the description of the potential children of this element. If writeChildren returns IlTrue, it indicates that some children were saved, and write writes the closing tag to the output stream (that is, the tag name between a '</'-'>' sequence. If writeChildren returns IlFalse
it indicates that no child was saved, and write closes the tag by outputting '/>'.

Parameters
osThe output stream to write to.
Returns
The output stream which is written to.

Implements IlXmlNodeI.

virtual void IlXmlElementI::writeAttributes ( ostream &  os) const
virtual

Writes the XML representation of the attributes of this element.

For each attribute of this element, the default implementation prints a space character and calls write on that attribute.

Parameters
osThe output stream to write to.
Returns
The output stream which is written to.
virtual IlBoolean IlXmlElementI::writeChildren ( ostream &  os) const
virtual

Writes the XML representation of the children of this element.

For each child of this element, the default implementation prints a space character and calls write on that node.

Parameters
osThe output stream to write to.
Returns
The output stream which is written to.

© Copyright 2012, 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.