Java Code Examples for org.xml.sax.ext.LexicalHandler#endEntity()

The following examples show how to use org.xml.sax.ext.LexicalHandler#endEntity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TreeWalker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 2
Source File: DTMTreeWalker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 3
Source File: TreeWalker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 4
Source File: DTMTreeWalker.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 5
Source File: DTMTreeWalker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 6
Source File: DTMTreeWalker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 7
Source File: TreeWalker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 8
Source File: DTMTreeWalker.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 9
Source File: TreeWalker.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 10
Source File: DTMTreeWalker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 11
Source File: TreeWalker.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 12
Source File: DTMTreeWalker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 13
Source File: TreeWalker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 14
Source File: TreeWalker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 15
Source File: TreeWalker.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 16
Source File: DTMTreeWalker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 17
Source File: TreeWalker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 18
Source File: DTMTreeWalker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 19
Source File: TreeWalker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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 :
  }
}
 
Example 20
Source File: DTMTreeWalker.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * 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 :
  }
}