32 |
|
try { |
33 |
|
|
34 |
|
// Parse the input |
35 |
+ |
InputSource inputSource = new InputSource(new StringReader(xml)); |
36 |
|
SAXParser saxParser = factory.newSAXParser(); |
37 |
< |
saxParser.parse(xml, new XMLPacketParser(packet)); |
37 |
> |
saxParser.parse(inputSource, new XMLPacketParser(packet)); |
38 |
|
|
38 |
– |
// Print out the entire contents of the packet's HashMap. |
39 |
– |
System.out.println("XMLPacket contents: -"); |
40 |
– |
packet.printAll(); |
41 |
– |
|
39 |
|
} |
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); |
42 |
> |
//t.printStackTrace(); |
43 |
|
return null; |
44 |
|
} |
45 |
|
|