public String getProcessingInstructionTarget(Object o) { return (o instanceof ProcessingInstruction ? ((ProcessingInstruction)o).getTarget() : null); }
/** compare non-element nodes. * not yet tuned for normalizing adjacent CDATA and other horrors * @param refNode * @param testNode * @param xpath current ancestry of refNode * @return */ public static String compareNonElementNodesCanonically(Node refNode, Node testNode, String xpath) { String message = null; String refValue = refNode.getValue(); String testValue = testNode.getValue(); if (refNode instanceof Comment) { if (!refValue.equals(testValue)) { message = "comments at ("+xpath+") differ: "+refValue+" != "+testValue; } } else if (refNode instanceof Text) { if (!refValue.equals(testValue)) { message = "text contents at ("+xpath+") differ: ["+refValue+"] != ["+testValue+"]"; } } else if (refNode instanceof ProcessingInstruction) { String refTarget = ((ProcessingInstruction) refNode).getTarget(); String testTarget = ((ProcessingInstruction) testNode).getTarget(); if (!refTarget.equals(testTarget)) { message = "PI targets at ("+xpath+") differ: "+refTarget+" != "+testTarget; } } else { LOG.warn("Unknown XML element in comparison"); } return message; }
/** * Get the display name of this node. For elements and attributes this is * [prefix:]localname. For unnamed nodes, it is an empty string. * * @return The display name of this node. For a node with no name, return an * empty string. */ public String getDisplayName() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getQualifiedName(); case Type.ATTRIBUTE: return ((Attribute) node).getQualifiedName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the display name of this node. For elements and attributes this is * [prefix:]localname. For unnamed nodes, it is an empty string. * * @return The display name of this node. For a node with no name, return an * empty string. */ public String getDisplayName() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getQualifiedName(); case Type.ATTRIBUTE: return ((Attribute) node).getQualifiedName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the local part of the name of this node. This is the name after the * ":" if any. * * @return the local part of the name. For an unnamed node, returns "". */ public String getLocalPart() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getLocalName(); case Type.ATTRIBUTE: return ((Attribute) node).getLocalName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the local part of the name of this node. This is the name after the * ":" if any. * * @return the local part of the name. For an unnamed node, returns "". */ public String getLocalPart() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getLocalName(); case Type.ATTRIBUTE: return ((Attribute) node).getLocalName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the local part of the name of this node. This is the name after the * ":" if any. * * @return the local part of the name. For an unnamed node, returns "". */ public String getLocalPart() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getLocalName(); case Type.ATTRIBUTE: return ((Attribute) node).getLocalName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
/** * Get the display name of this node. For elements and attributes this is * [prefix:]localname. For unnamed nodes, it is an empty string. * * @return The display name of this node. For a node with no name, return an * empty string. */ public String getDisplayName() { switch (nodeKind) { case Type.ELEMENT: return ((Element) node).getQualifiedName(); case Type.ATTRIBUTE: return ((Attribute) node).getQualifiedName(); case Type.PROCESSING_INSTRUCTION: return ((ProcessingInstruction) node).getTarget(); default: return ""; } }
final void writeProcessingInstruction(ProcessingInstruction pi) { nodeTokens.add((byte)PROCESSING_INSTRUCTION); writeIndex(pi.getTarget()); writeIndex(pi.getValue()); }
final void writeProcessingInstruction(ProcessingInstruction pi) { nodeTokens.add((byte)PROCESSING_INSTRUCTION); writeIndex(pi.getTarget()); writeIndex(pi.getValue()); }