Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - URLConnection VS HTTPClient & SAX VS DOM Performance ..

URLConnection VS HTTPClient & SAX VS DOM Performance ..

Tutorials with advanced 'difficulty' and more Lines of Code.

Re: URLConnection VS HTTPClient & SAX VS DOM Performance ..

Postby himanshu.chopra » Fri Aug 20, 2010 7:27 am

Hi!
I took help of your code to use DOM parser for dynamic XML file . But my application crashes at the following line:
Document doc = db.parse(new InputSource(new StringReader(xml)));

Here is the complete method:

public void parseXml(String xml) {

String sUrl = "";
String sTitle = "";

// Reset the ArrayList
locations.clear();

try {
// Create required instances
DocumentBuilderFactory dbf;
dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();

// Parse the xml
Document doc = db.parse(new InputSource(new StringReader(xml)));

// Get all <Result> tags.
// If there are more than zero tags, we know, that we have a result.
NodeList nl = doc.getElementsByTagName("GetSectorDataResult");
if (nl != null && nl.getLength() > 0) {

// Get the title and url for every <Result>-tag
for (int i = 0; i < nl.getLength(); i++) {

Locations l = new Locations();

// Get the content of the <Result>-tag
Element result = (Element) nl.item(i);

// Get the content of the <Title>-tag inside the
// <Result>-tag
Element title = (Element) result.getElementsByTagName(
"Securities").item(0);
sTitle = title.getFirstChild().getNodeValue();
l.setTitle(sTitle);
Log.v("Demo", "Content of parsed element: " + sTitle);

// Get the content of the <BusinessClickUrl>-tag inside the
// <Result>-tag
Element url = (Element) result.getElementsByTagName(
"SectorId").item(0);
if (url.hasChildNodes()) {
sUrl = url.getFirstChild().getNodeValue();
l.setBusinessClickUrl(sUrl);
Log.v("Demo", "Content of parsed element: " + sUrl);
}

// Save the content in the ArrayList
locations.add(l);
}
}
} catch (ParserConfigurationException e) {
Log.v("Demo", "ParserConfigurationException " + e.toString());
} catch (SAXException e) {
Log.v("Demo", "SAXException " + e.toString());
} catch (IOException e) {
Log.v("Demo", "IOException " + e.toString());
}

Please help me out to solve this problem
himanshu.chopra
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Aug 20, 2010 7:21 am

Top
Previous

Return to Advanced Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests