| 32 |
|
try { |
| 33 |
|
|
| 34 |
|
// Parse the input |
| 35 |
– |
|
| 36 |
– |
xml.trim(); |
| 37 |
– |
|
| 38 |
– |
//debug stuff |
| 39 |
– |
byte[] temp = xml.getBytes(); |
| 40 |
– |
System.out.println("String length: "+temp.length+" "); |
| 41 |
– |
for (int i = 0 ; i < temp.length ; i++){ |
| 42 |
– |
System.out.print((char)temp[i]); |
| 43 |
– |
} |
| 44 |
– |
|
| 35 |
|
InputSource inputSource = new InputSource(new StringReader(xml)); |
| 36 |
|
SAXParser saxParser = factory.newSAXParser(); |
| 37 |
|
saxParser.parse(inputSource, new XMLPacketParser(packet)); |
| 38 |
|
|
| 39 |
|
} |
| 40 |
< |
//catch (IOException e){ |
| 51 |
< |
// System.out.println("IOException: "+e); |
| 52 |
< |
//} |
| 53 |
< |
catch (Throwable t) { |
| 40 |
> |
catch (Exception e) { |
| 41 |
|
System.out.println("XMLPacketMaker - I just received an XML packet that did not contain valid XML."); |
| 42 |
< |
//System.out.println(e); |
| 56 |
< |
t.printStackTrace(); |
| 42 |
> |
//t.printStackTrace(); |
| 43 |
|
return null; |
| 44 |
|
} |
| 45 |
|
|