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

项目:incubator-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
    }
}
项目:incubator-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;
  }
项目:OpenJSharp    文件: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();
}
项目:openjdk-jdk10    文件: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();
}
项目:openjdk9    文件: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();
}
项目: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();
}
项目:lookaside_java-1.8.0-openjdk    文件: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();
}
项目:javify    文件:SAXParser.java   
/**
 * Parse the specified input source, reporting SAX1 events to the
 * given handler.
 * Prefer the SAX2 version of this method, since the HandlerBase class is
 * now deprecated.
 * @param is the SAX input source
 * @param hb the SAX1 handler
 * @exception IllegalArgumentException if the input source is null
 * @see #parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
 */
public void parse(InputSource is, HandlerBase hb)
  throws SAXException, IOException
{
  if (is == null)
    {
      throw new IllegalArgumentException("input source is null");
    }
  Parser parser = getParser();
  parser.setDocumentHandler(hb);
  parser.setDTDHandler(hb);
  parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.parse(is);
}
项目:javify    文件: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();
   }
项目:jvm-stm    文件:SAXParser.java   
/**
 * Parse the specified input source, reporting SAX1 events to the
 * given handler.
 * Prefer the SAX2 version of this method, since the HandlerBase class is
 * now deprecated.
 * @param is the SAX input source
 * @param hb the SAX1 handler
 * @exception IllegalArgumentException if the input source is null
 * @see #parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
 */
public void parse(InputSource is, HandlerBase hb) 
  throws SAXException, IOException
{
  if (is == null)
    {
      throw new IllegalArgumentException("input source is null");
    }
  Parser parser = getParser();
  parser.setDocumentHandler(hb);
  parser.setDTDHandler(hb);
  parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.parse(is);
}
项目:jvm-stm    文件: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();
   }
项目:j2objc    文件: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();
}
项目:infobip-open-jdk-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();
}
项目:In-the-Box-Fork    文件: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();
}
项目:In-the-Box-Fork    文件:SAXParserTest.java   
@TestTargetNew(
    level = TestLevel.COMPLETE,
    method = "getParser",
    args = { }
)
public void testGetParser() {
    spf = SAXParserFactory.newInstance();
    try {
        Parser parser = spf.newSAXParser().getParser();
        assertNotNull(parser);
    } catch (Exception e) {
        throw new RuntimeException("Unexpected exception", e);
    }
}
项目:OLD-OpenJDK8    文件: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();
}
项目:JamVM-PH    文件:SAXParser.java   
/**
 * Parse the specified input source, reporting SAX1 events to the
 * given handler.
 * Prefer the SAX2 version of this method, since the HandlerBase class is
 * now deprecated.
 * @param is the SAX input source
 * @param hb the SAX1 handler
 * @exception IllegalArgumentException if the input source is null
 * @see #parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
 */
public void parse(InputSource is, HandlerBase hb) 
  throws SAXException, IOException
{
  if (is == null)
    {
      throw new IllegalArgumentException("input source is null");
    }
  Parser parser = getParser();
  parser.setDocumentHandler(hb);
  parser.setDTDHandler(hb);
  parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.parse(is);
}
项目:JamVM-PH    文件: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();
   }
项目:classpath    文件:SAXParser.java   
/**
 * Parse the specified input source, reporting SAX1 events to the
 * given handler.
 * Prefer the SAX2 version of this method, since the HandlerBase class is
 * now deprecated.
 * @param is the SAX input source
 * @param hb the SAX1 handler
 * @exception IllegalArgumentException if the input source is null
 * @see #parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
 */
public void parse(InputSource is, HandlerBase hb)
  throws SAXException, IOException
{
  if (is == null)
    {
      throw new IllegalArgumentException("input source is null");
    }
  Parser parser = getParser();
  parser.setDocumentHandler(hb);
  parser.setDTDHandler(hb);
  parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.parse(is);
}
项目:classpath    文件: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();
   }
项目:openjdk-icedtea7    文件: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();
}
项目:OpenJSharp    文件:SAXParserImpl.java   
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
项目:OpenJSharp    文件: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);
}
项目:openjdk-jdk10    文件:SAXParserImpl.java   
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
项目:openjdk-jdk10    文件: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);
}
项目:openjdk9    文件:SAXParserImpl.java   
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
项目:openjdk9    文件: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);
}
项目: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);
}
项目:lookaside_java-1.8.0-openjdk    文件:SAXParserImpl.java   
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
项目:lookaside_java-1.8.0-openjdk    文件: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);
}
项目:javify    文件:SAXParser.java   
public Parser getParser()
  throws SAXException
{
  return null;
}
项目:javify    文件:GnomeSAXParser.java   
public Parser getParser ()
  throws SAXException
{
  throw new SAXNotSupportedException ("SAX version 1 not supported");
}
项目:sqlpower-library    文件:UnescapingSaxParser.java   
/**
 * Delegates to the wrapped SAXParser's implementation of the method.
 */
public Parser getParser() throws SAXException {
    return parser.getParser();
}
项目:sqlpower-library    文件:StubSAXParser.java   
@Override
public Parser getParser() throws SAXException {
    return null;
}
项目:jvm-stm    文件:SAXParser.java   
public Parser getParser()
  throws SAXException
{
  return null;
}
项目:jvm-stm    文件:GnomeSAXParser.java   
public Parser getParser ()
  throws SAXException
{
  throw new SAXNotSupportedException ("SAX version 1 not supported");
}
项目: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);
}
项目:iText-GUI    文件:SaxParser.java   
@Override
public Parser getParser() throws SAXException {
   throw new UnsupportedOperationException("Not supported yet.");
}
项目:infobip-open-jdk-8    文件:SAXParserImpl.java   
public Parser getParser() throws SAXException {
    // Xerces2 AbstractSAXParser implements SAX1 Parser
    // assert(xmlReader instanceof Parser);
    return (Parser) xmlReader;
}
项目:infobip-open-jdk-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);
}