Buongiorno,
ho il seguente problema:
invocando un WS da una URL del tipo
http://www.miosito.it/feed.atom
ricevo un file nel formato ATOM-XML.
Vorrei riuscire a parsare il file ricevuto con XPATH.
Posto il codice che utilizzo ma che non dà i risultati attesi:
La stringa title è vuota.codice:private final static String FIRST_PAGE_URL = "http://www.miosito.it/feed.atom"; HttpClient client = new HttpClient(); PostMethod post_method = new PostMethod(FIRST_PAGE_URL); BufferedReader read = null; int returnCode = client.executeMethod(post_method); XPathFactory factory=XPathFactory.newInstance(); XPath xPath=factory.newXPath(); InputSource inputSource = new InputSource(post_method.getResponseBodyAsStream()); XPathExpression xPathExpression= xPath.compile("/title"); String title = xPathExpression.evaluate(inputSource);
Non dovrebbe essere visto che l'XML in questione inizia esattamente con:
<feed xmlns="http://www.w ........

Rispondi quotando