| 35 |
|
SAXParser saxParser = factory.newSAXParser(); |
| 36 |
|
saxParser.parse(xml, new XMLPacketParser(packet)); |
| 37 |
|
|
| 38 |
– |
// Print out the entire contents of the packet's HashMap. |
| 39 |
– |
System.out.println("XMLPacket contents: -"); |
| 40 |
– |
packet.printAll(); |
| 41 |
– |
|
| 38 |
|
} |
| 39 |
+ |
catch (IOException e){ |
| 40 |
+ |
System.out.println("IOException: "+e); |
| 41 |
+ |
} |
| 42 |
|
catch (Throwable t) { |
| 43 |
< |
System.out.println("The recieved packet did not contain valid XML, so I'm gonna reject it."); |
| 44 |
< |
//t.printStackTrace (); |
| 43 |
> |
System.out.println("XMLPacketMaker - I just received an XML packet that did not contain valid XML."); |
| 44 |
> |
//System.out.println(e); |
| 45 |
> |
t.printStackTrace(); |
| 46 |
> |
return null; |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
return packet; |