Webmaster  |  Imprint 
C++ Server Pages
Main  |  License  |  Documentation  |  Download 

NamespaceContext Class Reference

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

#include <cxxtools/xml/namespacecontext.h>

List of all members.

Public Member Functions

 NamespaceContext ()
 Creates a new NamespaceContext object which manages the namespaces of an XML document.
 ~NamespaceContext ()
 Empty destructor.
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

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

Member Function Documentation

const String& namespaceUri ( const String prefix  )  const

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

Parameters:
prefix The 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.

Referenced by StartElement::namespaceUri().

const String& prefix ( const String namespaceUri  )  const

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

Parameters:
namespaceUri The 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 addNamespace ( const String elementName,
const 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:
elementName Associates this element name with the also given namespace (ns).
ns Associates this namespace with the also given element name (elementName).

void removeNamespace ( const String elementName  ) 

Parameters:
elementName The associates for this element name is removed.

Copyright © 2008 The Tntnet Development Team
Tntnet 1.6