29 #ifndef Pt_Xml_StartElement_h
30 #define Pt_Xml_StartElement_h
32 #include <Pt/Xml/Api.h>
33 #include <Pt/Xml/Node.h>
34 #include <Pt/Xml/QName.h>
35 #include <Pt/Xml/Namespace.h>
36 #include <Pt/NonCopyable.h>
37 #include <Pt/String.h>
44 class NamespaceContext;
179 Iterator find(
const String& localName);
187 Iterator find(
const Char* localName);
196 Iterator find(
const String& nsUri,
const String& localName);
205 Iterator find(
const Char* nsUri,
const Char* localName);
213 ConstIterator find(
const String& localName)
const;
221 ConstIterator find(
const Char* localName)
const;
230 ConstIterator find(
const String& nsUri,
const String& localName)
const;
239 ConstIterator find(
const Char* nsUri,
const Char* localName)
const;
245 return find(localName) != end();
252 return find(localName) != end();
259 return find(nsUri, localName) != end();
266 return find(nsUri, localName) != end();
292 {
return _size == 0; }
305 std::vector<Attribute> _container;
309 NamespaceContext* _nsctx;
361 { _namespace = &ns; }
366 {
return _attributes; }
371 {
return _attributes; }
373 NamespaceMapping& namespaceMapping()
376 const NamespaceMapping& namespaceMapping()
const
380 inline static const Node::Type nodeId()
381 {
return Node::StartElement; }
385 const Namespace* _namespace;
386 AttributeList _attributes;
387 NamespaceMapping _nsmap;
396 return nodeCast<StartElement>(node);
405 return nodeCast<StartElement>(node);
414 return nodeCast<StartElement>(node);
423 return nodeCast<StartElement>(node);
430 #endif // Pt_Xml_StartElement_h
A namespace used in an XML document.
Definition: Namespace.h:46
An attribute list of an XML element.
Definition: StartElement.h:104
Iterator begin()
An iterator to the begin of the sequence.
Definition: StartElement.h:271
bool empty() const
Returns true if the list is empty.
Definition: StartElement.h:291
bool has(const String &nsUri, const String &localName) const
Checks if an attribute is present.
Definition: StartElement.h:257
bool has(const Char *nsUri, const Char *localName) const
Checks if an attribute is present.
Definition: StartElement.h:264
Protects derived classes from being copied.
Definition: NonCopyable.h:54
StartElement * toStartElement(Node *node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:394
AttributeList & attributes()
Returns the attributes of the element.
Definition: StartElement.h:370
std::size_t size() const
Returns the size of the list.
Definition: StartElement.h:296
A qualified XML name.
Definition: QName.h:46
void setName(const QName &n, const Namespace &ns)
Sets the qualified name.
Definition: StartElement.h:347
void clear()
Clears the string.
Definition: String.h:367
const String & value() const
Returns the value of this attribute.
Definition: StartElement.h:83
void clear()
Clears all content.
Definition: StartElement.h:127
void clear()
Clears all content.
Definition: StartElement.h:333
const StartElement & toStartElement(const Node &node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:421
ConstIterator end() const
An iterator to the end of the sequence.
Definition: StartElement.h:286
A single attribute of a start element.
Definition: StartElement.h:48
Attribute()
Default constructor.
Definition: StartElement.h:53
Unicode character type.
Definition: String.h:66
bool has(const Char *localName) const
Checks if an attribute is present.
Definition: StartElement.h:250
void setNamespace(const Namespace &ns)
Sets the namespace.
Definition: StartElement.h:78
const Attribute * ConstIterator
Attribute list const iterator.
Definition: StartElement.h:113
const String & namespaceUri() const
Returns the namespace URI.
Definition: Namespace.h:74
StartElement & toStartElement(Node &node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:412
const QName & name() const
Returns the qualified name.
Definition: StartElement.h:60
Unicode capable basic_string.
Definition: String.h:42
void setNamespace(const Namespace &ns)
Sets the namespace.
Definition: StartElement.h:360
StartElement(NamespaceContext &nsctx)
Constructs an empty StartElement.
Definition: StartElement.h:324
const AttributeList & attributes() const
Returns the attributes of the element.
Definition: StartElement.h:365
bool has(const String &localName) const
Checks if an attribute is present.
Definition: StartElement.h:243
Iterator end()
An iterator to the end of the sequence.
Definition: StartElement.h:276
const String & namespaceUri() const
Returns the namespace Uri for this element name.
Definition: StartElement.h:355
XML document node.
Definition: Node.h:50
void setName(const QName &name, const Namespace &ns)
Sets the qualified name and namespace.
Definition: StartElement.h:65
ConstIterator begin() const
An iterator to the begin of the sequence.
Definition: StartElement.h:281
Represents the start of an element in an XML document.
Definition: StartElement.h:318
const String & namespaceUri() const
Returns the namespaceUri.
Definition: StartElement.h:73
Attribute * Iterator
Attribute list iterator.
Definition: StartElement.h:109
const StartElement * toStartElement(const Node *node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:403
const QName & name() const
Returns the qualified name.
Definition: StartElement.h:342
void clear()
Clears the value of this attribute.
Definition: StartElement.h:93
String & value()
Returns the value of this attribute.
Definition: StartElement.h:88
AttributeList(NamespaceContext &nsctx)
Construct with namespace context.
Definition: StartElement.h:118
NamespaceContext & namespaceContext()
Returns the namespace context for the attributes.
Definition: StartElement.h:301