public boolean isXMLDoc(){
  if (isXMLDoc == UNKNOWN_TYPE)   isXMLDoc=getDocumentType();
  return isXMLDoc == VALID_XML;
}

public boolean isXMLDoc ( ) { if ( isXMLDoc == UNKNOWN_TYPE ) isXMLDoc = getDocumentType ( ) ; return isXMLDoc == VALID_XML ; }
document can be an xml document or a text document .
