AttributeList Class Reference

#include <Pt/Xml/StartElement.h>

An attribute list of an XML element.

Inherits NonCopyable.

Public Types

typedef AttributeIterator
 Attribute list iterator.
 
typedef const AttributeConstIterator
 Attribute list const iterator.
 

Public Member Functions

 AttributeList (NamespaceContext &nsctx)
 Construct with namespace context.
 
void clear ()
 Clears all content.
 
Attributeappend (const QName &name, const Namespace &ns)
 Appends a new element to the end of the list. More...
 
const Pt::Stringget (const String &localName) const
 Gets the value of an attribute. More...
 
const Pt::Stringget (const Char *localName) const
 Gets the value of an attribute. More...
 
const Pt::Stringget (const String &nsUri, const String &localName) const
 Gets the value of an attribute. More...
 
const Pt::Stringget (const Char *nsUri, const Char *localName) const
 Gets the value of an attribute. More...
 
Iterator find (const String &localName)
 Finds an attribute by name. More...
 
Iterator find (const Char *localName)
 Finds an attribute by name. More...
 
Iterator find (const String &nsUri, const String &localName)
 Finds an attribute by name. More...
 
Iterator find (const Char *nsUri, const Char *localName)
 Finds an attribute by name. More...
 
ConstIterator find (const String &localName) const
 Finds an attribute by name. More...
 
ConstIterator find (const Char *localName) const
 Finds an attribute by name. More...
 
ConstIterator find (const String &nsUri, const String &localName) const
 Finds an attribute by name. More...
 
ConstIterator find (const Char *nsUri, const Char *localName) const
 Finds an attribute by name. More...
 
bool has (const String &localName) const
 Checks if an attribute is present.
 
bool has (const Char *localName) const
 Checks if an attribute is present.
 
bool has (const String &nsUri, const String &localName) const
 Checks if an attribute is present.
 
bool has (const Char *nsUri, const Char *localName) const
 Checks if an attribute is present.
 
Iterator begin ()
 An iterator to the begin of the sequence.
 
Iterator end ()
 An iterator to the end of the sequence.
 
ConstIterator begin () const
 An iterator to the begin of the sequence.
 
ConstIterator end () const
 An iterator to the end of the sequence.
 
bool empty () const
 Returns true if the list is empty.
 
std::size_t size () const
 Returns the size of the list.
 
NamespaceContext & namespaceContext ()
 Returns the namespace context for the attributes.
 

Member Function Documentation

◆ append()

Attribute& append ( const QName name,
const Namespace ns 
)

A new attribute is added to the end of the list with the name name in the namespace ns

◆ get() [1/4]

const Pt::String& get ( const String localName) const

The value of the attribute with the local name localName is returned. If no attribute by that name is present, an exception of type XmlError is thrown.

◆ get() [2/4]

const Pt::String& get ( const Char localName) const

The value of the attribute with the local name localName is returned. If no attribute by that name is present, an exception of type XmlError is thrown.

◆ get() [3/4]

const Pt::String& get ( const String nsUri,
const String localName 
) const

The value of the attribute with the namespace nsUri and the local name localName is returned. If no attribute by that name is present, an exception of type XmlError is thrown.

◆ get() [4/4]

const Pt::String& get ( const Char nsUri,
const Char localName 
) const

The value of the attribute with the namespace nsUri and the local name localName is returned. If no attribute by that name is present, an exception of type XmlError is thrown.

◆ find() [1/8]

Iterator find ( const String localName)

An iterator to the the attribute with the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [2/8]

Iterator find ( const Char localName)

An iterator to the the attribute with the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [3/8]

Iterator find ( const String nsUri,
const String localName 
)

An iterator to the the attribute with the the namespace nsUri and the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [4/8]

Iterator find ( const Char nsUri,
const Char localName 
)

An iterator to the the attribute with the the namespace nsUri and the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [5/8]

ConstIterator find ( const String localName) const

An iterator to the the attribute with the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [6/8]

ConstIterator find ( const Char localName) const

An iterator to the the attribute with the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [7/8]

ConstIterator find ( const String nsUri,
const String localName 
) const

An iterator to the the attribute with the the namespace nsUri and the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.

◆ find() [8/8]

ConstIterator find ( const Char nsUri,
const Char localName 
) const

An iterator to the the attribute with the the namespace nsUri and the local name localName is returned. If no attribute by that name is present, an iterator to the end of the sequence is returned.