cxxtools::xml::NamespaceContext Class Reference

Manages all namespaces which are valid for a specific XML document. More...

#include <cxxtools/xml/namespacecontext.h>

Public Member Functions

 NamespaceContext ()
 Creates a new NamespaceContext object which manages the namespaces of an XML document.
const StringnamespaceUri (const String &prefix) const
 Returns the namespace URI of the namespace which has the prefix that is passed to this method.
const Stringprefix (const String &namespaceUri) const
 Returns the prefix for the namespace which has the URI that is passed to this method.
void addNamespace (const String &elementName, const Namespace &ns)
 Associates the element name (elementName) with the given namespace (ns).
void removeNamespace (const String &elementName)
 Removes the associates of the given element name (elementName) to the namespace.

Detailed Description

Manages all namespaces which are valid for a specific XML document.

Namespaces can be added using the method addNamespace() and can be removed using the method removeNamespace().

To get the namespace URI for a prefix the method namespaceUri() can be used. To determine the prefix for a namespace the method prefix() can be used.

See Also
Namespace

Constructor & Destructor Documentation

cxxtools::xml::NamespaceContext::NamespaceContext ( )
inline

Creates a new NamespaceContext object which manages the namespaces of an XML document.

Member Function Documentation

void cxxtools::xml::NamespaceContext::addNamespace ( const String elementName,
const Namespace ns 
)

Associates the element name (elementName) with the given namespace (ns).

The stored namespace can be retrieved by calling namespaceUri() or prefix(). To remove the association between the element name and namespace again, the method removeNamespace() can be used.

Parameters
elementNameAssociates this element name with the also given namespace (ns).
nsAssociates this namespace with the also given element name (elementName).
const String& cxxtools::xml::NamespaceContext::namespaceUri ( const String prefix) const

Returns the namespace URI of the namespace which has the prefix that is passed to this method.

If no namespace with the given prefix exists, an empty String is returned.

Parameters
prefixThe namespace URI for the namespace with this prefix is returned.
Returns
The namespace URI for the prefix or an empty String if the prefix was not found.
const String& cxxtools::xml::NamespaceContext::prefix ( const String namespaceUri) const

Returns the prefix for the namespace which has the URI that is passed to this method.

If no namespace with this URI exists, an empty String is returned.

Parameters
namespaceUriThe prefix of the namespace with this namespace URI is returned.
Returns
The namespace URI for the prefix or an empty String if the prefix was not found.
void cxxtools::xml::NamespaceContext::removeNamespace ( const String elementName)
inline

Removes the associates of the given element name (elementName) to the namespace.

Parameters
elementNameThe associates for this element name is removed.

The documentation for this class was generated from the following file: