SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWXmlStreamElement Class Reference

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

#include <rw/xmlstreams/RWXmlStreamElement.h>

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

Public Types

typedef char element_type
 

Public Member Functions

 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)
 
 RWXmlStreamElement (const std::list< std::pair< RWCString, RWXmlNamespace > > &namespaces)
 
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

◆ element_type

A typedef for the type of element.

Constructor & Destructor Documentation

◆ RWXmlStreamElement() [1/4]

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() [2/4]

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() [3/4]

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() [4/4]

RWXmlStreamElement::RWXmlStreamElement ( const RWXmlStreamElement & element)

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

Member Function Documentation

◆ addAttribute()

void RWXmlStreamElement::addAttribute ( const RWXmlAttribute & attribute)

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

◆ addElement()

void RWXmlStreamElement::addElement ( const RWXmlStreamElement & element)

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

◆ addNamespace()

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

◆ deleteAttribute()

void RWXmlStreamElement::deleteAttribute ( const RWXmlName & name)

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

◆ deleteElement()

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.

◆ deleteNamespace()

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.

◆ findAttribute()

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.

◆ findElement()

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.

◆ findNamespaceURI()

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().

◆ findNextElement()

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.

◆ getAttributes()

const RWXmlAttributeSet & RWXmlStreamElement::getAttributes ( ) const
inline

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

◆ getElements()

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

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

◆ getName()

RWXmlName RWXmlStreamElement::getName ( ) const
inline

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

◆ getNamespaces()

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

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

◆ getValue()

RWCString RWXmlStreamElement::getValue ( ) const
inline

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

◆ resolveNamespaces()

void RWXmlStreamElement::resolveNamespaces ( )

Resolves the namespace URIs.

◆ setName()

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

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

◆ setValue() [1/2]

void RWXmlStreamElement::setValue ( const RWCString & value)
inline

Sets a value for the element.

◆ setValue() [2/2]

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 © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.