32 #include <Pt/Xml/Api.h>
33 #include <Pt/Xml/XmlError.h>
90 T* nodeCast(Node* node)
94 if( node->type() == T::nodeId() )
95 e =
static_cast<T*
>(node);
101 template <
typename T>
102 const T* nodeCast(
const Node* node)
106 if( node->type() == T::nodeId() )
107 e =
static_cast<const T*
>(node);
113 template <
typename T>
114 T& nodeCast(Node& node)
116 if( node.type() != T::nodeId() )
117 throw XmlError(
"unexpected node type");
119 return static_cast<T&
>(node);
123 template <
typename T>
124 const T& nodeCast(
const Node& node)
126 if( node.type() != T::nodeId() )
127 throw XmlError(
"unexpected node type");
129 return static_cast<const T&
>(node);
136 #endif // Pt_Xml_Node_h
Core module.
Definition: Allocator.h:33
Represents a closing element tag in an XML document.
Definition: EndElement.h:46
A DocType node represents the begin of a DTD.
Definition: DocType.h:54
A processing instruction of an XML document.
Definition: ProcessingInstruction.h:48
Represents the start of an element in an XML document.
Definition: StartElement.h:320
virtual ~Node()
Destructor.
Definition: Node.h:69
An entity reference XML node.
Definition: Entity.h:138
An EndDocType node represents the end of a DTD.
Definition: DocType.h:160
A Node representing the begin of the XML document.
Definition: StartDocument.h:45
XML document node.
Definition: Node.h:51
Type type() const
Returns the type of the node.
Definition: Node.h:74
A Character node represents text in an XML document.
Definition: Characters.h:48
Node(Type type)
Constructs a new Node object with the specified node type.
Definition: Node.h:80
Represents the end of an XML document.
Definition: EndDocument.h:46