| Revision 46,
640 bytes
checked in by bmcguffin, 9 years ago
(diff) |
|
Added file: XMLWriter, in package Scriptbuilder.structures. It holds static methods which ither classes that implement I_XML_Writable may find useful. Also restructured the toXML method of many classes to utilize this new class.
|
| Rev | Line | |
|---|
| 1 | package scriptbuilder.structures; |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * |
|---|
| 5 | * @author Bryan McGuffin |
|---|
| 6 | */ |
|---|
| 7 | public class XMLWriter |
|---|
| 8 | { |
|---|
| 9 | |
|---|
| 10 | public static String openTag(String s) |
|---|
| 11 | { |
|---|
| 12 | return "<" + s + ">"; |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | public static String closeTag(String s) |
|---|
| 16 | { |
|---|
| 17 | return "</" + s + ">\n"; |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | public static String emptyTag(String s) |
|---|
| 21 | { |
|---|
| 22 | return "<" + s + "/>\n"; |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | public static String simpleTag(String s, ELEMENT e) |
|---|
| 26 | { |
|---|
| 27 | String output = ""; |
|---|
| 28 | if (s == null) |
|---|
| 29 | { |
|---|
| 30 | s = ""; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | output += openTag(e.tag); |
|---|
| 34 | output += s; |
|---|
| 35 | output += closeTag(e.tag); |
|---|
| 36 | |
|---|
| 37 | return output; |
|---|
| 38 | } |
|---|
| 39 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.