import [Link].
Log;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import
[Link];
public class XMLDOMParser {
public Document getDocument(String xml)
{
Document document = null;
DocumentBuilderFactory factory =
[Link]();
try{
DocumentBuilder db =
[Link]();
InputSource is = new InputSource();
[Link](new
StringReader(xml));
[Link]("UTF-8");
document = [Link](is);
}catch(ParserConfigurationException e)
{
Log.e("Error: ", [Link](), e);
return null;
}
catch (SAXException e) {
Log.e("Error: ", [Link](), e);
return null;
}
catch(IOException e){
Log.e("Error: ", [Link](), e);
return null;
}
return document;
}
public String getValue(Element item, String name)
{
NodeList nodes =
[Link](name);
return [Link]([Link](0));
}
private final String getTextNodeValue(Node elem)
{
Node child;
if( elem != null){
if ([Link]()){
for( child = [Link]();
child != null; child = [Link]() ){
if( [Link]() ==
Node.TEXT_NODE ){
return [Link]();
}
}
}
}
return "";
}
}