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