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
Represents a closing element tag in an XML document.
Definition: EndElement.h:44
A processing instruction of an XML document.
Definition: ProcessingInstruction.h:47
A DocType node represents the begin of a DTD.
Definition: DocType.h:52
virtual ~Node()
Destructor.
Definition: Node.h:69
A Character node represents text in an XML document.
Definition: Characters.h:47
A Node representing the begin of the XML document.
Definition: StartDocument.h:44
An entity reference XML node.
Definition: Entity.h:136
An EndDocType node represents the end of a DTD.
Definition: DocType.h:158
Represents the end of an XML document.
Definition: EndDocument.h:45
Node(Type type)
Constructs a new Node object with the specified node type.
Definition: Node.h:80
Type type() const
Returns the type of the node.
Definition: Node.h:74
XML document node.
Definition: Node.h:50
Represents the start of an element in an XML document.
Definition: StartElement.h:318