⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gnomexmlreader.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  {    if (entityResolver == null)      {        return null;      }    try      {        systemId = XMLJ.getAbsoluteURI (base, systemId);        InputSource source = entityResolver.resolveEntity (publicId, systemId);        return (source == null) ? null : XMLJ.getInputStream (source);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void notationDecl (String name, String publicId, String systemId)    throws SAXException  {    if (seenFatalError || dtdHandler == null)      {        return;      }    try      {        systemId = XMLJ.getAbsoluteURI (base, systemId);        dtdHandler.notationDecl (name, publicId, systemId);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void attributeDecl (String eName, String aName, String type,                              String mode, String value)    throws SAXException  {    if (seenFatalError || declarationHandler == null)      {        return;      }    try      {        declarationHandler.attributeDecl (eName, aName, type, mode, value);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void elementDecl (String name, String model)    throws SAXException  {    if (seenFatalError || declarationHandler == null)      {        return;      }    try      {        declarationHandler.elementDecl (name, model);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void unparsedEntityDecl (String name, String publicId,                                   String systemId, String notationName)    throws SAXException  {    if (seenFatalError || dtdHandler == null)      {        return;      }    try      {        systemId = XMLJ.getAbsoluteURI (base, systemId);        dtdHandler.unparsedEntityDecl (name, publicId, systemId,                                       notationName);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void setDocumentLocator (Object ctx, Object loc)  {    locator = new GnomeLocator (ctx, loc);    if (seenFatalError || contentHandler == null)      {        return;      }    try      {        contentHandler.setDocumentLocator (locator);      }    catch (Exception e)      {      }  }    private void startDocument (boolean standalone)    throws SAXException  {    this.standalone = standalone;    seenStartDocument = true;    if (contentHandler == null)      {        return;      }    try      {        contentHandler.startDocument ();      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void endDocument ()    throws SAXException  {    if (contentHandler == null)      {        return;      }    try      {        contentHandler.endDocument();      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void startElement(String name, String[] attrs)    throws SAXException  {    if (seenFatalError || contentHandler == null)      {        return;      }    try      {        XMLName xName = new XMLName (this, name);        if (namespaces)          {            // Handle defined namespaces            ns.push ();            int len = (attrs == null) ? 0 : attrs.length;            if (len > 0)              {                ArrayList filtered = new ArrayList (len);                for (int i = 0; i < len; i += 2)                  {                    String attName = attrs[i];                    String attValue = attrs[i + 1];                    if (attName.equals ("xmlns"))                      {                        startPrefixMapping ("", attValue);                      }                    else if (attName.startsWith ("xmlns:"))                      {                        startPrefixMapping (attName.substring (6), attValue);                      }                    else                      {                        filtered.add (attName);                        filtered.add (attValue);                      }                  }                // Remove xmlns attributes                attrs = new String[filtered.size ()];                filtered.toArray (attrs);              }          }        // Construct attributes        Attributes atts = new StringArrayAttributes (this, attrs);        contentHandler.startElement (xName.uri, xName.localName, xName.qName,                                     atts);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void endElement (String name)    throws SAXException  {    if (seenFatalError || contentHandler == null)      {        return;      }    try      {        XMLName xName = new XMLName (this, name);        String uri = (xName.uri == null) ? "" : xName.uri;        contentHandler.endElement (uri, xName.localName, xName.qName);        // Handle undefining namespaces        if (namespaces)          {            for (Iterator i = ns.currentPrefixes (); i.hasNext (); )              {                endPrefixMapping ((String) i.next ());              }            ns.pop (); // releases current depth          }      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void startPrefixMapping (String prefix, String uri)    throws SAXException  {    if (seenFatalError || contentHandler == null)      {        return;      }    ns.define (prefix, uri);    contentHandler.startPrefixMapping (prefix, uri);  }  private void endPrefixMapping (String prefix)    throws SAXException  {    if (seenFatalError || contentHandler == null)      {        return;      }    contentHandler.endPrefixMapping (prefix);  }  private void characters (String text)    throws SAXException  {    if (seenFatalError || contentHandler == null || text == null)      {        return;      }    try      {        char[] ch = text.toCharArray ();        contentHandler.characters (ch, 0, ch.length);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void ignorableWhitespace (String text)    throws SAXException  {    if (seenFatalError || contentHandler == null || text == null)      {        return;      }    try      {        char[] ch = text.toCharArray ();        contentHandler.ignorableWhitespace (ch, 0, ch.length);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void processingInstruction (String target, String data)    throws SAXException  {    if (seenFatalError || contentHandler == null)      {        return;      }    try      {        if (data == null)          {            data = "";          }        contentHandler.processingInstruction (target, data);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void comment (String text)    throws SAXException  {    if (seenFatalError || lexicalHandler == null || text == null)      {        return;      }    try      {        char[] ch = text.toCharArray ();        lexicalHandler.comment (ch, 0, ch.length);      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void cdataBlock (String text)    throws SAXException  {    if (seenFatalError || text == null)      {        return;      }    try      {        if (lexicalHandler == null)          {            characters(text);          }        else          {            lexicalHandler.startCDATA();            characters(text);            lexicalHandler.endCDATA();          }      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void warning (String message,                        int lineNumber, int columnNumber,                        String publicId, String systemId)    throws SAXException  {    if (seenFatalError || errorHandler == null)      {        return;      }    try      {        Locator l = new StandaloneLocator (lineNumber, columnNumber,                                           publicId, systemId);        errorHandler.warning (new SAXParseException (message, l));      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void error (String message,                      int lineNumber, int columnNumber,                      String publicId, String systemId)    throws SAXException  {    if (seenFatalError || errorHandler == null)      {        return;      }    try      {        Locator l = new StandaloneLocator (lineNumber, columnNumber,                                           publicId, systemId);        errorHandler.error (new SAXParseException (message, l));      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }  private void fatalError (String message,                           int lineNumber, int columnNumber,                           String publicId, String systemId)    throws SAXException  {    if (seenFatalError || errorHandler == null)      {        return;      }    try      {        if (!seenStartDocument)          {            startDocument (false);          }        seenFatalError = true;        Locator l = new StandaloneLocator (lineNumber, columnNumber,                                           publicId, systemId);        errorHandler.fatalError (new SAXParseException (message, l));      }    catch (Exception e)      {        if (e instanceof SAXException)          {            throw (SAXException) e;          }        else          {            throw new SAXException (e);          }      }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -