类org.xml.sax.Parser源码实例Demo

下面列出了怎么用org.xml.sax.Parser的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netbeans   文件: NbTheme.java
private void parseTheme(){
    try{
        SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setValidating(false);
        factory.setNamespaceAware(false);

        Parser p = new XMLReaderAdapter(factory.newSAXParser().getXMLReader());
        p.setDocumentHandler(this);
        String externalForm = themeURL.toExternalForm();
        InputSource is = new InputSource(externalForm);
        p.parse(is);
        activeThemes=null;  //dispose of now useless hashtable
        locator = null;
    }
    catch(java.io.IOException ie){
        System.err.println ("IO exception reading theme file"); //NOI18N
    } catch(org.xml.sax.SAXException se){
        System.err.println ("Error parsing theme file " + (locator != null ? "line " + locator.getLineNumber() : "")); //NOI18N
    } catch (ParserConfigurationException e) {
        System.err.println ("Couldn't create XML parser for theme file"); //NOI18N
    }
}
 
源代码2 项目: netbeans   文件: AnnotationTypeProcessor.java
private synchronized AnnotationType parse() {
      if (annotationType == null) {
          AnnotationType at = new AnnotationType();
          Handler h = new Handler(at);

          try {
Parser xp;
              SAXParserFactory factory = SAXParserFactory.newInstance ();
              factory.setValidating (false);
              factory.setNamespaceAware(false);
              xp = factory.newSAXParser ().getParser ();
              xp.setEntityResolver(h);
              xp.setDocumentHandler(h);
              xp.setErrorHandler(h);
              xp.parse(new InputSource(xmlDataObject.getInputStream()));
              at.putProp(AnnotationType.PROP_FILE, xmlDataObject);
              annotationType = at;
          } catch (Exception e) { 
              LOG.warning("Corrupted xmlDataObject " + xmlDataObject.getPath());
              Exceptions.printStackTrace(e);
          }

      }
      return annotationType;
  }
 
源代码3 项目: jdk1.8-source-analysis   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码4 项目: TencentKona-8   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码5 项目: jdk8u60   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码6 项目: JDKSourceCode1.8   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码7 项目: openjdk-jdk8u   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码9 项目: Bytecoder   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码10 项目: j2objc   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
@UnsupportedAppUsage
private void setup (Parser parser)
{
if (parser == null) {
    throw new
    NullPointerException("Parser argument must not be null");
}
this.parser = parser;
atts = new AttributesImpl();
nsSupport = new NamespaceSupport();
attAdapter = new AttributeListAdapter();
}
 
源代码11 项目: Java8CN   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码12 项目: openjdk-8-source   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码13 项目: openjdk-8   文件: ParserAdapter.java
/**
 * Internal setup method.
 *
 * @param parser The embedded parser.
 * @exception java.lang.NullPointerException If the parser parameter
 *            is null.
 */
private void setup (Parser parser)
{
    if (parser == null) {
        throw new
            NullPointerException("Parser argument must not be null");
    }
    this.parser = parser;
    atts = new AttributesImpl();
    nsSupport = new NamespaceSupport();
    attAdapter = new AttributeListAdapter();
}
 
源代码14 项目: jdk1.8-source-analysis   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码15 项目: jdk1.8-source-analysis   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码16 项目: TencentKona-8   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码17 项目: TencentKona-8   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码18 项目: jdk8u60   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码19 项目: jdk8u60   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码20 项目: JDKSourceCode1.8   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码21 项目: JDKSourceCode1.8   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码22 项目: openjdk-jdk8u   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码23 项目: j2objc   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码24 项目: openjdk-jdk8u-backup   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码25 项目: openjdk-jdk8u-backup   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码26 项目: Bytecoder   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码27 项目: Bytecoder   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码28 项目: openjdk-jdk9   文件: SAXParserImpl.java
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
 
源代码29 项目: openjdk-jdk9   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
源代码30 项目: Java8CN   文件: SAXParser.java
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}