XMLUri Class Reference

`#include <xercesc/util/XMLUri.hpp>`

Inheritance diagram for XMLUri:

## Public Member Functions

| XMLUri (const XMLCh *const uriSpec, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
| Construct a new URI from a URI specification string.
| XMLUri (const XMLUri *const baseURI, const XMLCh *const uriSpec, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
| Construct a new URI from a base URI and a URI specification string.
| XMLUri (const XMLUri &toCopy)
| Copy constructor.
XMLUri & | operator= (const XMLUri &toAssign)
virtual | ~XMLUri ()
const XMLCh * | getUriText () const
| Get the URI as a string specification.
const XMLCh * | getScheme () const
| Get the scheme for this URI.
const XMLCh * | getUserInfo () const
| Get the userinfo for this URI.
const XMLCh * | getHost () const
| Get the host for this URI.
int | getPort () const
| Get the port for this URI.
const XMLCh * | getRegBasedAuthority () const
| Get the registry based authority for this URI.
const XMLCh * | getPath () const
| Get the path for this URI.
const XMLCh * | getQueryString () const
| Get the query string for this URI.
const XMLCh * | getFragment () const
| Get the fragment for this URI.
void | setScheme (const XMLCh *const newScheme)
| Set the scheme for this URI.
void | setUserInfo (const XMLCh *const newUserInfo)
| Set the userinfo for this URI.
void | setHost (const XMLCh *const newHost)
| Set the host for this URI.
void | setPort (int newPort)
| Set the port for this URI.
void | setRegBasedAuthority (const XMLCh *const newRegAuth)
| Sets the registry based authority for this URI.
void | setPath (const XMLCh *const newPath)
| Set the path for this URI.
void | setQueryString (const XMLCh *const newQueryString)
| Set the query string for this URI.
void | setFragment (const XMLCh *const newFragment)
| Set the fragment for this URI.
| XMLUri (MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Public Member Functions inherited from XMemory
void * | operator new (size_t size)
| This method overrides operator new.
void * | operator new (size_t size, MemoryManager *memMgr)
| This method defines a custom operator new, that will use the provided memory manager to perform the allocation.
void * | operator new (size_t size, void *ptr)
| This method overrides placement operator new.
void | operator delete (void *p)
| This method overrides operator delete.
void | operator delete (void *p, MemoryManager *memMgr)
| This method provides a matching delete for the custom operator new.
void | operator delete (void *p, void *ptr)
| This method provides a matching delete for the placement new.

## Static Public Member Functions

static bool | isURIString (const XMLCh *const uric)
| Determine whether a given string contains only URI characters (also called "uric" in RFC 2396).
static bool | isValidURI (const XMLUri *const baseURI, const XMLCh *const uriStr, bool bAllowSpaces=false)
| Determine whether a given string is a valid URI.
static bool | isValidURI (bool haveBaseURI, const XMLCh *const uriStr, bool bAllowSpaces=false)
| Determine whether a given string is a valid URI.
static void | normalizeURI (const XMLCh *const systemURI, XMLBuffer &normalizedURI)

## Additional Inherited Members

Protected Member Functions inherited from XMemory
| XMemory ()
| Protected default constructor.

## Constructor & Destructor Documentation

## XMLUri() [1/4]

XMLUri::XMLUri | ( | const XMLCh *const | uriSpec,
|  | MemoryManager *const | manager = XMLPlatformUtils::fgMemoryManager )

Construct a new URI from a URI specification string.

If the specification follows the "generic URI" syntax, (two slashes following the first colon), the specification will be parsed accordingly - setting the scheme, userinfo, host, port, path, querystring and fragment fields as necessary.

If the specification does not follow the "generic URI" syntax, the specification is parsed into a scheme and scheme-specific part (stored as the path) only.

Parameters

  uriSpec | the URI specification string (cannot be null or empty)
  manager | Pointer to the memory manager to be used to allocate objects.

ctor# 2

## XMLUri() [2/4]

XMLUri::XMLUri | ( | const XMLUri *const | baseURI,
|  | const XMLCh *const | uriSpec,
|  | MemoryManager *const | manager = XMLPlatformUtils::fgMemoryManager )

Construct a new URI from a base URI and a URI specification string.

The URI specification string may be a relative URI.

Parameters

  baseURI | the base URI (cannot be null if uriSpec is null or empty)
  uriSpec | the URI specification string (cannot be null or empty if base is null)
  manager | Pointer to the memory manager to be used to allocate objects.

ctor# 7 relative ctor

## XMLUri() [3/4]

XMLUri::XMLUri | ( | const XMLUri & | toCopy | ) |

Copy constructor.

## ~XMLUri()

virtual XMLUri::~XMLUri | ( |  | ) |

virtual

## XMLUri() [4/4]

XMLUri::XMLUri | ( | MemoryManager *const | manager = XMLPlatformUtils::fgMemoryManager | ) |

## Member Function Documentation

## getFragment()

const XMLCh * XMLUri::getFragment | ( |  | ) | const

Get the fragment for this URI.

Returns
  the fragment for this URI. Null is returned if there was no "#" in the URI spec, empty string if there was a "#" but no fragment following it.

## getHost()

const XMLCh * XMLUri::getHost | ( |  | ) | const

Get the host for this URI.

Returns
  the host for this URI (null if not specified).

## getPath()

const XMLCh * XMLUri::getPath | ( |  | ) | const

Get the path for this URI.

Note that the value returned is the path only and does not include the query string or fragment.

Returns
  the path for this URI.

## getPort()

int XMLUri::getPort | ( |  | ) | const

Get the port for this URI.

Returns
  the port for this URI (-1 if not specified).

## getQueryString()

const XMLCh * XMLUri::getQueryString | ( |  | ) | const

Get the query string for this URI.

Returns
  the query string for this URI. Null is returned if there was no "?" in the URI spec, empty string if there was a "?" but no query string following it.

## getRegBasedAuthority()

const XMLCh * XMLUri::getRegBasedAuthority | ( |  | ) | const

Get the registry based authority for this URI.

Returns
  the registry based authority (null if not specified).

## getScheme()

const XMLCh * XMLUri::getScheme | ( |  | ) | const

Get the scheme for this URI.

Returns
  the scheme for this URI

## getUriText()

const XMLCh * XMLUri::getUriText | ( |  | ) | const

Get the URI as a string specification.

See RFC 2396 Section 5.2.

Returns
  the URI string specification

## getUserInfo()

const XMLCh * XMLUri::getUserInfo | ( |  | ) | const

Get the userinfo for this URI.

Returns
  the userinfo for this URI (null if not specified).

## isURIString()

static bool XMLUri::isURIString | ( | const XMLCh *const | uric | ) |

static

Determine whether a given string contains only URI characters (also called "uric" in RFC 2396).

uric consist of all reserved characters, unreserved characters and escaped characters.

Returns
  true if the string is comprised of uric, false otherwise

## isValidURI() [1/2]

static bool XMLUri::isValidURI | ( | bool | haveBaseURI,
|  | const XMLCh *const | uriStr,
|  | bool | bAllowSpaces = false )

static

Determine whether a given string is a valid URI.

## isValidURI() [2/2]

static bool XMLUri::isValidURI | ( | const XMLUri *const | baseURI,
|  | const XMLCh *const | uriStr,
|  | bool | bAllowSpaces = false )

static

Determine whether a given string is a valid URI.

## normalizeURI()

static void XMLUri::normalizeURI | ( | const XMLCh *const | systemURI,
|  | XMLBuffer & | normalizedURI )

static

## operator=()

XMLUri & XMLUri::operator= | ( | const XMLUri & | toAssign | ) |

## setFragment()

void XMLUri::setFragment | ( | const XMLCh *const | newFragment | ) |

Set the fragment for this URI.

A non-null value is valid only if this is a URI conforming to the generic URI syntax and the path value is not null.

Parameters

  newFragment | the fragment for this URI

## setHost()

void XMLUri::setHost | ( | const XMLCh *const | newHost | ) |

Set the host for this URI.

If null is passed in, the userinfo field is also set to null and the port is set to -1.

Note: This method overwrites registry based authority if it previously existed in this URI.

Parameters

  newHost | the host for this URI

## setPath()

void XMLUri::setPath | ( | const XMLCh *const | newPath | ) |

Set the path for this URI.

If the supplied path is null, then the query string and fragment are set to null as well.

If the supplied path includes a query string and/or fragment, these fields will be parsed and set as well.

Note:

For URIs following the "generic URI" syntax, the path specified should start with a slash.

For URIs that do not follow the generic URI syntax, this method sets the scheme-specific part.

Parameters

  newPath | the path for this URI (may be null)

## setPort()

void XMLUri::setPort | ( | int | newPort | ) |

Set the port for this URI.

-1 is used to indicate that the port is not specified, otherwise valid port numbers are between 0 and 65535. If a valid port number is passed in and the host field is null, an exception is thrown.

Parameters

  newPort | the port number for this URI

## setQueryString()

void XMLUri::setQueryString | ( | const XMLCh *const | newQueryString | ) |

Set the query string for this URI.

A non-null value is valid only if this is an URI conforming to the generic URI syntax and the path value is not null.

Parameters

  newQueryString | the query string for this URI

## setRegBasedAuthority()

void XMLUri::setRegBasedAuthority | ( | const XMLCh *const | newRegAuth | ) |

Sets the registry based authority for this URI.

Note: This method overwrites server based authority if it previously existed in this URI.

Parameters

  newRegAuth | the registry based authority for this URI

## setScheme()

void XMLUri::setScheme | ( | const XMLCh *const | newScheme | ) |

Set the scheme for this URI.

The scheme is converted to lowercase before it is set.

Parameters

  newScheme | the scheme for this URI (cannot be null)

## setUserInfo()

void XMLUri::setUserInfo | ( | const XMLCh *const | newUserInfo | ) |

Set the userinfo for this URI.

If a non-null value is passed in and the host value is null, then an exception is thrown.

Parameters

  newUserInfo | the userinfo for this URI

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

- XMLUri.hpp