Here you can find the source of mapNodeType(short nodeType)
Parameter | Description |
---|---|
nodeType | a numeric Node type, one of the node type constants defined in <code>Node</code> |
static public String mapNodeType(short nodeType)
//package com.java2s; //License from project: LGPL public class Main { /** Maps node type codes to names. Used by {@link #mapNodeType} */ static private String[] nodeTypeMap; /**//from www . j a va 2 s . c o m * Maps a node type, as returned by to a name. * The node types returned by {@link Node#getNodeType()} are * numeric and are therefore inconveniently opaque. * * @param nodeType a numeric Node type, one of the node type * constants defined in <code>Node</code> * @return a string name for the type */ static public String mapNodeType(short nodeType) { // Mostly for debugging -- the numeric node types are pretty // useless in any sort of log message. Yes, this _is_ // more elaborate than you'd guess it'd have to be, and no, // there's no other way to debug node types other than by grubbing // through org.w3c.dom.Node.java assert nodeType < nodeTypeMap.length; String val = nodeTypeMap[nodeType]; if (val == null) val = "UNKNOWN!!!"; assert val instanceof String; return (String) val; } }