Java XML Node Type getNodeTypeStr(int nodeType)

Here you can find the source of getNodeTypeStr(int nodeType)

Description

Gets Node type String for a given node type constant

License

Apache License

Declaration


public static String getNodeTypeStr(int nodeType)

    

Method Source Code

//package com.java2s;
/*/*www.j  a  v  a  2  s. co m*/
 * Copyright 2015 www.seleniumtests.com
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.w3c.dom.Node;

public class Main {
    /**
     * Gets Node type String for a given node type constant
     */

    public static String getNodeTypeStr(int nodeType)

    {

        switch (nodeType)

        {

        case Node.ATTRIBUTE_NODE:

            return "ATTRIBUTE_NODE ";

        case Node.CDATA_SECTION_NODE:

            return "CDATA_SECTION_NODE";

        case Node.COMMENT_NODE:

            return "COMMENT_NODE";

        case Node.DOCUMENT_FRAGMENT_NODE:

            return "DOCUMENT_FRAGMENT_NODE";

        case Node.DOCUMENT_TYPE_NODE:

            return "DOCUMENT_TYPE_NODE";

        case Node.ELEMENT_NODE:

            return "ELEMENT_NODE";

        case Node.ENTITY_NODE:

            return "ENTITY_NODE";

        case Node.ENTITY_REFERENCE_NODE:

            return "ENTITY_REFERENCE_NODE";

        case Node.NOTATION_NODE:

            return "NOTATION_NODE";

        case Node.PROCESSING_INSTRUCTION_NODE:

            return "PROCESSING_INSTRUCTION_NODE";

        case Node.TEXT_NODE:

            return "TEXT_NODE";

        case Node.DOCUMENT_NODE:

            return "DOCUMENT_NODE";

        default:

            return "UN-INDENTIFIED NODE";

        }

    }
}

Related

  1. getNodeByType(Node root, int type)
  2. getNodesOfType( NamedNodeMap list, short type)
  3. getNodeType(Node node)
  4. getNodeType(Node node)
  5. getNodeType(Node node)
  6. getSubnodesOfType(Node in, int type)
  7. getTypeAsString(Node node, boolean cftype)
  8. getTypeName(Node nameNode)
  9. getTypeName(short nodeType)