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;
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
Core module.
Definition: Allocator.h:33
Represents the start of an element in an XML document.
Definition: StartElement.h:320
StartElement(NamespaceContext &nsctx)
Constructs an empty StartElement.
Definition: StartElement.h:324
const StartElement & toStartElement(const Node &node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:421
void setName(const QName &n, const Namespace &ns)
Sets the qualified name.
Definition: StartElement.h:347
void clear()
Clears the string.
Definition: Api-String.h:368
Iterator find(const String &nsUri, const String &localName)
Finds an attribute by name.
const String & namespaceUri() const
Returns the namespaceUri.
Definition: StartElement.h:73
const String & value() const
Returns the value of this attribute.
Definition: StartElement.h:83
AttributeList & attributes()
Returns the attributes of the element.
Definition: StartElement.h:370
const QName & name() const
Returns the qualified name.
Definition: StartElement.h:342
bool has(const String &nsUri, const String &localName) const
Checks if an attribute is present.
Definition: StartElement.h:257
void setNamespace(const Namespace &ns)
Sets the namespace.
Definition: StartElement.h:360
const Attribute * ConstIterator
Attribute list const iterator.
Definition: StartElement.h:113
Iterator end()
An iterator to the end of the sequence.
Definition: StartElement.h:276
const String & namespaceUri() const
Returns the namespace URI.
Definition: Namespace.h:74
A single attribute of a start element.
Definition: StartElement.h:49
void clear()
Clears the value of this attribute.
Definition: StartElement.h:93
String & value()
Returns the value of this attribute.
Definition: StartElement.h:88
Iterator find(const String &localName)
Finds an attribute by name.
AttributeList(NamespaceContext &nsctx)
Construct with namespace context.
Definition: StartElement.h:118
void clear()
Clears all content.
Definition: StartElement.h:127
Unicode character type.
Definition: String.h:67
bool empty() const
Returns true if the list is empty.
Definition: StartElement.h:291
Attribute * Iterator
Attribute list iterator.
Definition: StartElement.h:109
bool has(const String &localName) const
Checks if an attribute is present.
Definition: StartElement.h:243
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
bool has(const Char *nsUri, const Char *localName) const
Checks if an attribute is present.
Definition: StartElement.h:264
NamespaceContext & namespaceContext()
Returns the namespace context for the attributes.
Definition: StartElement.h:301
ConstIterator find(const Char *localName) const
Finds an attribute by name.
ConstIterator find(const String &localName) const
Finds an attribute by name.
StartElement & toStartElement(Node &node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:412
XML document node.
Definition: Node.h:51
ConstIterator find(const Char *nsUri, const Char *localName) const
Finds an attribute by name.
StartElement * toStartElement(Node *node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:394
const AttributeList & attributes() const
Returns the attributes of the element.
Definition: StartElement.h:365
An attribute list of an XML element.
Definition: StartElement.h:105
ConstIterator end() const
An iterator to the end of the sequence.
Definition: StartElement.h:286
A qualified XML name.
Definition: QName.h:47
const Pt::String & get(const String &localName) const
Gets the value of an attribute.
Iterator find(const Char *nsUri, const Char *localName)
Finds an attribute by name.
const StartElement * toStartElement(const Node *node)
Casts a generic node to a StartElement node.
Definition: StartElement.h:403
ConstIterator find(const String &nsUri, const String &localName) const
Finds an attribute by name.
A namespace used in an XML document.
Definition: Namespace.h:47
Unicode capable basic_string.
Definition: Api-String.h:44
bool has(const Char *localName) const
Checks if an attribute is present.
Definition: StartElement.h:250
Protects derived classes from being copied.
Definition: NonCopyable.h:54
std::size_t size() const
Returns the size of the list.
Definition: StartElement.h:296
Attribute & append(const QName &name, const Namespace &ns)
Appends a new element to the end of the list.
Attribute()
Default constructor.
Definition: StartElement.h:53
const Pt::String & get(const Char *localName) const
Gets the value of an attribute.
const Pt::String & get(const String &nsUri, const String &localName) const
Gets the value of an attribute.
const Pt::String & get(const Char *nsUri, const Char *localName) const
Gets the value of an attribute.
const String & namespaceUri() const
Returns the namespace Uri for this element name.
Definition: StartElement.h:355
Iterator begin()
An iterator to the begin of the sequence.
Definition: StartElement.h:271
void setNamespace(const Namespace &ns)
Sets the namespace.
Definition: StartElement.h:78
void clear()
Clears all content.
Definition: StartElement.h:333
const QName & name() const
Returns the qualified name.
Definition: StartElement.h:60
Iterator find(const Char *localName)
Finds an attribute by name.