XML Parser for Java 1.1.9

com.ibm.xml.parser
Interface Namespace

All Known Implementing Classes:
TXElement, TXAttribute

public abstract interface Namespace

An interface for providing consistent namespace handling within the XML4J parser; this interface is not intended for implementation by XML4J applications. Refer to the TXElement, TXAttribute, and TXPI classes for sample implementations of this interface.

The XML4J parser does not by default enable namespace processing. In order to enable namespace processing invoke Parser#setProcessNamespace(true). Once the namespace specification moves forward in the W3C, namespace processing will be enabled by default.

Applications of Extensible Markup Language [XML] contain markup defined in multiple schemas, which may have been authored independently. One motivation for this is that writing good schemas is hard, so it is beneficial to re-use parts from existing, well-designed schemas. Another is the advantage of allowing search engines or other tools to operate over a range of documents that vary in many respects but use common names for common element types.

These considerations require that document constructs should have universal names, whose scope extends beyond their containing document. XML namespaces, accomplishes this.

XML namespaces are based on the use of qualified names, which contain a single colon, separating the name into a namespace prefix and the local name. The prefix, which is mapped to a URI, selects a namespace. The combination of the universally-managed URI namespace and the local schema namespace produces names that are guaranteed universally unique.

For example, in the namespace declaration:

<?xml:namespace ns="http://digitalSignatures.org/schema/" prefix="dsig" ?>

 

..the various components of the namespace are:

Prefix name
xml
Local name
namespace
Qualified name
xml:namespace

This namespace can later be used in the document as:

 
 <dsig:signature?>

 

In this context, the various components of the namespace are:

Prefix name
dsig
Local name
signature
Qualified name
dsig:signature
Namespace name or URI
http://digitalSignatures.org/schema/
Universal name
http://digitalSignatures.org/schema/:signature

Version:
Revision: 12 1.4 src/com/ibm/xml/parser/Namespace.java, xml4jsrc, xml4j-jtcsv, xml4j_1_1_9
See Also:
Parser.setProcessNamespace(boolean), TXElement, TXAttribute, TXPI

Method Summary
 java.lang.String createExpandedName()
          Return an expanded name for this element or attribute.
 java.lang.String getName()
          Returns the qualified name of the tag.
 java.lang.String getNSLocalName()
          Returns the local name of the Namespace.
 java.lang.String getNSName()
          Returns the Namespace URI.
 java.lang.String getUniversalName()
          Deprecated. See createExpandedName()
 

Method Detail

getName

public java.lang.String getName()
Returns the qualified name of the tag.
Returns:
The first token following the markup, or "" if no name.

getNSLocalName

public java.lang.String getNSLocalName()
Returns the local name of the Namespace.
Returns:
The Namespace local name, or null if no local name.

getNSName

public java.lang.String getNSName()
Returns the Namespace URI.
Returns:
The Namespace URI, or null if the tag name does not contain a prefix name or XML4J parser namespace processing is disabled.
See Also:
Parser.setProcessNamespace(boolean)

getUniversalName

public java.lang.String getUniversalName()
Deprecated. See createExpandedName()
If namespace support is enabled and the tag name contains a prefix name, return a string of getNSName()+":"+getNSLocalName(); otherwise, return getNSLocalName() .
Returns:
The universal name, or null if the tag name does not contain a prefix name or XML4J parser namespace processing is disabled.
See Also:
getNSName(), getNSLocalName(), Parser.setProcessNamespace(boolean)

createExpandedName

public java.lang.String createExpandedName()
Return an expanded name for this element or attribute. For elements, returns getNSName()+separator+getNSLocalName() or getNSLocalName(). For attributes, returns getNSName()+separator+getNSLocalName() or expanded name of an element + separator + getNSLocalNae().
See Also:
TXDocument.expandedNameSeparator

XML Parser for Java 1.1.9