public class NamespaceHomonymResolver extends ContentProxy
ContentHandler which propagates all SAX events
but changes "start prefix mapping" and the corresponding
"end prefix mapping" iff HOMONMYS (=re-uses of prefices) are detected.
ASSUME that all SAX events passing through are in "namespace mode";
ie. get their identity from "localName" and "uri", NOT using qname/prefix!
The qname field is NOT adapted according to the calculated re-mapping
and must be ignored in all subsequent processing steps.
ASSUME that no prefix is re-used on THE SAME level of element nesting!
Because in this case the sequential order of the corresponding
"end prefix mapping" commands cannot be established.| Modifier and Type | Class and Description |
|---|---|
protected class |
NamespaceHomonymResolver.Level |
| Modifier and Type | Field and Description |
|---|---|
protected Map<String,NamespaceHomonymResolver.Level> |
current |
protected Set<String> |
currentPrefices |
static String |
SUFFIX_SEPARATOR |
out| Constructor and Description |
|---|
NamespaceHomonymResolver(ContentHandler out)
Create a SAX receiver which replaces all name space prefix mappings
so that no nested homonyms occur.
|
| Modifier and Type | Method and Description |
|---|---|
void |
endPrefixMapping(String prefix) |
protected String |
makeUnique(String s) |
void |
startPrefixMapping(String prefix,
String uri) |
characters, endDocument, endElement, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElementpublic static final String SUFFIX_SEPARATOR
protected final Map<String,NamespaceHomonymResolver.Level> current
public NamespaceHomonymResolver(ContentHandler out)
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class ContentProxySAXExceptionpublic void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class ContentProxySAXExceptionsee also the complete user documentation .