private Object getObjectValue ( Node node , String fieldName ) { // we have to take into account the fact that fieldName will be in the lower case if ( node != null ) { String name = node . getLocalName ( ) ; switch ( node . getNodeType ( ) ) { case Node . ATTRIBUTE_NODE : return name . equalsIgnoreCase ( fieldName ) ? node : null ; case Node . ELEMENT_NODE : { if ( name . equalsIgnoreCase ( fieldName ) ) { return new NodeArray ( node . getChildNodes ( ) ) ; } else { NamedNodeMap namedNodeMap = node . getAttributes ( ) ; for ( int attributeIndex = 0 ; attributeIndex < namedNodeMap . getLength ( ) ; ++ attributeIndex ) { Node attribute = namedNodeMap . item ( attributeIndex ) ; if ( attribute . getLocalName ( ) . equalsIgnoreCase ( fieldName ) ) { return attribute ; } } return null ; } } default : return null ; } } return null ; }
Returns the object value for the given field name and node