cpp-ElementTree
Python ElementTree-alike XML API for C++
Public Member Functions | List of all members
etree::QName Class Reference

Canonical representation for a name-namespace pair, without namespace prefix, in James Clark's Universal Names notation. More...

#include <element.hpp>

Public Member Functions

 QName (const string &ns, const string &tag)
 Create a QName from a namespace-tag pair. More...
 
 QName (const QName &other)
 Copy a QName. More...
 
 QName (const string &qname)
 Create a QName from Universal Name notation. More...
 
 QName (const char *qname)
 Create a QName from Universal Name notation. More...
 
bool equals (const char *ns, const char *tag) const
 Return true if the (raw) strings match the QName's content. More...
 
const string & ns () const
 Return the namespace URI part of the QName.
 
bool operator!= (const QName &other) const
 Compare this QName to another. More...
 
bool operator== (const QName &other) const
 Compare this QName to another. More...
 
const string & tag () const
 Return the tag part of the QName.
 
string tostring () const
 Serialize a QName in Universal Name notation. More...
 

Detailed Description

Canonical representation for a name-namespace pair, without namespace prefix, in James Clark's Universal Names notation.

A QName is essentially a canonical string in the form: {http://namespace.uri/}tag-name

Constructor & Destructor Documentation

etree::QName::QName ( const string &  ns,
const string &  tag 
)

Create a QName from a namespace-tag pair.

Parameters
nsNamespace.
tagTag.
etree::QName::QName ( const QName other)

Copy a QName.

Parameters
otherQName to copy.
etree::QName::QName ( const string &  qname)

Create a QName from Universal Name notation.

Parameters
qnameUniversal name.
etree::QName::QName ( const char *  qname)

Create a QName from Universal Name notation.

Parameters
qnameUniversal name.

Member Function Documentation

bool etree::QName::equals ( const char *  ns,
const char *  tag 
) const

Return true if the (raw) strings match the QName's content.

Parameters
nsNULL, or the namespace URI.
tagThe tag.
bool etree::QName::operator!= ( const QName other) const

Compare this QName to another.

Parameters
otherOther QName.
Returns
False if equal.
bool etree::QName::operator== ( const QName other) const

Compare this QName to another.

Parameters
otherOther QName.
Returns
True if equal.
string etree::QName::tostring ( ) const

Serialize a QName in Universal Name notation.

Returns
QName in Universal Name notation.

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