hi there!
I'm using kXML as Lib for parsing XML.
the XML looks like this:Code:KXmlParser parser = new KXmlParser(); InputStream is = getClass().getResourceAsStream("/vok.vok2"); parser.setInput(new InputStreamReader(is)); parser.nextTag(); parser.require(XmlPullParser.START_TAG, null, "teachmaster"); while (parser.nextTag () != XmlPullParser.END_TAG) { if(parser.getName().equals("header")) { System.out.println("headercheck"); parser.require(XmlPullParser.START_TAG, null, null); while (parser.nextTag() != XmlPullParser.END_TAG) { parser.require(XmlPullParser.START_TAG, null, null); String name = parser.getName(); parser.require(XmlPullParser.END_TAG, null, name); } parser.require(XmlPullParser.END_TAG, null, null); } } parser.require(XmlPullParser.END_TAG, null, "teachmaster"); parser.next(); parser.require(XmlPullParser.END_DOCUMENT, null, null);
the error is:HTML Code:<?xml version="1.0" encoding="ISO-8859-1"?> <teachmaster> <header> <titel>Unit1</titel> <autor>Jens</autor> <bemerkungen>ein test</bemerkungen> <spreins>German</spreins> <sprzwei>Englisch</sprzwei> <font></font> <fontsize></fontsize> <fontlek></fontlek> <fontspreins></fontspreins> <fontsprzwei></fontsprzwei> <fontsyn></fontsyn> <fontbem></fontbem> </header> </teachmaster>
Code:headercheck org.xmlpull.v1.XmlPullParserException: expected: END_TAG {null}titel (position:START_TAG <titel>@4:14 in java.io.InputStreamReader@1cb37664) at org.kxml2.io.KXmlParser.exception(+47) at org.kxml2.io.KXmlParser.require(+83) at mobilelearn$ReadXML.run(+95)
i would be cool if someone has a hint fo me
thanks,
Martin

Reply With Quote

