It says that I need to add a cast to element, but even when I do that
it doesn't work
NodeList productNL = element.getElementsByTagName("ProductName");
full method :
public void dumpTitles() {
String sUrlBase = "http://webdev4.matcmadison.edu/mbtest/mab/
AmazonXML/";
String xmlContent = getContent(sUrlBase + selected);
ArrayList<String>item = new ArrayList<String>();
String[] hi;
try {
DocumentBuilder db =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = db.parse(new InputSource(new
StringReader(xmlContent)));
NodeList prodNL = doc.getElementsByTagName("ProductName");
for (int i=0;i<prodNL.getLength();i++) {
Element element = (Element)prodNL.item(i);
NodeList productNL =
element.getElementsByTagName("ProductName");
Node nProductName = productNL.item(0);
String sProductName =
nProductName.getFirstChild().getNodeValue();
String s = String.format("Title %d is [%s]", i,
sProductName);
}
}
catch (Exception ex) {
Log.println(Log.DEBUG, TAG, "XML Parsing failed: " +
ex.getMessage());
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en