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
IlXmlElement Class Reference

Default implementation of XML elements. More...

#include <ilog/xml.h>

Inheritance diagram for IlXmlElement:
IlXmlElementI IlXmlNodeI

Public Member Functions

virtual void addAttribute (IlXmlAttributeI *)
 Adds an attribute to this element. More...
 
virtual void addChild (IlXmlNodeI *)
 Adds a child node to this element. More...
 
virtual IlXmlNodeIteratorIcreateAttributesIterator () const
 Creates an iterator for the attributes of this 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 *) const
 Returns the attribute with the specified name. More...
 
IlXmlElementgetElement (const char *tagName, IlXmlNodeI *skip=0) const
 Returns a child element that has a given tag name. More...
 
virtual const char * getTag () const
 Retrieves the tag name of this element. More...
 
virtual const char * getText () const
 Retrieves the content of the first Text node child. More...
 
virtual void preserveWhiteSpaces (IlBoolean preserve)
 Forces non-significant white spaces to be kept or dropped. More...
 
virtual void storeTag (char *)
 Sets the tag name of this element. More...
 
- Public Member Functions inherited from IlXmlElementI
virtual ~IlXmlElementI ()
 Destructor. More...
 
virtual IlXmlAttributeIcreateAttribute (char *name, char *value) const
 Creates an attribute for this element. More...
 
virtual IlXmlElementIcreateChildElement (char *tag) const
 Creates a child element. More...
 
const char * getAttributeValue (const char *name) const
 Returns the value of an attribute. More...
 
virtual Type getType () const
 Retrieves the type of this element. 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 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

Default implementation of XML elements.

Library: ilog

This class implements the interface IlXmlElementI to provide the basic functionality of an XML element.
Child nodes and attributes are stored in a list.

Member Function Documentation

virtual void IlXmlElement::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 from IlXmlElementI.

virtual void IlXmlElement::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 from IlXmlElementI.

virtual IlXmlNodeIteratorI* IlXmlElement::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 from IlXmlElementI.

virtual IlXmlNodeIteratorI* IlXmlElement::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 from IlXmlElementI.

virtual IlBoolean IlXmlElement::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 from IlXmlElementI.

virtual IlXmlAttributeI* IlXmlElement::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 from IlXmlElementI.

IlXmlElement* IlXmlElement::getElement ( const char *  tagName,
IlXmlNodeI skip = 0 
) const

Returns a child element that has a given tag name.

This member function searches a child element of this element that has a tag named tagName. If skip is not null, this member function starts the search after this node.
This member function is very useful when you want to get all the child elements that have a given tag name. Then, for the skip parameter you have to provide the last match that this function has found.

Parameters
tagNameThe tag name of the element that is searched in the children of this element.
skipA pointer to the node after which the search starts.
Returns
A pointer to the element that was found, or 0 if no matching element could be located.
virtual const char* IlXmlElement::getTag ( ) const
virtual

Retrieves the tag name of this element.

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

Implements IlXmlElementI.

virtual const char* IlXmlElement::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 from IlXmlElementI.

virtual void IlXmlElement::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 from IlXmlElementI.

virtual void IlXmlElement::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 from IlXmlElementI.


© 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.