SourcePro® API Reference Guide

 
List of all members | Public Types | Public Member Functions
RWXmlStreamElement Class Reference

An XML element abstraction for implementing efficient C++ transformations. More...

#include <rw/xmlstreams/RWXmlStreamElement.h>

Inherited by RWTXmlStreamPrimitive< T >, RWTXmlStreamPrimitive< char >, RWTXmlStreamPrimitive< RWCString >, RWXmlStreamComment, and RWXmlStreamProlog.

Public Types

typedef char element_type
 

Public Member Functions

 RWXmlStreamElement (const std::list< std::pair< RWCString, RWXmlNamespace > > &namespaces)
 
 RWXmlStreamElement (const RWXmlName &name, const RWCString &value, const std::list< std::pair< RWCString, RWXmlNamespace > > &namespaces)
 
 RWXmlStreamElement (const RWXmlName &name, RWXmlStreamElement *element, const std::list< std::pair< RWCString, RWXmlNamespace > > &namespaces)
 
 RWXmlStreamElement (const RWXmlStreamElement &element)
 
void addAttribute (const RWXmlAttribute &attribute)
 
void addElement (const RWXmlStreamElement &element)
 
void addNamespace (const RWCString &prefix, const RWXmlNamespace &fullname)
 
void deleteAttribute (const RWXmlName &name)
 
void deleteElement (const RWXmlName &name)
 
bool deleteNamespace (const RWCString &prefix)
 
RWCString findAttribute (const RWXmlName &name) const
 
const_iterator findElement (const RWXmlName &name) const
 
const RWXmlNamespace findNamespaceURI (const RWCString &prefix) const
 
const_iterator findNextElement (const RWXmlName &name, const_iterator start) const
 
const RWXmlAttributeSet & getAttributes () const
 
const std::list< RWXmlStreamElement * > & getElements () const
 
RWXmlName getName () const
 
const std::list< std::pair< RWCString, RWXmlNamespace > > & getNamespaces () const
 
RWCString getValue () const
 
void resolveNamespaces ()
 
void setName (const RWXmlName &name)
 
void setValue (const RWCString &value)
 
void setValue (const RWXmlStreamElement &element)
 

Detailed Description

This class represents an XML element abstraction for implementing efficient C++ transformations.

Member Typedef Documentation

A typedef for the type of element.

Constructor & Destructor Documentation

RWXmlStreamElement::RWXmlStreamElement ( const std::list< std::pair< RWCString, RWXmlNamespace > > &  namespaces)
inline

This constructor takes a set of namespaces valid in the scope of this element. The parameter namespaces holds a set of RWCString / RWXmlNamespace pairs.

RWXmlStreamElement::RWXmlStreamElement ( const RWXmlName &  name,
const RWCString value,
const std::list< std::pair< RWCString, RWXmlNamespace > > &  namespaces 
)

This constructor takes a name for the element, a CDATA value, and a list of namespaces. The parameter name contains a name for this element. The parameter value contains CDATA for the content of this element. The parameter namespaces holds a set of RWCString / RWXmlNamespace pairs.

RWXmlStreamElement::RWXmlStreamElement ( const RWXmlName &  name,
RWXmlStreamElement element,
const std::list< std::pair< RWCString, RWXmlNamespace > > &  namespaces 
)

This constructor takes a name for the element, an element value, and a list of namespaces. The parameter name contains a name for this element. The parameter element contains an element for the content of this element. The parameter namespaces holds a set of RWCString / RWXmlNamespace pairs.

RWXmlStreamElement::RWXmlStreamElement ( const RWXmlStreamElement element)

This is a copy constructor. The parameter element contains the element to copy.

Member Function Documentation

void RWXmlStreamElement::addAttribute ( const RWXmlAttribute &  attribute)

Adds an attribute. The parameter attribute contains the attribute to add.

void RWXmlStreamElement::addElement ( const RWXmlStreamElement element)

Adds an element to the set contained by this. The parameter element contains the element to add.

void RWXmlStreamElement::addNamespace ( const RWCString prefix,
const RWXmlNamespace &  fullname 
)

Adds a namespace to the set valid for this element. If the namespace is already present, this operation will replace it. The parameter prefix contains the namespace prefix (synonym). The parameter fullname contains the full namespace (prefix and URI).

void RWXmlStreamElement::deleteAttribute ( const RWXmlName &  name)

Deletes an attribute. The parameter name contains the name of the attribute to be deleted.

void RWXmlStreamElement::deleteElement ( const RWXmlName &  name)

Deletes an element from the set contained by this. Removes the first element with a matching name. The parameter name contains the name of the element to be deleted.

bool RWXmlStreamElement::deleteNamespace ( const RWCString prefix)

Deletes an namespace from the set valid for this element. The parameter prefix contains the prefix of the namespace to be deleted.

RWCString RWXmlStreamElement::findAttribute ( const RWXmlName &  name) const

Finds an attribute. The parameter name contains the name of the attribute to locate. Returns the value of the attribute, or RWCString() if none is found.

const_iterator RWXmlStreamElement::findElement ( const RWXmlName &  name) const

Finds an element in the set contained by this. The parameter name contains the name of the element to locate. Returns the first element with a matching name.

const RWXmlNamespace RWXmlStreamElement::findNamespaceURI ( const RWCString prefix) const

Finds the URI for a namespace. The parameter prefix contains the name of the namespace. Returns the URI for the namespace if present, otherwise returns RWCString().

const_iterator RWXmlStreamElement::findNextElement ( const RWXmlName &  name,
const_iterator  start 
) const

Finds an element in the set contained by this. The parameter name contains the name of the element to locate. The parameter start contains the iterator where the search starts. Returns the first element after start with a matching name.

const RWXmlAttributeSet& RWXmlStreamElement::getAttributes ( ) const
inline

Gets the element's attributes. Returns the set of attributes for this element.

const std::list<RWXmlStreamElement*>& RWXmlStreamElement::getElements ( ) const
inline

Gets the set of sub-elements. Returns the set of elements contained in this element.

RWXmlName RWXmlStreamElement::getName ( void  ) const
inline

Gets the element's name. Returns the name of this element.

const std::list<std::pair<RWCString, RWXmlNamespace> >& RWXmlStreamElement::getNamespaces ( ) const
inline

Gets the elements namespaces. Returns the set of namespaces active for this element.

RWCString RWXmlStreamElement::getValue ( void  ) const
inline

Gets the element's value. Returns the value for this element.

void RWXmlStreamElement::resolveNamespaces ( )

Resolves the namespace URIs.

void RWXmlStreamElement::setName ( const RWXmlName &  name)
inline

Sets the element's name. The parameter name contains a name for this element.

void RWXmlStreamElement::setValue ( const RWCString value)
inline

Sets a value for the element.

void RWXmlStreamElement::setValue ( const RWXmlStreamElement element)
inline

Adds an element to the set contained by this. The parameter element contains the element to add.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.