NodeProxy p = ((ReferenceNode)a).getReference(); nodeTypeA = p.getNodeType();
NodeProxy p = ((ReferenceNode)a).getReference();  nodeTypeA = p.getNode().getNodeType();
	private boolean compareContents(Node a, Node b) {		a = findNextTextOrElementNode(a.getFirstChild());		b = findNextTextOrElementNode(b.getFirstChild());		while(!(a == null || b == null)) {            int nodeTypeA = a.getNodeType();            if (nodeTypeA == NodeImpl.REFERENCE_NODE) {                //Retrieve the actual node type                NodeProxy p = ((ReferenceNode)a).getReference();                nodeTypeA = p.getNodeType();            }            int nodeTypeB = b.getNodeType();            if (nodeTypeB == NodeImpl.REFERENCE_NODE) {                //Retrieve the actual node type                NodeProxy p = ((ReferenceNode)b).getReference();                nodeTypeB = p.getNodeType();            }             			if (nodeTypeA != nodeTypeB) return false;			switch(nodeTypeA) {				case Node.TEXT_NODE:					if (!safeEquals(a.getNodeValue(), b.getNodeValue())) return false;					break;				case Node.ELEMENT_NODE:					if (!compareElements(a, b)) return false;					break;				default:					throw new RuntimeException("unexpected node type " + a.getNodeType());			}			a = findNextTextOrElementNode(a.getNextSibling());			b = findNextTextOrElementNode(b.getNextSibling());		}		return a == b;		// both null	}