Contents | Package | Class | Tree | Deprecated | Index | Help | XML for Java 1.0.4 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
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:
xml
namespace
xml:namespace
This namespace can later be used in the document as:
<dsig:signature?>
In this context, the various components of the namespace are:
dsig
signature
dsig:signature
http://digitalSignatures.org/schema/
http://digitalSignatures.org/schema/:signature
Method Summary | |
java.lang.String | getName()
|
java.lang.String | getNSLocalName()
|
java.lang.String | getNSName()
|
java.lang.String | getUniversalName()
getNSName()+":"+getNSLocalName() ; otherwise, return getNSLocalName() .
|
void | setNSLocalName(java.lang.String nsLocalName)
|
void | setNSName(java.lang.String nsURI)
|
Method Detail |
public java.lang.String getName()
public java.lang.String getNSLocalName()
public void setNSLocalName(java.lang.String nsLocalName)
nsLocalName
- The Namespace local name.
public java.lang.String getNSName()
public void setNSName(java.lang.String nsURI)
nsURI
- The Namespace URI, or null if no name.
public java.lang.String getUniversalName()
getNSName()+":"+getNSLocalName()
; otherwise, return getNSLocalName()
.Contents | Package | Class | Tree | Deprecated | Index | Help | |||
PREV | NEXT | SHOW LISTS | HIDE LISTS |