当前位置: 首页>>代码示例>>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;未经允许,请勿转载。