24 |
|
|
25 |
|
// Parse the input |
26 |
|
SAXParser saxParser = factory.newSAXParser(); |
27 |
< |
saxParser.parse( new File(argv [0]), new Echo03() ); |
27 |
> |
saxParser.parse( new File(argv [0]), new XMLPacketMaker() ); |
28 |
|
|
29 |
|
} catch (Throwable t) { |
30 |
|
t.printStackTrace (); |
45 |
|
throws SAXException |
46 |
|
{ |
47 |
|
nl(); |
48 |
< |
nl(); |
48 |
> |
//nl(); |
49 |
|
emit ("START DOCUMENT"); |
50 |
|
nl(); |
51 |
< |
emit ("<?xml version='1.0' encoding='UTF-8'?>"); |
51 |
> |
//emit ("<?xml version='1.0' encoding='UTF-8'?>"); |
52 |
|
} |
53 |
|
|
54 |
|
public void endDocument () |
67 |
|
throws SAXException |
68 |
|
{ |
69 |
|
indentLevel++; |
70 |
< |
nl(); emit ("ELEMENT: "); |
71 |
< |
emit ("<"+name); |
70 |
> |
//nl(); emit ("ELEMENT: "); |
71 |
> |
//emit ("<"+name); |
72 |
|
if (attrs != null) { |
73 |
|
for (int i = 0; i < attrs.getLength (); i++) { |
74 |
|
nl(); |
79 |
|
emit ("\""); |
80 |
|
} |
81 |
|
} |
82 |
< |
if (attrs.getLength() > 0) nl(); |
83 |
< |
emit (">"); |
82 |
> |
//if (attrs.getLength() > 0) nl(); |
83 |
> |
//emit (">"); |
84 |
|
} |
85 |
|
|
86 |
|
public void endElement (String name) |
87 |
|
throws SAXException |
88 |
|
{ |
89 |
< |
nl(); |
90 |
< |
emit ("END_ELM: "); |
91 |
< |
emit ("</"+name+">"); |
89 |
> |
//nl(); |
90 |
> |
//emit ("END_ELM: "); |
91 |
> |
//emit ("</"+name+">"); |
92 |
|
indentLevel--; |
93 |
|
} |
94 |
|
|
95 |
|
public void characters (char buf [], int offset, int len) throws SAXException { |
96 |
< |
nl(); emit ("CHARS: "); |
96 |
> |
nl(); emit ("Value: "); |
97 |
|
String s = new String(buf, offset, len); |
98 |
|
if (!s.trim().equals("")) emit (s); |
99 |
|
} |