HydraExpress™ C++ API Reference Guide

 
Loading...
Searching...
No Matches
rwsf::XmlNamespace Class Reference

Represents an XML namespace, containing a prefix and a URI as instances of std::string. More...

#include <rwsf/core/XmlNamespace.h>

Public Member Functions

 XmlNamespace ()
 XmlNamespace (const std::string &prefix, const std::string &URI)
 XmlNamespace (const XmlNamespace &copy)
int compareTo (const XmlNamespace &other) const
bool empty () const
const std::string & getPrefix () const
const std::string & getURI () const
bool isNull () const
XmlNamespaceoperator= (const XmlNamespace &copy)
void setPrefix (const std::string &pfx)
void setURI (const std::string &uri)

Static Public Member Functions

static const XmlNamespacegetEmptyNamespace ()
static const XmlNamespacegetXmlns ()
static const XmlNamespacegetXsd ()
static const XmlNamespacegetXsi ()

(Note that these are not member symbols.)

bool operator!= (const XmlNamespace &lhs, const XmlNamespace &rhs)
bool operator< (const XmlNamespace &lhs, const XmlNamespace &rhs)
bool operator== (const XmlNamespace &lhs, const XmlNamespace &rhs)

Detailed Description

Class rwsf::XmlNamespace encapsulates an XML namespace declaration. The class holds the prefix (namespace prefix) and the URI (namespace name) as instances of std::string.

For example, an rwsf::XmlNamespace object containing the prefix string "rw" and the URI string "http://xml.roguewave.com/" represents a namespace declaration serializable as xmlns:rw="http://xml.roguewave.com/".

rwsf::XmlNamespace treats the prefix as an arbitrary placeholder for the URI. Two namespaces with identical URI strings compare equal even if the namespaces have different prefixes.

The class also contains static convenience functions that return namespaces commonly used in XML documents. Each method is named according to the prefix conventionally used for the namespace that the method returns. The namespaces returned match namespaces in the 24 Oct 2000 draft of the W3C XML Schema recommendation and the SOAP 1.1 specification.

Note
The URIs returned by this class match specific versions of the SOAP and XML Schema recommendations. Previous and subsequent versions of the specifications contain different URIs.

Constructor & Destructor Documentation

◆ XmlNamespace() [1/3]

rwsf::XmlNamespace::XmlNamespace ( )

Constructs an XmlNamespace as an empty namespace (URI and prefix are blank).

◆ XmlNamespace() [2/3]

rwsf::XmlNamespace::XmlNamespace ( const std::string & prefix,
const std::string & URI )

Constructs an XmlNamespace representing the namespace URI with the prefix prefix.

◆ XmlNamespace() [3/3]

rwsf::XmlNamespace::XmlNamespace ( const XmlNamespace & copy)

Constructs a deep copy of copy.

Member Function Documentation

◆ compareTo()

int rwsf::XmlNamespace::compareTo ( const XmlNamespace & other) const

Returns the results of comparing self's URI string to the URI string of other, using std::string::compare().

◆ empty()

bool rwsf::XmlNamespace::empty ( ) const

Returns true if this object is null (i.e., has a blank URI and prefix).

◆ getEmptyNamespace()

const XmlNamespace & rwsf::XmlNamespace::getEmptyNamespace ( )
static

Returns a namespace that has no prefix and no URI.

◆ getPrefix()

const std::string & rwsf::XmlNamespace::getPrefix ( ) const

Returns the prefix for this namespace.

◆ getURI()

const std::string & rwsf::XmlNamespace::getURI ( ) const

Returns the URI for this namespace.

◆ getXmlns()

const XmlNamespace & rwsf::XmlNamespace::getXmlns ( )
static

Returns a namespace with the prefix "xmlns" and the URI "", as specified by the W3C.

◆ getXsd()

const XmlNamespace & rwsf::XmlNamespace::getXsd ( )
static

Returns a namespace equivalent to the xsd namespace, defined by the W3C as the prefix xsd mapped to the URI http://www.w3.org/2001/XMLSchema.

◆ getXsi()

const XmlNamespace & rwsf::XmlNamespace::getXsi ( )
static

Returns a namespace equivalent to the xsi namespace, defined by the W3C as the prefix xsi mapped to the URI http://www.w3.org/2000/10/XMLSchema-instance/.

◆ isNull()

bool rwsf::XmlNamespace::isNull ( ) const

Returns true if this object is null (i.e., has a blank URI and prefix).

◆ operator=()

XmlNamespace & rwsf::XmlNamespace::operator= ( const XmlNamespace & copy)

Assignment operator. Makes self a deep copy of copy.

◆ setPrefix()

void rwsf::XmlNamespace::setPrefix ( const std::string & pfx)

Sets the prefix of this namespace to pfx.

◆ setURI()

void rwsf::XmlNamespace::setURI ( const std::string & uri)

Sets the URI of this namespace to uri.

◆ operator!=()

bool operator!= ( const XmlNamespace & lhs,
const XmlNamespace & rhs )
related

Returns false if lhs and rhs have identical URI strings as determined by a string comparison.

◆ operator<()

bool operator< ( const XmlNamespace & lhs,
const XmlNamespace & rhs )
related

Returns true if the URI string contained in lhs is less than the URI string contained in rhs, as determined by operator< for std::string.

◆ operator==()

bool operator== ( const XmlNamespace & lhs,
const XmlNamespace & rhs )
related

Returns true if lhs and rhs have identical URI strings as determined by a string comparison.

Copyright © 2026 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.