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

📄 saxeventsink.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  {    if (interrupted)      {        return;      }    if (namespaceAware)      {        pending.clear();      }    ctx = ctx.getParentNode();  }  public void characters(char[] c, int off, int len)    throws SAXException  {    if (interrupted || len < 1)      {        return;      }    ctx.appendChild(createText(c, off, len));  }  protected Text createText(char[] c, int off, int len)    throws SAXException  {    Text text = (inCDATA && !coalescing) ?      doc.createCDATASection(new String(c, off, len)) :      doc.createTextNode(new String(c, off, len));    return text;  }  public void ignorableWhitespace(char[] c, int off, int len)    throws SAXException  {    if (interrupted)      {        return;      }    if (!ignoreWhitespace)      {        characters(c, off, len);      }  }  public void processingInstruction(String target, String data)    throws SAXException  {    if (interrupted)      {        return;      }    Node pi = createProcessingInstruction(target, data);    ctx.appendChild(pi);  }  protected Node createProcessingInstruction(String target, String data)  {    return doc.createProcessingInstruction(target, data);  }  public void skippedEntity(String name)    throws SAXException  {    // This callback is totally pointless  }  // -- LexicalHandler --    public void startDTD(String name, String publicId, String systemId)    throws SAXException  {    if (interrupted)      {        return;      }    Node doctype = createDocumentType(name, publicId, systemId);    doc.appendChild(doctype);    ctx = doctype;    inDTD = true;  }  protected Node createDocumentType(String name, String publicId,                                    String systemId)  {    return new DomDoctype(doc, name, publicId, systemId);  }  public void endDTD()    throws SAXException  {    if (interrupted)      {        return;      }    inDTD = false;    ctx = ctx.getParentNode();  }  public void startEntity(String name)    throws SAXException  {    if (interrupted)      return;    DocumentType doctype = doc.getDoctype();    if (doctype == null)      {        throw new SAXException("SAX parser error: " +                               "reference to entity in undeclared doctype");      }    if ("[dtd]".equals(name) || name.charAt(0) == '%')      return;    if (PREDEFINED_ENTITIES.contains(name))      return;    // Get entity    NamedNodeMap entities = doctype.getEntities();    Entity entity = (Entity) entities.getNamedItem(name);    if (entity == null)      {        throw new SAXException("SAX parser error: " +                               "reference to undeclared entity: " + name);      }    EntityReference ref = doc.createEntityReference(name);    // DomDocument populates with the entity replacement text, remove this    Node child = ref.getFirstChild();    while (child != null)      {        Node nextChild = child.getNextSibling();        ref.removeChild(child);        child = nextChild;      }    ctx.appendChild(ref);    ctx = ref;  }  public void endEntity(String name)    throws SAXException  {    if (interrupted)      return;    if ("[dtd]".equals(name) || name.charAt(0) == '%')      return;    if (PREDEFINED_ENTITIES.contains(name))      return;    // Get entity reference    EntityReference ref = (EntityReference) ctx;    if (!ref.getNodeName().equals(name))      throw new SAXException("expecting end of "+ref.getNodeName()+" entity");    ctx = ctx.getParentNode();    if (ref instanceof DomNode)      ((DomNode) ref).makeReadonly();    if (expandEntityReferences)      {        // Move entity content from reference node onto context        Node child = ref.getFirstChild();        while (child != null)          {            Node nextChild = child.getNextSibling();            ctx.appendChild(child);            child = nextChild;          }        ctx.removeChild(ref);      }  }  public void startCDATA()    throws SAXException  {    inCDATA = true;  }  public void endCDATA()    throws SAXException  {    inCDATA = false;  }  public void comment(char[] c, int off, int len)    throws SAXException  {    if (interrupted)      {        return;      }    Node comment = createComment(c, off, len);    ctx.appendChild(comment);  }  protected Node createComment(char[] c, int off, int len)  {    return doc.createComment(new String(c, off, len));  }  // -- DTDHandler --  public void notationDecl(String name, String publicId, String systemId)    throws SAXException  {    if (interrupted)      {        return;      }    if (!inDTD)      throw new SAXException("notation decl outside DTD");    DomDoctype doctype = (DomDoctype) ctx;    doctype.declareNotation(name, publicId, systemId);  }  public void unparsedEntityDecl(String name, String publicId, String systemId,                                 String notationName)    throws SAXException  {    if (interrupted)      {        return;      }    if (!inDTD)      throw new SAXException("unparsed entity decl outside DTD");    DomDoctype doctype = (DomDoctype) ctx;    Entity entity = doctype.declareEntity(name, publicId, systemId,                                          notationName);  }  // -- DeclHandler --    public void elementDecl(String name, String model)    throws SAXException  {    if (interrupted)      {        return;      }    if (!inDTD)      throw new SAXException("element decl outside DTD");    // Ignore fake element declarations generated by ValidationConsumer.    // If an element is not really declared in the DTD it will not be    // declared in the document model.    if (!(ctx instanceof DomDoctype))      {        return;      }    DomDoctype doctype = (DomDoctype) ctx;    doctype.elementDecl(name, model);  }  public void attributeDecl(String eName, String aName, String type,                            String mode, String value)    throws SAXException  {    if (interrupted)      {        return;      }    if (!inDTD)      throw new SAXException("attribute decl outside DTD");    DomDoctype doctype = (DomDoctype) ctx;    doctype.attributeDecl(eName, aName, type, mode, value);  }  public void internalEntityDecl(String name, String value)    throws SAXException  {    if (interrupted)      {        return;      }    if (!inDTD)      throw new SAXException("internal entity decl outside DTD");    DomDoctype doctype = (DomDoctype) ctx;    Entity entity = doctype.declareEntity(name, null, null, null);    if (entity != null)      {        Node text = doc.createTextNode(value);        entity.appendChild(text);      }  }  public void externalEntityDecl(String name, String publicId, String systemId)    throws SAXException  {    if (interrupted)      {        return;      }    if (!inDTD)      throw new SAXException("external entity decl outside DTD");    DomDoctype doctype = (DomDoctype) ctx;    Entity entity = doctype.declareEntity(name, publicId, systemId, null);  }  }

⌨️ 快捷键说明

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