Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XMLStackElement Class Template Reference

This node derived class creates element nodes in the XML. More...

#include <XMLStack.h>

Inheritance diagram for XMLStackElement::

XMLStackNode List of all members.

Public Types

typedef XMLStackElement<_E,
_Tr, _A> 
_XMLStackElement

Public Methods

 XMLStackElement (_XMLStackDocument *Doc, const _XMLStackString &Name)
 Constructor which takes a node name. More...

 XMLStackElement (_XMLStackDocument *Doc, const _XMLStackString &Name, const _XMLStackString &NamespaceURI)
 Constructor which takes both a node name and a NamespaceURI. More...

virtual ~XMLStackElement ()
 Destructor.

const _XMLStackStringgetNamespaceURI (void) const
 Returns the URI for the namespace (if any).

virtual void setValue (const _XMLStackString &Value)
 Convenience method that creates a text node with Value. More...

virtual void setValue (unsigned long Value)
virtual void setValue (long Value)
virtual void setValue (unsigned int Value)
virtual void setValue (int Value)
virtual void setValue (unsigned short Value)
virtual void setValue (short Value)
virtual void setValue (signed char Value)
virtual void setValue (char Value)
virtual void setValue (unsigned char Value)
virtual void setValue (double Value, int Scale=6)
virtual void setValue (float Value, int Scale=6)
virtual _XMLStackAttributecreateAttribute (const _XMLStackString &Name, const _XMLStackString &NamespaceURI=_XMLStackString())
 Creates an attribute node for this element node. More...

virtual _XMLStackAttributegetAttribute (const _XMLStackString &Name)
 Returns the attribute node with the specified name. More...

virtual bool hasAttribute (const _XMLStackString &Name) const
 Returns true if the attribute node exists, false otherwise. More...

_XMLStackElementoperator= (const _XMLStackString &Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (unsigned long &Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (long Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (unsigned int Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (int Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (unsigned short Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (short Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (signed char Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (char Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (unsigned char Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (double Value)
 Convenience operator for setValue().

_XMLStackElementoperator= (float Value)
 Convenience operator for setValue().


Protected Types

typedef std::map<_XMLStackString,
_XMLStackAttribute *> 
Attributes
typedef std::vector<_XMLStackAttribute *> AttributesVec

Protected Methods

virtual bool childNodePushed (void)
void writeStartTag (bool EndTag=false)
virtual void popped (void)
virtual _XMLStackNodeclone (void) const
void checkName (void) const

Protected Attributes

_XMLStackString m_NamespaceURI
Attributes m_Attributes
AttributesVec m_AttributesVec
size_t m_StartTagBegin
size_t m_StartTagEnd
bool m_Dirty
bool m_NSDefined

Detailed Description

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>> class XMLStackElement

This node derived class creates element nodes in the XML.

Element nodes are the most common node type. They are also the only node type that supports attribute nodes.

Definition at line 385 of file XMLStack.h.


Member Typedef Documentation

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
typedef std::map<_XMLStackString, _XMLStackAttribute *> XMLStackElement<_E, _Tr, _A>::Attributes [protected]
 

Definition at line 683 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
typedef std::vector<_XMLStackAttribute *> XMLStackElement<_E, _Tr, _A>::AttributesVec [protected]
 

Definition at line 684 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
typedef XMLStackElement<_E, _Tr, _A> XMLStackElement<_E, _Tr, _A>::_XMLStackElement<_E, _Tr, _A>
 

Definition at line 388 of file XMLStack.h.

Referenced by clone().


Constructor & Destructor Documentation

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
XMLStackElement<_E, _Tr, _A>::XMLStackElement<_E, _Tr, _A> ( _XMLStackDocument * Doc,
const _XMLStackString & Name ) [inline]
 

Constructor which takes a node name.

The element name must conform to the rules for valid element names. Only some basic checking is done to make sure the name is valid, and only when the _DEBUG preprocessor symbol is defined.

Parameters:
Doc   The XMLStackDocument this element belongs to
Name   The name of the element
Exceptions:
XMLStackException   Thrown if Name is invalid

Definition at line 402 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
XMLStackElement<_E, _Tr, _A>::XMLStackElement<_E, _Tr, _A> ( _XMLStackDocument * Doc,
const _XMLStackString & Name,
const _XMLStackString & NamespaceURI ) [inline]
 

Constructor which takes both a node name and a NamespaceURI.

The element name must conform to the rules for valid element names. Only some basic checking is done to make sure the name is valid, and only when the _DEBUG preprocessor symbol is defined.

If a NamespaceURI is provided, no checking is performed to see if it was declared in an ancestor element; it will be written out regardless. If you want the element in a namespace but don't want the xmlns declaration again, only prefix the element name with the namespace qualifier (e.g., "NamespaceQualifier:ElementName"). Don't provide the NamespaceURI.

Parameters:
Doc   The XMLStackDocument this element belongs to
Name   The name of the element, along with any namespace prefix unless the node should declare a default namespace.
NamespaceURI   String defining the namespace URI. Even an empty string will declare an empty namespace. If the Name parameter does not have a prefix, this is treated as the default namespace.
Exceptions:
XMLStackException   Thrown if Name is invalid

Definition at line 440 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
XMLStackElement<_E, _Tr, _A>::~XMLStackElement<_E, _Tr, _A> ( ) [inline, virtual]
 

Destructor.

Definition at line 456 of file XMLStack.h.


Member Function Documentation

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::checkName ( void ) const [inline, protected]
 

Definition at line 802 of file XMLStack.h.

Referenced by XMLStackElement().

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
bool XMLStackElement<_E, _Tr, _A>::childNodePushed ( void ) [inline, protected, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 677 of file XMLStack.h.

Referenced by XMLStackDocument::pushElement().

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackNode * XMLStackElement<_E, _Tr, _A>::clone ( void ) const [inline, protected, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 797 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackAttribute & XMLStackElement<_E, _Tr, _A>::createAttribute ( const _XMLStackString & Name,
const _XMLStackString & NamespaceURI = _XMLStackString() ) [inline, virtual]
 

Creates an attribute node for this element node.

Note:
For better performance, you should create all your attributes and assign them values BEFORE pushing any other nodes onto the stack. If you create or modify an attribute after other nodes have been pushed and popped on this element, then the previously written XML will have to be replaced, thus requiring a potentially expensive string copy.
Parameters:
Name   The name of the attribute, with any namespace prefix included if present.
NamespaceURI   String defining the namespace URI. If specified, the node is created in the context of the namespaceURI with the prefix specified on the node name. If the Name parameter does not have a prefix, this is treated as the default namespace.
Exceptions:
XMLStackException   Thrown if the attribute name is invalid or if an attribute already exists with that name

Reimplemented from XMLStackNode.

Definition at line 529 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackAttribute & XMLStackElement<_E, _Tr, _A>::getAttribute ( const _XMLStackString & Name ) [inline, virtual]
 

Returns the attribute node with the specified name.

Parameters:
Name   The qualified name of the attribute node
Exceptions:
XMLStackException   Thrown if the attribute node doesn't exist

Reimplemented from XMLStackNode.

Definition at line 560 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
const _XMLStackString & XMLStackElement<_E, _Tr, _A>::getNamespaceURI ( void ) const [inline]
 

Returns the URI for the namespace (if any).

Definition at line 467 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
bool XMLStackElement<_E, _Tr, _A>::hasAttribute ( const _XMLStackString & Name ) const [inline, virtual]
 

Returns true if the attribute node exists, false otherwise.

Parameters:
Name   The qualified name of the attribute node

Reimplemented from XMLStackNode.

Definition at line 582 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( float Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 669 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( double Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 662 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( unsigned char Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 655 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( char Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 648 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( signed char Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 641 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( short Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 634 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( unsigned short Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 627 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( int Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 620 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( unsigned int Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 613 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( long Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 606 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( unsigned long & Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 599 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackElement<_E, _Tr, _A> & XMLStackElement<_E, _Tr, _A>::operator= ( const _XMLStackString & Value ) [inline]
 

Convenience operator for setValue().

Reimplemented from XMLStackNode.

Definition at line 592 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::popped ( void ) [inline, protected, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 759 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( float Value,
int Scale = 6 ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 503 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( double Value,
int Scale = 6 ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 499 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( unsigned char Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 498 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( char Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 497 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( signed char Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 496 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( short Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 495 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( unsigned short Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 494 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( int Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 493 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( unsigned int Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 492 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( long Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 491 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( unsigned long Value ) [inline, virtual]
 

Reimplemented from XMLStackNode.

Definition at line 490 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::setValue ( const _XMLStackString & Value ) [inline, virtual]
 

Convenience method that creates a text node with Value.

This method pushes a text node onto the stack, assigns Value to it, and then pops it back off.

Note:
One of the side effects of this operation is that multiple assignments actually operate like additions. Every assignment causes another text node to be pushed and popped, thus the text will get appended instead of replacing the previous assignment value.
Parameters:
Value   The string that will be assigned to the text node

Reimplemented from XMLStackNode.

Definition at line 485 of file XMLStack.h.

Referenced by operator=(), and setValue().

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
void XMLStackElement<_E, _Tr, _A>::writeStartTag ( bool EndTag = false ) [inline, protected]
 

Definition at line 694 of file XMLStack.h.

Referenced by childNodePushed(), and popped().


Member Data Documentation

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
Attributes XMLStackElement<_E, _Tr, _A>::m_Attributes [protected]
 

Definition at line 687 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
AttributesVec XMLStackElement<_E, _Tr, _A>::m_AttributesVec [protected]
 

Definition at line 688 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
bool XMLStackElement<_E, _Tr, _A>::m_Dirty [protected]
 

Definition at line 691 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
bool XMLStackElement<_E, _Tr, _A>::m_NSDefined [protected]
 

Definition at line 692 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
_XMLStackString XMLStackElement<_E, _Tr, _A>::m_NamespaceURI [protected]
 

Definition at line 686 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
size_t XMLStackElement<_E, _Tr, _A>::m_StartTagBegin [protected]
 

Definition at line 689 of file XMLStack.h.

template<class _E, class _Tr = std::char_traits<_E>, class _A = std::allocator<_E>>
size_t XMLStackElement<_E, _Tr, _A>::m_StartTagEnd [protected]
 

Definition at line 690 of file XMLStack.h.


The documentation for this class was generated from the following file:
Generated at Mon Aug 6 11:54:21 2001 for XMLStack by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001