Contents | Package | Class | Tree | Deprecated | Index | Help XML for Java 1.0.4
PREV | NEXT SHOW LISTS | HIDE LISTS

Interface com.ibm.xml.parser.Namespace

Implementing Classes:
TXPI, TXElement, TXAttribute

public 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.3 src/com/ibm/xml/parser/Namespace.java, xml4jsrc, xml4j-jtcsv, xml4j_1_0_4
See Also:
setProcessNamespace, TXElement, TXAttribute, TXPI

Method Summary
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()
If namespace support is enabled and the tag name contains a prefix name, return a string of getNSName()+":"+getNSLocalName(); otherwise, return getNSLocalName() .
void  setNSLocalName(java.lang.String nsLocalName)
Sets the local name of the Namespace.
void  setNSName(java.lang.String nsURI)
Sets the Namespace URI.
 

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.
See Also:
setNSLocalName

setNSLocalName

public void setNSLocalName(java.lang.String nsLocalName)
Sets the local name of the Namespace.
Parameters:
nsLocalName - The Namespace local name.
See Also:
getNSLocalName

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:
setNSName, setProcessNamespace

setNSName

public void setNSName(java.lang.String nsURI)
Sets the Namespace URI.
Parameters:
nsURI - The Namespace URI, or null if no name.
See Also:
getNSName

getUniversalName

public java.lang.String getUniversalName()
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, setProcessNamespace

Contents | Package | Class | Tree | Deprecated | Index | Help
PREV | NEXT SHOW LISTS | HIDE LISTS