1 16 package org.apache.cocoon.xml; 17 18 import org.xml.sax.Attributes ; 19 import org.xml.sax.SAXException ; 20 21 36 public class RedundantNamespacesFilter extends AbstractXMLPipe { 37 38 39 private NamespacesTable ns = new NamespacesTable(); 40 41 45 public RedundantNamespacesFilter() { 46 } 48 49 55 public RedundantNamespacesFilter(XMLConsumer consumer) { 56 setConsumer(consumer); 57 } 58 59 public void startPrefixMapping(String prefix, String uri) throws SAXException { 60 ns.addDeclaration(prefix, uri); 62 } 63 64 public void startElement(String uri, String loc, String raw, Attributes a) throws SAXException { 65 ns.enterScope(this.contentHandler); 67 super.startElement(uri, loc, raw, a); 68 } 69 70 public void endElement(String uri, String loc, String raw) throws SAXException { 71 super.endElement(uri, loc, raw); 72 ns.leaveScope(this.contentHandler); 73 } 74 75 public void endPrefixMapping(String prefix) throws SAXException { 76 ns.removeDeclaration(prefix); 77 } 78 } 79 | Popular Tags |