NamespaceFilterpublic class NamespaceFilter extends XMLFilterImpl NamespaceFilter will take a namespace URI and replace
all occurences of that URI with a newer, supplied URI. This effectively
allows on-the-fly namespace changes.
|
Fields Summary |
---|
private String | oldURIThe old URI, to replace | private String | newURIThe new URI, to replace the old URI with |
Constructors Summary |
---|
public NamespaceFilter(XMLReader reader, String oldURI, String newURI)This will take the XMLReader to use as a parent,
as well as the URI to replace, and the URI to replace it with.
super(reader);
this.oldURI = oldURI;
this.newURI = newURI;
|
Methods Summary |
---|
public void | endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)
// Change URI, if needed
if (uri.equals(oldURI)) {
super.endElement(newURI, localName, qName);
} else {
super.endElement(uri, localName, qName);
}
| public void | startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
// Change URI, if needed
if (uri.equals(oldURI)) {
super.startElement(newURI, localName, qName, attributes);
} else {
super.startElement(uri, localName, qName, attributes);
}
| public void | startPrefixMapping(java.lang.String prefix, java.lang.String uri)
// Change URI, if needed
if (uri.equals(oldURI)) {
super.startPrefixMapping(prefix, newURI);
} else {
super.startPrefixMapping(prefix, uri);
}
|
|