En essayant de se connecter à GOOGLE avec ce code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 import com.google.soap.search.*;
 
public class google10 {
  private static String googleKey = "5127873873187477137&hl=fr";
  public static void main( String[] args) {
 
    GoogleSearch s = new GoogleSearch();
 
      s.setQueryString("nature");
      s.setMaxResults(10);
 
       s.setKey(googleKey);
      try{
      GoogleSearchResult r =s.doSearch();
 
     GoogleSearchResultElement[] re = r.getResultElements();
     for (int i=0; i< re.length; i++){
       System.out.println(re[i].getTitle());
       System.out.println(re[i].getURL());
       System.out.println(re[i].getSnippet());
     }
    }
    catch (GoogleSearchFault f){
      System.out.println("erreur2    "+f.toString());
    }
  }
}

On a eu ce message.
C'est quoi la faute.

[Fatal Error] :6:94: The reference to entity "hl" must end with the ';' delimiter.
erreur2 com.google.soap.search.GoogleSearchFault: [SOAPException: faultCode=SOAP-ENV:Client; msg=Parsing error, response was:
The reference to entity "hl" must end with the ';' delimiter.; targetException=org.xml.sax.SAXParseException: The reference to entity "hl" must end with the ';' delimiter.]