[All Packages]  [Previous]  [Next]

Namespace APIs

Namespace APIs provide an interface that is an extension to the DOM and give information relating to the document namespaces.

XML namespaces provide a simple method for qualifying element and attribute names used in Extensible Markup Language documents by associating them with namespaces identified by URI references. A single XML document may contain elements and attributes (here referred to as a "markup vocabulary") that are defined for and used by multiple software modules. One motivation for this is modularity; if such a markup vocabulary exists which is well-understood and for which there is useful software available, it is better to re-use this markup rather than re-invent it.

Such documents, containing multiple markup vocabularies, pose problems of recognition and collision. Software modules need to be able to recognize the tags and attributes which they are designed to process, even in the face of "collisions" occurring when markup intended for some other software package uses the same element type or attribute name.

These considerations require that document constructs should have universal names, whose scope extends beyond their containing document. This C implementation of XML namespaces provides a mechanism to accomplish this.

Names from XML namespaces may appear as qualified names, which contain a single colon, separating the name into a namespace prefix and a local part. The prefix, which is mapped to a URI reference, selects a namespace. The combination of the universally managed URI namespace and the document's own namespace produces identifiers that are universally unique. Mechanisms are provided for prefix scoping and defaulting.

URI references can contain characters not allowed in names, so cannot be used directly as namespace prefixes. Therefore, the namespace prefix serves as a proxy for a URI reference. An attribute-based syntax described in the W3C Namespace specification is used to declare the association of the namespace prefix with a URI reference.

The implementation of this C Namespace interface followed the XML Namespace standard of revision REC-xml-names-19990114.


Data Structures and Types

 o ORATEXT
 o XMLATTR
 o XMLNODE

Functions

 o getAttrLocal(xmlattr *attrs)
Returns attribute local name.
 o getAttrNamespace(xmlattr *attr)
Returns attribute namespace (URI).
 o getAttrPrefix(xmlattr *attr)
Returns attribute prefix.
 o getAttrQualifiedName(xmlattr *attr)
Returns attribute fully qualified name.
 o getNodeLocal(xmlnode *node)
Returns node local name.
 o getNodeNamespace(xmlnode *node)
Returns node namespace (URI).
 o getNodePrefix(xmlnode *node)
Returns node prefix.
 o getNodeQualifiedName(xmlnode *node)
Returns node qualified name.

Data Structure and Type Description

 o ORATEXT
typedef unsigned char oratext;
 o XMLATTR
typedef struct xmlattr xmlattr;

Note: The contents of xmlattr are private and must not be accessed by users.

 o XMLNODE
typedef struct xmlnode xmlnode;

Note: The contents of xmlnode are private and must not be accessed by users.


Function Prototypes

 o getAttrLocal

PURPOSE

This function returns the local name of this attribute.

SYNTAX

 const oratext *getAttrLocal(const xmlattr *attr);

PARAMETERS

attr (IN) - pointer to opaque attribute structure (see getAttribute)

COMMENTS


 o getAttrNamespace

PURPOSE

This function returns namespace for this attribute.

SYNTAX

 const oratext *getAttrNamespace(const xmlattr *attr); 

PARAMETERS

attr (IN) - pointer to opaque attribute structure (see getAttribute)

COMMENTS


 o getAttrPrefix

PURPOSE

This function returns prefix for this attribute.

SYNTAX

 const oratext *getAttrPrefix(const xmlattr *attr); 

PARAMETERS

attr (IN) - pointer to opaque attribute structure (see getAttribute)

COMMENTS


 o getAttrQualifiedName

PURPOSE

This function returns fully qualified name for the attribute.

SYNTAX

 const oratext *getAttrQualifiedName(const xmlattr *attr); 

PARAMETERS

attr (IN) - pointer to opaque attribute structure (see getAttribute)

COMMENTS


 o getNodeLocal

PURPOSE

This function returns the local name of this node.

SYNTAX

 const oratext *getNodeLocal(const xmlnode *node);

PARAMETERS

node (IN) - node to get local name from

COMMENTS


 o getNodeNamespace

PURPOSE

This function returns namespace for this node.

SYNTAX

 const oratext *getNodeNamespace(const xmlnode *node); 

PARAMETERS

node (IN) - node to get namespace from

COMMENTS


 o getNodePrefix

PURPOSE

This function returns prefix for this node.

SYNTAX

 const oratext *getNodePrefix(const xmlnode *node); 

PARAMETERS

node (IN) - node to get prefix from

COMMENTS


 o getNodeQualifiedName

PURPOSE

This function returns fully qualified name for this node.

SYNTAX

 const oratext *getNodeQualifiedName(const xmlnode *node); 

PARAMETERS

node (IN) - node to get name from

COMMENTS