Warning: This is a facade provided for use by user code, not for implementation by user code. User implementations of this interface are highly likely to be incompatible with future releases of the product at both binary and source levels.
This class is intended to be used within a SAX {@link org.xml.sax.ContentHandler} and relies on the order that theprefix mapping and element events are received in SAX. i.e. startPrefixMapping events are received before the associated startElement
event and the endPrefixMapping
events are received after the associated endElement
event.
Most elements will not have any prefix mappings at all so implementations of this should be able to handle that efficiently both in terms of time and performance.
The methods are intended to be used as follows.
startElement
startElement
method. endElement
endElement
method.startPrefixMapping
startPrefixMapping
method.endPrefixMapping
endPrefixMapping
method.If a {@link QName} has an empty prefix then the mapping of the prefix tonamespace URI is dependent on what the {@link QName} is used for. If it isan element then it maps to the default namespace, if it is an attribute then it defaults to the empty namespace and if it is something else such as an XPath function name then it maps to the default function namespace.
SAX specifically states that startPrefixMapping
and endPrefixMapping
events cannot be relied upon to be properly nested with respect to each other. The only thing that can be relied upon is that all the startPrefixMapping
events are received before the corresponding startElement
event and the endPrefixMapping
events are received after the corresponding endElement
event.
The events are only properly nested with respect to each other if the endPrefixMapping
events are received in the reverse order to the order that the startPrefixMapping
} events were received in.
<E xmlns:A="ALPHA" xmlns:B="BETA" xmlns:C="GAMMA"> ... </E>
Given the previous markup the first list shows one possible sequence of properly nested events and the second list shows one possible sequence of badly nested events.
startPrefixMapping(A, ALPHA)
startPrefixMapping(B, BETA)
startPrefixMapping(C, GAMMA)
startElement(E)
endElement(E)
endPrefixMapping(C)
endPrefixMapping(B)
endPrefixMapping(A)
startPrefixMapping(A, ALPHA)
startPrefixMapping(B, BETA)
startPrefixMapping(C, GAMMA)
startElement(E)
endElement(E)
endPrefixMapping(A)
endPrefixMapping(B)
endPrefixMapping(C)
If the events are not received in properly nested order then the mappings held by this object may be incorrect during the processing of endPrefixMapping
events. The mappings will be correct once all the endPrefixMapping
events for an element have been received.
|
|
|
|
|
|
|
|
|
|
|
|