Java Code Examples for com.sun.org.apache.xml.internal.dtm.DTM#ENTITY_REFERENCE_NODE

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTM#ENTITY_REFERENCE_NODE . 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: 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 2
Source File: NodeTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 3
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 4
Source File: NodeTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 5
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 6
Source File: NodeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 7
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 8
Source File: NodeTest.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 9
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 10
Source File: NodeTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 11
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 :
  }
}
 
Example 12
Source File: NodeTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 13
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 14
Source File: NodeTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 15
Source File: DTMTreeWalker.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(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 16
Source File: NodeTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 17
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 18
Source File: NodeTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}
 
Example 19
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 20
Source File: NodeTest.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Tell what node type to test, if not DTMFilter.SHOW_ALL.
 *
 * @param whatToShow Bit set defined mainly by
 *        {@link com.sun.org.apache.xml.internal.dtm.DTMFilter}.
 * @return the node type for the whatToShow.  Since whatToShow can specify
 *         multiple types, it will return the first bit tested that is on,
 *         so the caller of this function should take care that this is
 *         the function they really want to call.  If none of the known bits
 *         are set, this function will return zero.
 */
public static int getNodeTypeTest(int whatToShow)
{
  // %REVIEW% Is there a better way?
  if (0 != (whatToShow & DTMFilter.SHOW_ELEMENT))
    return DTM.ELEMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ATTRIBUTE))
    return DTM.ATTRIBUTE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_TEXT))
    return DTM.TEXT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT))
    return DTM.DOCUMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_FRAGMENT))
    return DTM.DOCUMENT_FRAGMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NAMESPACE))
    return DTM.NAMESPACE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_COMMENT))
    return DTM.COMMENT_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_PROCESSING_INSTRUCTION))
    return DTM.PROCESSING_INSTRUCTION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_DOCUMENT_TYPE))
    return DTM.DOCUMENT_TYPE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY))
    return DTM.ENTITY_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_ENTITY_REFERENCE))
    return DTM.ENTITY_REFERENCE_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_NOTATION))
    return DTM.NOTATION_NODE;

  if (0 != (whatToShow & DTMFilter.SHOW_CDATA_SECTION))
    return DTM.CDATA_SECTION_NODE;


  return 0;
}