當前位置: 首頁>>代碼示例>>Java>>正文


Java LexicalHandler.endEntity方法代碼示例

本文整理匯總了Java中org.xml.sax.ext.LexicalHandler.endEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java LexicalHandler.endEntity方法的具體用法?Java LexicalHandler.endEntity怎麽用?Java LexicalHandler.endEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.xml.sax.ext.LexicalHandler的用法示例。


在下文中一共展示了LexicalHandler.endEntity方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: endNode

import org.xml.sax.ext.LexicalHandler; //導入方法依賴的package包/類
/**
 * End processing of given node
 *
 *
 * @param node Node we just finished processing
 *
 * @throws org.xml.sax.SAXException
 */
protected void endNode(Node node) throws org.xml.sax.SAXException
{

  switch (node.getNodeType())
  {
  case Node.DOCUMENT_NODE :
    break;

  case Node.ELEMENT_NODE :
    String ns = m_dh.getNamespaceOfNode(node);
    if(null == ns)
      ns = "";
    this.m_contentHandler.endElement(ns,
                                       m_dh.getLocalNameOfNode(node),
                                       node.getNodeName());

    NamedNodeMap atts = ((Element) node).getAttributes();
    int nAttrs = atts.getLength();

    for (int i = 0; i < nAttrs; i++)
    {
      Node attr = atts.item(i);
      String attrName = attr.getNodeName();

      if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
      {
        int index;
        // Use "" instead of null, as Xerces likes "" for the
        // name of the default namespace.  Fix attributed
        // to "Steven Murray" <[email protected]>.
        String prefix = (index = attrName.indexOf(":")) < 0
                        ? "" : attrName.substring(index + 1);

        this.m_contentHandler.endPrefixMapping(prefix);
      }
    }
    break;
  case Node.CDATA_SECTION_NODE :
    break;
  case Node.ENTITY_REFERENCE_NODE :
  {
    EntityReference eref = (EntityReference) node;

    if (m_contentHandler instanceof LexicalHandler)
    {
      LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);

      lh.endEntity(eref.getNodeName());
    }
  }
  break;
  default :
  }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:63,代碼來源:TreeWalker.java

示例2: endNode

import org.xml.sax.ext.LexicalHandler; //導入方法依賴的package包/類
/**
 * End processing of given node
 *
 *
 * @param node Node we just finished processing
 *
 * @throws org.xml.sax.SAXException
 */
protected void endNode(int node) throws org.xml.sax.SAXException
{

  switch (m_dtm.getNodeType(node))
  {
  case DTM.DOCUMENT_NODE :
    this.m_contentHandler.endDocument();
    break;
  case DTM.ELEMENT_NODE :
    String ns = m_dtm.getNamespaceURI(node);
    if(null == ns)
      ns = "";
    this.m_contentHandler.endElement(ns,
                                       m_dtm.getLocalName(node),
                                       m_dtm.getNodeName(node));

    for (int nsn = m_dtm.getFirstNamespaceNode(node, true); DTM.NULL != nsn;
         nsn = m_dtm.getNextNamespaceNode(node, nsn, true))
    {
      // String prefix = m_dtm.getPrefix(nsn);
      String prefix = m_dtm.getNodeNameX(nsn);

      this.m_contentHandler.endPrefixMapping(prefix);
    }
    break;
  case DTM.CDATA_SECTION_NODE :
    break;
  case DTM.ENTITY_REFERENCE_NODE :
  {
    if (m_contentHandler instanceof LexicalHandler)
    {
      LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);

      lh.endEntity(m_dtm.getNodeName(node));
    }
  }
  break;
  default :
  }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:49,代碼來源:DTMTreeWalker.java

示例3: endNode

import org.xml.sax.ext.LexicalHandler; //導入方法依賴的package包/類
/**
 * End processing of given node
 *
 *
 * @param node Node we just finished processing
 *
 * @throws org.xml.sax.SAXException
 */
protected void endNode(Node node) throws org.xml.sax.SAXException
{

  switch (node.getNodeType())
  {
  case Node.DOCUMENT_NODE :
    break;

  case Node.ELEMENT_NODE :
    String ns = DOM2Helper.getNamespaceOfNode(node);
    if(null == ns)
      ns = "";
    this.m_contentHandler.endElement(ns,
            DOM2Helper.getLocalNameOfNode(node),
            node.getNodeName());

    NamedNodeMap atts = ((Element) node).getAttributes();
    int nAttrs = atts.getLength();

    for (int i = 0; i < nAttrs; i++)
    {
      Node attr = atts.item(i);
      String attrName = attr.getNodeName();

      if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
      {
        int index;
        // Use "" instead of null, as Xerces likes "" for the
        // name of the default namespace.  Fix attributed
        // to "Steven Murray" <[email protected]>.
        String prefix = (index = attrName.indexOf(":")) < 0
                        ? "" : attrName.substring(index + 1);

        this.m_contentHandler.endPrefixMapping(prefix);
      }
    }
    break;
  case Node.CDATA_SECTION_NODE :
    break;
  case Node.ENTITY_REFERENCE_NODE :
  {
    EntityReference eref = (EntityReference) node;

    if (m_contentHandler instanceof LexicalHandler)
    {
      LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);

      lh.endEntity(eref.getNodeName());
    }
  }
  break;
  default :
  }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:63,代碼來源:TreeWalker.java


注:本文中的org.xml.sax.ext.LexicalHandler.endEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。