| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
package ca.spaz.util; |
| 5 |
|
|
| 6 |
|
import java.io.PrintStream; |
| 7 |
|
import java.util.*; |
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
public class XMLNode { |
| 15 |
|
String name; |
| 16 |
0 |
HashMap attributes = new HashMap(); |
| 17 |
0 |
ArrayList children = new ArrayList(); |
| 18 |
|
|
| 19 |
0 |
public XMLNode(String name) { |
| 20 |
0 |
this.name = name; |
| 21 |
0 |
} |
| 22 |
|
|
| 23 |
|
public void addAttribute(String key, String val) { |
| 24 |
0 |
attributes.put(key, val); |
| 25 |
0 |
} |
| 26 |
|
|
| 27 |
|
public void addChild(XMLNode node) { |
| 28 |
0 |
children.add(node); |
| 29 |
0 |
} |
| 30 |
|
|
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
|
| 36 |
|
public String escape(String str) { |
| 37 |
0 |
str = str.replaceAll("&", "&"); |
| 38 |
0 |
str = str.replaceAll("\"", ""e;"); |
| 39 |
0 |
str = str.replaceAll("<", "<"); |
| 40 |
0 |
str = str.replaceAll(">", ">"); |
| 41 |
0 |
return str; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
public void print(PrintStream out) { |
| 45 |
|
|
| 46 |
0 |
} |
| 47 |
|
|
| 48 |
|
} |