< prev index next >

src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/ContentHandlerNamespacePrefixAdapter.java

Print this page




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.internal.xjc.reader.internalizer;
  27 
  28 import javax.xml.XMLConstants;
  29 
  30 import org.xml.sax.Attributes;
  31 import org.xml.sax.SAXException;
  32 import org.xml.sax.SAXNotRecognizedException;
  33 import org.xml.sax.SAXNotSupportedException;
  34 import org.xml.sax.XMLReader;
  35 import org.xml.sax.helpers.AttributesImpl;
  36 import org.xml.sax.helpers.XMLFilterImpl;
  37 
  38 /**
  39  * {@link XMLReader} filter for supporting
  40  * <tt>http://xml.org/sax/features/namespace-prefixes</tt> feature.
  41  *
  42  * @author Kohsuke Kawaguchi
  43  */
  44 final class ContentHandlerNamespacePrefixAdapter extends XMLFilterImpl {
  45     /**
  46      * True if <tt>http://xml.org/sax/features/namespace-prefixes</tt> is set to true.
  47      */
  48     private boolean namespacePrefixes = false;
  49 
  50     private String[] nsBinding = new String[8];
  51     private int len;
  52 
  53     public ContentHandlerNamespacePrefixAdapter() {
  54     }
  55 
  56     public ContentHandlerNamespacePrefixAdapter(XMLReader parent) {
  57         setParent(parent);
  58     }
  59 
  60     @Override
  61     public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
  62         if(name.equals(PREFIX_FEATURE))
  63             return namespacePrefixes;
  64         return super.getFeature(name);
  65     }
  66 




  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.tools.internal.xjc.reader.internalizer;
  27 
  28 import javax.xml.XMLConstants;
  29 
  30 import org.xml.sax.Attributes;
  31 import org.xml.sax.SAXException;
  32 import org.xml.sax.SAXNotRecognizedException;
  33 import org.xml.sax.SAXNotSupportedException;
  34 import org.xml.sax.XMLReader;
  35 import org.xml.sax.helpers.AttributesImpl;
  36 import org.xml.sax.helpers.XMLFilterImpl;
  37 
  38 /**
  39  * {@link XMLReader} filter for supporting
  40  * {@code http://xml.org/sax/features/namespace-prefixes} feature.
  41  *
  42  * @author Kohsuke Kawaguchi
  43  */
  44 final class ContentHandlerNamespacePrefixAdapter extends XMLFilterImpl {
  45     /**
  46      * True if {@code http://xml.org/sax/features/namespace-prefixes} is set to true.
  47      */
  48     private boolean namespacePrefixes = false;
  49 
  50     private String[] nsBinding = new String[8];
  51     private int len;
  52 
  53     public ContentHandlerNamespacePrefixAdapter() {
  54     }
  55 
  56     public ContentHandlerNamespacePrefixAdapter(XMLReader parent) {
  57         setParent(parent);
  58     }
  59 
  60     @Override
  61     public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
  62         if(name.equals(PREFIX_FEATURE))
  63             return namespacePrefixes;
  64         return super.getFeature(name);
  65     }
  66 


< prev index next >