01: package jsx3.xml;
02:
03: /**
04: * CdfDocuments and the root of a Node tree.
05: * @author Joe Walker [joe at getahead dot ltd dot uk]
06: */
07: public final class CdfDocument extends Node {
08: /**
09: * Ensure all Records have unique IDs
10: * @param id the jsxid for this record
11: */
12: public CdfDocument(String id) {
13: super (id);
14: }
15:
16: /**
17: * Generate an XML string suitable for marshalling
18: */
19: public String toXml() {
20: StringBuilder result = new StringBuilder();
21:
22: // result.append("<?xml version=\"1.0\"?>\n");
23: // result.append("\n");
24:
25: result.append("<data jsxid=\"jsxroot\">\n");
26:
27: for (Record record : this ) {
28: result.append(record.toXml(0));
29: result.append("\n");
30: }
31:
32: result.append("</data>\n");
33:
34: return result.toString();
35: }
36: }
|