My sax parser is working fine for other xml files, however for this file it's not working. Before formatting and after xml file formatted
I can't find what's wrong in the XML code, some online validators says it's ok, and some doesn't.
I have put a print in the startElement method()
and it just writes
@Override
public void startElement(String uri, String localName, String qName, Attributes attribute) {
elementOn = true;
sb.delete(0, sb.length());
if (localName.equals("Part")) {
journey.add(sb.toString())
...
}
03-03 11:50:04.165 3165-3184/se.xxx.x.app E/start﹕ [ 03-03 11:50:04.165 3165: 3184 E/start ]
03-03 11:50:04.165 3165-3184/se.xxx.x.app E/start﹕ [ 03-03 11:50:04.165 3165: 3184 E/start ]
03-03 11:50:04.165 3165-3184/se.xxx.x.app E/start﹕ [ 03-03 11:50:04.165 3165: 3184 E/start ]
I also put one print in the endElement method
and it writes this:
03-03 12:11:17.114 3257-3276/se.x.x.app E/endElement﹕ <Part><From><Id>80129</Id><Poi>A</Poi><PoiAlias>A</PoiAlias><Name>Malmö Ellstorp</Name><X>6167351.00</X><Y>1324920.00</Y></From><To><Id>80110</Id><Poi>G</Poi><PoiAlias>G</PoiAlias><Name>Malmö Värnhem</Name><X>6167569.00</X><Y>1324648.00</Y></To><Line><Name>3</Name><No>3</No><LinTName>Stadsbuss</LinTName></Line><Coords><Coord><X>6167348.97</X><Y>1324918.92</Y></Coord><Coord><X>6167395.11</X><Y>1324877.70</Y></Coord><Coord><X>6167407.62</X><Y>1324865.61</Y></Coord><Coord><X>6167422.52</X><Y>1324852.10</Y></Coord><Coord><X>6167444.33</X><Y>1324832.65</Y></Coord><Coord><X>6167467.42</X><Y>1324811.56</Y></Coord><Coord><X>6167484.12</X><Y>1324795.79</Y></Coord><Coord><X>6167496.59</X><Y>1324782.39</Y></Coord><Coord><X>6167521.95</X><Y>1324757.39</Y></Coord><Coord><X>6167530.16</X><Y>1324749.31</Y></Coord><Coord><X>6167536.06</X><Y>1324742.80</Y></Coord><Coord><X>6167528.65</X><Y>1324734.64</Y></Coord><Coord><X>6167518.76</X><Y>1324727.43</Y></Coord><Coord><X>6167508.90</X><Y>1324719.42</Y></Coord><Coord><X>6167513.49</X><Y>1324710.15</Y></Coord><Coord><X>6167563.87</X><Y>1324644.56</Y></Coord></Coords></Part>
Which is the whole "Part" block, it doesn't find each element in it.
Full xml parser if necessary full handler class
EDIT: Here is the raw data I use: XML URL EDIT: If I copy and past my xml from Chrome into a String and parse it from there it works fine.
URL url = new URL(params[0]);
xmlR.parse(new InputSource(url.openStream())); //Does not work
--------
InputSource stream = new InputSource(new StringReader(xml));// Works if I go to that URL in Chrome and copy the xml into the String xml.