当前位置: 首页>>代码示例>>Java>>正文


Java DTM.PROCESSING_INSTRUCTION_NODE属性代码示例

本文整理汇总了Java中com.sun.org.apache.xml.internal.dtm.DTM.PROCESSING_INSTRUCTION_NODE属性的典型用法代码示例。如果您正苦于以下问题:Java DTM.PROCESSING_INSTRUCTION_NODE属性的具体用法?Java DTM.PROCESSING_INSTRUCTION_NODE怎么用?Java DTM.PROCESSING_INSTRUCTION_NODE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.org.apache.xml.internal.dtm.DTM的用法示例。


在下文中一共展示了DTM.PROCESSING_INSTRUCTION_NODE属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: print

/**
 * Prints the whole tree to standard output
 */
public void print(int node, int level)
{
    switch(getNodeType(node))
    {
        case DTM.ROOT_NODE:
        case DTM.DOCUMENT_NODE:
            print(getFirstChild(node), level);
            break;
        case DTM.TEXT_NODE:
        case DTM.COMMENT_NODE:
        case DTM.PROCESSING_INSTRUCTION_NODE:
            System.out.print(getStringValueX(node));
            break;
        default:
            final String name = getNodeName(node);
            System.out.print("<" + name);
            for (int a = getFirstAttribute(node); a != DTM.NULL; a = getNextAttribute(a))
            {
                System.out.print("\n" + getNodeName(a) + "=\"" + getStringValueX(a) + "\"");
            }
            System.out.print('>');
            for (int child = getFirstChild(node); child != DTM.NULL;
                child = getNextSibling(child)) {
                print(child, level + 1);
            }
            System.out.println("</" + name + '>');
            break;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:SAXImpl.java

示例2: getLocalName

/**
 * Override SAX2DTM.getLocalName() in SAX2DTM2.
 * <p>Processing for PIs is different.
 *
 * Given a node handle, return its XPath- style localname. (As defined in
 * Namespaces, this is the portion of the name after any colon character).
 *
 * @param nodeHandle the id of the node.
 * @return String Local name of this node.
 */
public String getLocalName(int nodeHandle)
{
  int expType = _exptype(makeNodeIdentity(nodeHandle));

  if (expType == DTM.PROCESSING_INSTRUCTION_NODE)
  {
    int dataIndex = _dataOrQName(makeNodeIdentity(nodeHandle));
    dataIndex = m_data.elementAt(-dataIndex);
    return m_valuesOrPrefixes.indexToString(dataIndex);
  }
  else
    return m_expandedNameTable.getLocalName(expType);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:SAX2DTM2.java

示例3: getNodeNameX

/**
 * The optimized version of SAX2DTM.getNodeNameX().
 * <p>
 * Given a node handle, return the XPath node name. This should be the name
 * as described by the XPath data model, NOT the DOM- style name.
 *
 * @param nodeHandle the id of the node.
 * @return String Name of this node, which may be an empty string.
 */
public final String getNodeNameX(int nodeHandle)
{

  int nodeID = makeNodeIdentity(nodeHandle);
  int eType = _exptype2(nodeID);

  if (eType == DTM.PROCESSING_INSTRUCTION_NODE)
  {
    int dataIndex = _dataOrQName(nodeID);
    dataIndex = m_data.elementAt(-dataIndex);
    return m_valuesOrPrefixes.indexToString(dataIndex);
  }

  final ExtendedType extType = m_extendedTypes[eType];

  if (extType.getNamespace().length() == 0)
  {
    return extType.getLocalName();
  }
  else
  {
    int qnameIndex = m_dataOrQName.elementAt(nodeID);

    if (qnameIndex == 0)
      return extType.getLocalName();

    if (qnameIndex < 0)
    {
      qnameIndex = -qnameIndex;
      qnameIndex = m_data.elementAt(qnameIndex);
    }

    return m_valuesOrPrefixes.indexToString(qnameIndex);
  }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:SAX2DTM2.java

示例4: copy

private final void copy(final int node, SerializationHandler handler, boolean isChild)
    throws TransletException
{
 int nodeID = makeNodeIdentity(node);
    int eType = _exptype2(nodeID);
    int type = _exptype2Type(eType);

    try {
        switch(type)
        {
            case DTM.ROOT_NODE:
            case DTM.DOCUMENT_NODE:
                for(int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) {
                    copy(makeNodeHandle(c), handler, true);
                }
                break;
            case DTM.PROCESSING_INSTRUCTION_NODE:
                copyPI(node, handler);
                break;
            case DTM.COMMENT_NODE:
                handler.comment(getStringValueX(node));
                break;
            case DTM.TEXT_NODE:
                boolean oldEscapeSetting = false;
                boolean escapeBit = false;

                if (_dontEscape != null) {
                    escapeBit = _dontEscape.getBit(getNodeIdent(node));
                    if (escapeBit) {
                        oldEscapeSetting = handler.setEscaping(false);
                    }
                }

                copyTextNode(nodeID, handler);

                if (escapeBit) {
                    handler.setEscaping(oldEscapeSetting);
                }
                break;
            case DTM.ATTRIBUTE_NODE:
                copyAttribute(nodeID, eType, handler);
                break;
            case DTM.NAMESPACE_NODE:
                handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node));
                break;
            default:
                if (type == DTM.ELEMENT_NODE)
                {
                    // Start element definition
                    final String name = copyElement(nodeID, eType, handler);
                    //if(isChild) => not to copy any namespaces  from parents
                    // else copy all namespaces in scope
                    copyNS(nodeID, handler,!isChild);
                    copyAttributes(nodeID, handler);
                    // Copy element children
                    for (int c = _firstch2(nodeID); c != DTM.NULL; c = _nextsib2(c)) {
                        copy(makeNodeHandle(c), handler, true);
                    }

                    // Close element definition
                    handler.endElement(name);
                }
                // Shallow copy of attribute to output handler
                else {
                    final String uri = getNamespaceName(node);
                    if (uri.length() != 0) {
                        final String prefix = getPrefix(node);
                        handler.namespaceAfterStartElement(prefix, uri);
                    }
                    handler.addAttribute(getNodeName(node), getNodeValue(node));
                }
                break;
        }
    }
    catch (Exception e) {
        throw new TransletException(e);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:79,代码来源:SAXImpl.java

示例5: shallowCopy

/**
 * Performs a shallow copy (ref. XSLs copy())
 */
public String shallowCopy(final int node, SerializationHandler handler)
    throws TransletException
{
    int nodeID = makeNodeIdentity(node);
    int exptype = _exptype2(nodeID);
    int type = _exptype2Type(exptype);

    try {
        switch(type)
        {
            case DTM.ELEMENT_NODE:
                final String name = copyElement(nodeID, exptype, handler);
                copyNS(nodeID, handler, true);
                return name;
            case DTM.ROOT_NODE:
            case DTM.DOCUMENT_NODE:
                return EMPTYSTRING;
            case DTM.TEXT_NODE:
                copyTextNode(nodeID, handler);
                return null;
            case DTM.PROCESSING_INSTRUCTION_NODE:
                copyPI(node, handler);
                return null;
            case DTM.COMMENT_NODE:
                handler.comment(getStringValueX(node));
                return null;
            case DTM.NAMESPACE_NODE:
                handler.namespaceAfterStartElement(getNodeNameX(node), getNodeValue(node));
                return null;
            case DTM.ATTRIBUTE_NODE:
                copyAttribute(nodeID, exptype, handler);
                return null;
            default:
                final String uri1 = getNamespaceName(node);
                if (uri1.length() != 0) {
                    final String prefix = getPrefix(node);
                    handler.namespaceAfterStartElement(prefix, uri1);
                }
                handler.addAttribute(getNodeName(node), getNodeValue(node));
                return null;
        }
    } catch (Exception e) {
        throw new TransletException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:48,代码来源:SAXImpl.java

示例6: ProcessingInstructionPattern

/**
 * Handles calls with no parameter (current node is implicit parameter).
 */
public ProcessingInstructionPattern(String name) {
    super(Axis.CHILD, DTM.PROCESSING_INSTRUCTION_NODE, null);
    _name = name;
    //if (_name.equals("*")) _typeChecked = true; no wildcard allowed!
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ProcessingInstructionPattern.java

示例7: getNodeTypeTest

/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:NodeTest.java

示例8: getNodeName

/**
 * The optimized version of SAX2DTM.getNodeName().
 * <p>
 * Given a node handle, return its DOM-style node name. This will include
 * names such as #text or #document.
 *
 * @param nodeHandle the id of the node.
 * @return String Name of this node, which may be an empty string.
 * %REVIEW% Document when empty string is possible...
 * %REVIEW-COMMENT% It should never be empty, should it?
 */
public String getNodeName(int nodeHandle)
{

  int nodeID = makeNodeIdentity(nodeHandle);
  int eType = _exptype2(nodeID);

  final ExtendedType extType = m_extendedTypes[eType];
  if (extType.getNamespace().length() == 0)
  {
    int type = extType.getNodeType();

    String localName = extType.getLocalName();
    if (type == DTM.NAMESPACE_NODE)
    {
      if (localName.length() == 0)
        return "xmlns";
      else
        return "xmlns:" + localName;
    }
    else if (type == DTM.PROCESSING_INSTRUCTION_NODE)
    {
      int dataIndex = _dataOrQName(nodeID);
      dataIndex = m_data.elementAt(-dataIndex);
      return m_valuesOrPrefixes.indexToString(dataIndex);
    }
    else if (localName.length() == 0)
    {
      return getFixedNames(type);
    }
    else
      return localName;
  }
  else
  {
    int qnameIndex = m_dataOrQName.elementAt(nodeID);

    if (qnameIndex == 0)
      return extType.getLocalName();

    if (qnameIndex < 0)
    {
      qnameIndex = -qnameIndex;
      qnameIndex = m_data.elementAt(qnameIndex);
    }

    return m_valuesOrPrefixes.indexToString(qnameIndex);
  }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:59,代码来源:SAX2DTM2.java


注:本文中的com.sun.org.apache.xml.internal.dtm.DTM.PROCESSING_INSTRUCTION_NODE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。