1 22 23 package org.xquark.util; 24 25 import org.xml.sax.*; 26 import org.xml.sax.helpers.AttributesImpl ; 27 28 36 public class NSPrefixFilter extends DecoratorFilter implements SAXConstants 37 { 38 private static final String RCSRevision = "$Revision: 1.2 $"; 39 private static final String RCSName = "$Name: $"; 40 41 private boolean prefixFeature = false; 42 private AttributesImpl attributes = null; 43 44 public final static String NS_PREFIX = "xmlns"; 45 public final static String XML_PREFIX = "xml"; 46 47 public NSPrefixFilter() 48 { 49 super(new NSPrefixDecorator()); 50 } 51 52 public NSPrefixFilter(XMLReader reader) 53 { 54 super(reader, new NSPrefixDecorator()); 55 } 56 57 public boolean getFeature(String name) 58 throws SAXNotRecognizedException, SAXNotSupportedException 59 { 60 if (name.equals(SAX_PREFIX_FEATURE)) 61 return ((NSPrefixDecorator)decorator).isEnabled(); 62 else if (getParent() != null) 64 return getParent().getFeature(name); 65 else 66 return false; 67 } 68 69 public void setFeature(String name,boolean value) 70 throws SAXNotRecognizedException, SAXNotSupportedException 71 { 72 if (name.equals(SAX_PREFIX_FEATURE)) 73 ((NSPrefixDecorator)decorator).setEnabled(value); 74 else if (getParent() != null) 75 getParent().setFeature(name, value); 76 } 77 } 78 | Popular Tags |