public static String getNodeValue(Node domNode) {
    if(domNode instanceof Comment) {
      return domNode.getNodeValue();
    }

    if(domNode instanceof Attr) {
      return ((Attr)domNode).getValue();
    }


    StringBuffer resultBuffer = new StringBuffer();

    NodeList childNodes = domNode.getChildNodes();

    if((childNodes != null) && (childNodes.getLength() > 0)) {

      for(int i = 0; i < childNodes.getLength(); i++) {
        if(childNodes.item(i) instanceof Text) {
          resultBuffer.append(childNodes.item(i).getNodeValue());
	}
      }
    }

    return resultBuffer.toString();
  }