Home > Support > Documentation

rtXmlNamespace.h File Reference

XML namespace handling structures and function definitions. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.


Classes

struct  OSXMLNamespace
struct  OSXMLNSPfxLink
struct  OSXMLNSPfxLinkStackNode
struct  OSXMLNSPfxLinkStack
struct  OSXMLNSURITable

Functions

OSXMLNamespacertXmlNSAddNamespace (OSCTXT *pctxt, OSRTDList *pNSAttrs, const OSUTF8CHAR *prefix, const OSUTF8CHAR *uri)
 This function adds a namespace to the context namespace list.
OSBOOL rtXmlNSEqual (OSXMLNamespace *pNS1, OSXMLNamespace *pNS2)
 This function checks if two namespace records are equal.
void rtXmlNSFreeAttrList (OSCTXT *pctxt, OSRTDList *pNSAttrs)
 This function frees dynamic memory used to hold namespace attribute values.
const OSUTF8CHAR * rtXmlNSGetPrefix (OSCTXT *pctxt, const OSUTF8CHAR *uri)
 This function gets the namespace prefix assigned to the given URI.
const OSUTF8CHAR * rtXmlNSGetQName (OSCTXT *pctxt, OSUTF8CHAR *buf, size_t bufsiz, const OSUTF8CHAR *uri, const OSUTF8CHAR *localName)
 This function creates a QName in the given fixed-site buffer.
const OSUTF8CHAR * rtXmlNSGetAttrQName (OSCTXT *pctxt, OSUTF8CHAR *buf, size_t bufsiz, OSXMLNamespace *pNS, const OSUTF8CHAR *localName, OSRTDList *pNSAttrs)
 This function creates a QName for a qualified attribute.
OSXMLNamespacertXmlNSLookupURI (OSCTXT *pctxt, const OSUTF8CHAR *uri)
 This function looks up a namespace in the context namespace stack using URI as the key value.
OSXMLNamespacertXmlNSLookupURIInList (OSRTDList *pNSAttrs, const OSUTF8CHAR *uri)
 This function looks up a namespace in the given list using URI as the key value.
OSXMLNamespacertXmlNSLookupPrefix (OSCTXT *pctxt, const OSUTF8CHAR *prefix)
 This function looks up a namespace in the context namespace list using the prefix as the key value.
void rtXmlNSRemoveAll (OSCTXT *pctxt)
 This function removes all namespaces from the context namespace list and frees the dynamic memory used to hold the names.
OSXMLNamespacertXmlNSSetNamespace (OSCTXT *pctxt, OSRTDList *pNSAttrs, const OSUTF8CHAR *prefix, const OSUTF8CHAR *uri, OSBOOL override)
 This function sets a namespace in the context namespace list.
const OSUTF8CHAR * rtXmlNSNewPrefix (OSCTXT *pctxt, const OSUTF8CHAR *uri, OSRTDList *pNSAttrs)
 This function returns the next unused prefix of the form "nsX" where X is a number.
int rtXmlNSAddPrefixLink (OSCTXT *pctxt, const OSUTF8CHAR *prefix, const OSUTF8CHAR *uri, const OSUTF8CHAR *nsTable[], OSUINT32 nsTableRowCount)
 Add a prefix link at the current stack level.
int rtXmlNSFreeAllPrefixLinks (OSCTXT *pctxt, OSXMLNSPfxLinkStackNode *pStackNode)
 Free all prefixs links in the given namespace stack entry.
int rtXmlNSFreePrefixLink (OSCTXT *pctxt, OSXMLNSPfxLink *plink)
 Free all data within a given namespace prefix link structure.
int rtXmlNSGetIndex (OSCTXT *pctxt, const OSUTF8CHAR *prefix)
 Get namespace index for a given namespace prefix based on current namespace stack in context.
int rtXmlNSPush (OSCTXT *pctxt)
 Push new namespace prefix mapping level onto stack.
int rtXmlNSPop (OSCTXT *pctxt)
 Remove top namespace prefix mapping level from stack.
void rtXmlNSSetURITable (OSCTXT *pctxt, const OSUTF8CHAR *data[], OSUINT32 nrows)
 Set namespace URI table in context.

Detailed Description

XML namespace handling structures and function definitions.

Definition in file rtXmlNamespace.h.


Function Documentation

OSXMLNamespace* rtXmlNSAddNamespace ( OSCTXT pctxt,
OSRTDList pNSAttrs,
const OSUTF8CHAR *  prefix,
const OSUTF8CHAR *  uri 
)

This function adds a namespace to the context namespace list.

Parameters:
pctxt Pointer to OSCTXT structure
pNSAttrs Namespace attribute list to which namespace info is to be added.
prefix Namespace prefix to be added
uri Namespace URI to be added
Returns:
Pointer to namespace structure or NULL if not added.

OSBOOL rtXmlNSEqual ( OSXMLNamespace pNS1,
OSXMLNamespace pNS2 
)

This function checks if two namespace records are equal.

This does a a deep compare in that it will first check if the pointers are equal and then it will check if the contents are equal (same prefix and URI).

Parameters:
pNS1 Pointer to first namespace records to check.
pNS2 Pointer to second record.
Returns:
True if records are equal, false otherwise.

void rtXmlNSFreeAttrList ( OSCTXT pctxt,
OSRTDList pNSAttrs 
)

This function frees dynamic memory used to hold namespace attribute values.

Parameters:
pctxt Pointer to OSCTXT structure
pNSAttrs Pointer to namespace attribute list to be freed.

const OSUTF8CHAR* rtXmlNSGetAttrQName ( OSCTXT pctxt,
OSUTF8CHAR *  buf,
size_t  bufsiz,
OSXMLNamespace pNS,
const OSUTF8CHAR *  localName,
OSRTDList pNSAttrs 
)

This function creates a QName for a qualified attribute.

If a prefix is not found for the name, a new namespace entry is created with a generated prefix.

Parameters:
pctxt Pointer to OSCTXT structure
buf Buffer into which qname will be written.
bufsiz Size of the buffer.
uri Namespace URI.
localName Local name of the item.
pNSAttrs List of namespace records.
Returns:
Pointer to QName buffer (buf).

const OSUTF8CHAR* rtXmlNSGetPrefix ( OSCTXT pctxt,
const OSUTF8CHAR *  uri 
)

This function gets the namespace prefix assigned to the given URI.

Parameters:
pctxt Pointer to OSCTXT structure
uri Namespace URI to be searched for
Returns:
Pointer to namespace prefix string

const OSUTF8CHAR* rtXmlNSGetQName ( OSCTXT pctxt,
OSUTF8CHAR *  buf,
size_t  bufsiz,
const OSUTF8CHAR *  uri,
const OSUTF8CHAR *  localName 
)

This function creates a QName in the given fixed-site buffer.

If the name will not fit in the buffer, it is truncated.

Parameters:
pctxt Pointer to OSCTXT structure
buf Buffer into which qname will be written.
bufsiz Size of the buffer.
uri Namespace URI.
localName Local name of the item.
Returns:
Pointer to QName buffer (buf).

OSXMLNamespace* rtXmlNSLookupPrefix ( OSCTXT pctxt,
const OSUTF8CHAR *  prefix 
)

This function looks up a namespace in the context namespace list using the prefix as the key value.

Parameters:
pctxt Pointer to OSCTXT structure
prefix Namespace Prefix to be found.
Returns:
Pointer to namespace structure or NULL if not found.

OSXMLNamespace* rtXmlNSLookupURI ( OSCTXT pctxt,
const OSUTF8CHAR *  uri 
)

This function looks up a namespace in the context namespace stack using URI as the key value.

Parameters:
pctxt Pointer to OSCTXT structure
uri Namespace URI to be found.
Returns:
Pointer to namespace structure or NULL if not found.

OSXMLNamespace* rtXmlNSLookupURIInList ( OSRTDList pNSAttrs,
const OSUTF8CHAR *  uri 
)

This function looks up a namespace in the given list using URI as the key value.

Parameters:
pNSAttrs List of namespace records.
uri Namespace URI to be found.
Returns:
Pointer to namespace structure or NULL if not found.

const OSUTF8CHAR* rtXmlNSNewPrefix ( OSCTXT pctxt,
const OSUTF8CHAR *  uri,
OSRTDList pNSAttrs 
)

This function returns the next unused prefix of the form "nsX" where X is a number.

The new namespace declaration is added to the context namespace list

Parameters:
pctxt Pointer to OSCTXT structure
uri Namespace URI
Returns:
New namespace prefix.

void rtXmlNSRemoveAll ( OSCTXT pctxt  ) 

This function removes all namespaces from the context namespace list and frees the dynamic memory used to hold the names.

Parameters:
pctxt Pointer to OSCTXT structure

OSXMLNamespace* rtXmlNSSetNamespace ( OSCTXT pctxt,
OSRTDList pNSAttrs,
const OSUTF8CHAR *  prefix,
const OSUTF8CHAR *  uri,
OSBOOL  override 
)

This function sets a namespace in the context namespace list.

If the given namespace URI does not exist in the list, the namespace is added. If the URI is found, the action depends on the value of the override flag. If true, the value of the namespace prefix will be changed to the given prefix. If false, the existing namespace specification is not altered.

Parameters:
pctxt Pointer to OSCTXT structure
pNSAttrs Namespace attribute list to which namespace info is to be added.
prefix Namespace prefix
uri Namespace URI
override Should existing definition be changed?
Returns:
Pointer to namespace structure or NULL if not set.