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 /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package de.XMLparser; import java.io.IOException; import java.io.InputStream; import java.util.Vector; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; class ParsedExampleDataSet { private String schoolname; private String studentname; private String studentage; private String studentaddress; private String schooladdress; public String toString() { return "Student's Name: " + studentname + "n" + "Student's Address: " + studentaddress + "n" + "Student's Age: " + studentage + "nn" + "School's Name: " + schoolname + "n" + "School's Address: " + schooladdress; } public String getSchoolName() { return schoolname; } public void setSchoolName(String schoolname) { this.schoolname = schoolname; } public String getStudentName() { return studentname; } public void setStudentName(String studentname) { this.studentname = studentname; } public String getStudentAge() { return studentage; } public void setStudentAge(String studentage) { this.studentage = studentage; } public String getStudentAddress() { return studentaddress; } public String getSchoolAddress() { return schooladdress; } public void setStudentAddress(String studentaddress) { this.studentaddress = studentaddress; } public void setSchoolAddress(String schooladress) { this.schooladdress = schooladress; } } class ContentHandler extends DefaultHandler { private enum Tags { Test, Name, Age, School, Student, Address, Entry } private boolean in_schoolTag = false; private boolean in_studentTag = false; private ParsedExampleDataSet DataSet; private Vector MyParsedExampleDataSets; public ContentHandler() { super(); this.MyParsedExampleDataSets = new Vector(); } public Vector getParsedExampleDataSets() { return this.MyParsedExampleDataSets; } public void startDocument() throws SAXException { } public void endDocument() throws SAXException { } public void startElement(String n, String l, String q, Attributes a) { switch(Tags.valueOf(l)) { case School: in_schoolTag = true; break; case Student: in_studentTag = true; break; case Address: if(in_studentTag) DataSet.setStudentAddress(a.getValue("displayname")); if(in_schoolTag) DataSet.setSchoolAddress(a.getValue("displayname")); break; case Age: DataSet.setStudentAge(a.getValue("value")); break; case Name: if(in_studentTag) DataSet.setStudentName(a.getValue("displayname")); if(in_schoolTag) DataSet.setSchoolName(a.getValue("displayname")); break; case Entry: DataSet = new ParsedExampleDataSet(); break; } } public void endElement(String n, String l, String q) { switch(Tags.valueOf(l)) { case School: in_schoolTag = false; break; case Student: in_studentTag = false; break; case Entry: MyParsedExampleDataSets.add(DataSet); break; } } public void characters(char ch[], int start, int length) { } } public class XMLparserSample extends Activity { private TextView myTextView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Vector test = read(getResources().openRawResource(R.raw.sample)); String text = ""; for(int i=0; i < test.size(); i++) text += test.get(i).toString()+"n-------------------------n"; myTextView = (TextView) findViewById(R.id.textview); myTextView.setText(text); } public Vector read(InputStream in) { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp; try { sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); ContentHandler ch = new ContentHandler(); xr.setContentHandler(ch); xr.parse(new InputSource(in)); return ch.getParsedExampleDataSets(); } catch (ParserConfigurationException e) { } catch (SAXException e) { } catch (IOException e) {} return null; } }