|
XML for Java Compatibility API 2.0.13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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:
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
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 |
public java.lang.String getName()
public java.lang.String getNSLocalName()
public java.lang.String getNSName()
Parser.setProcessNamespace(boolean)
public java.lang.String getUniversalName()
getNSName()+":"+getNSLocalName()
; otherwise, return getNSLocalName()
.getNSName()
,
getNSLocalName()
,
Parser.setProcessNamespace(boolean)
public java.lang.String createExpandedName()
getNSName()+separator+getNSLocalName()
or getNSLocalName()
.
For attributes, returns getNSName()+separator+getNSLocalName()
or expanded name of an element + separator + getNSLocalNae()
.TXDocument.expandedNameSeparator
|
XML for Java Compatibility API 2.0.13 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |