1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.dbforms.interfaces;
25
26 import org.w3c.dom.Document;
27 import org.w3c.dom.Element;
28 import org.w3c.dom.xpath.XPathEvaluator;
29
30 import java.io.IOException;
31 import java.io.InputStream;
32 import java.io.OutputStream;
33
34 /***
35 * abstract class to hide the implemtation details of the various dom
36 * implementations.
37 *
38 * @author Henner Kollmann
39 */
40 public interface IDOMFactory {
41
42 /***
43 * Creates a string representation of the given DOMDocument
44 *
45 * @param doc
46 * The document to transform
47 *
48 * @return string representation
49 */
50 public String DOM2String(Document doc);
51
52 /***
53 * Creates an new DOMDocument from the given string
54 *
55 * @param data
56 * the string to parse
57 *
58 * @return The new DOMDocument
59 */
60 public Document String2DOM(String data);
61
62 /***
63 * Creates a new empty DOMDocument
64 *
65 * @return An empty DOMDocument
66 */
67 public Document newDOMDocument();
68
69 /***
70 * Reads a DOMDocument from given InputStream
71 *
72 * @param in
73 * The InputStream to read
74 *
75 * @return The new parsed DOMDocument
76 */
77 public Document read(InputStream in);
78
79 /***
80 * Reads a DOMDocument from given url
81 *
82 * @param url
83 * the url to read from
84 *
85 * @return The new parsed DOMDocument
86 */
87 public Document read(String url);
88
89 /***
90 * Writes a DOMElement into an OutputStream
91 *
92 * @param out
93 * OutputStream to write into
94 * @param root
95 * root element to start writing
96 */
97 public void write(OutputStream out, Element root) throws IOException;
98
99 /***
100 * Writes a DOMDocument into an OutputStream
101 *
102 * @param out
103 * OutputStream to write into
104 * @param doc
105 * doc to write
106 */
107 public void write(OutputStream out, Document doc) throws IOException;
108
109 /***
110 * Writes an DOMDocument into a file
111 *
112 * @param url
113 * The url to write to
114 * @param doc
115 * The document to write
116 */
117 public void write(String url, Document doc) throws IOException;
118
119 /***
120 * Writes an DOMElement into a file
121 *
122 * @param url
123 * The url to write to
124 * @param root
125 * root element to start writing
126 */
127 public void write(String url, Element root) throws IOException;
128
129 /***
130 * returns an new created XPathEvaluator
131 *
132 * @return the new XPathEvaluator
133 */
134 public XPathEvaluator newXPathEvaluator();
135
136 }