~ubuntu-branches/ubuntu/karmic/libxerces2-java/karmic

« back to all changes in this revision

Viewing changes to src/org/w3c/dom/ls/LSInput.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2006-12-04 17:37:55 UTC
  • mfrom: (2.1.2 etch)
  • Revision ID: james.westby@ubuntu.com-20061204173755-hb6ybrrrk097zhx7
Tags: 2.8.1-1ubuntu1
* Merge with Debian unstable; remaining changes:
  - Build -gcj package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2004 World Wide Web Consortium,
3
 
 *
4
 
 * (Massachusetts Institute of Technology, European Research Consortium for
5
 
 * Informatics and Mathematics, Keio University). All Rights Reserved. This
6
 
 * work is distributed under the W3C(r) Software License [1] in the hope that
7
 
 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8
 
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
 
 *
10
 
 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
11
 
 */
12
 
 
13
 
package org.w3c.dom.ls;
14
 
 
15
 
/**
16
 
 *  This interface represents an input source for data. 
17
 
 * <p> This interface allows an application to encapsulate information about 
18
 
 * an input source in a single object, which may include a public 
19
 
 * identifier, a system identifier, a byte stream (possibly with a specified 
20
 
 * encoding), a base URI, and/or a character stream. 
21
 
 * <p> The exact definitions of a byte stream and a character stream are 
22
 
 * binding dependent. 
23
 
 * <p> The application is expected to provide objects that implement this 
24
 
 * interface whenever such objects are needed. The application can either 
25
 
 * provide its own objects that implement this interface, or it can use the 
26
 
 * generic factory method <code>DOMImplementationLS.createLSInput()</code> 
27
 
 * to create objects that implement this interface. 
28
 
 * <p> The <code>LSParser</code> will use the <code>LSInput</code> object to 
29
 
 * determine how to read data. The <code>LSParser</code> will look at the 
30
 
 * different inputs specified in the <code>LSInput</code> in the following 
31
 
 * order to know which one to read from, the first one that is not null and 
32
 
 * not an empty string will be used: 
33
 
 * <ol>
34
 
 * <li> <code>LSInput.characterStream</code> 
35
 
 * </li>
36
 
 * <li> 
37
 
 * <code>LSInput.byteStream</code> 
38
 
 * </li>
39
 
 * <li> <code>LSInput.stringData</code> 
40
 
 * </li>
41
 
 * <li> 
42
 
 * <code>LSInput.systemId</code> 
43
 
 * </li>
44
 
 * <li> <code>LSInput.publicId</code> 
45
 
 * </li>
46
 
 * </ol> 
47
 
 * <p> If all inputs are null, the <code>LSParser</code> will report a 
48
 
 * <code>DOMError</code> with its <code>DOMError.type</code> set to 
49
 
 * <code>"no-input-specified"</code> and its <code>DOMError.severity</code> 
50
 
 * set to <code>DOMError.SEVERITY_FATAL_ERROR</code>. 
51
 
 * <p> <code>LSInput</code> objects belong to the application. The DOM 
52
 
 * implementation will never modify them (though it may make copies and 
53
 
 * modify the copies, if necessary). 
54
 
 */
55
 
public interface LSInput {
56
 
    /**
57
 
     *  An attribute of a language and binding dependent type that represents 
58
 
     * a stream of 16-bit units. The application must encode the stream 
59
 
     * using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). 
60
 
     */
61
 
    public java.io.Reader getCharacterStream();
62
 
    /**
63
 
     *  An attribute of a language and binding dependent type that represents 
64
 
     * a stream of 16-bit units. The application must encode the stream 
65
 
     * using UTF-16 (defined in [Unicode] and in [ISO/IEC 10646]). 
66
 
     */
67
 
    public void setCharacterStream(java.io.Reader characterStream);
68
 
 
69
 
    /**
70
 
     *  An attribute of a language and binding dependent type that represents 
71
 
     * a stream of bytes. 
72
 
     * <br> If the application knows the character encoding of the byte 
73
 
     * stream, it should set the encoding attribute. Setting the encoding in 
74
 
     * this way will override any encoding specified in an XML declaration 
75
 
     * in the data. 
76
 
     */
77
 
    public java.io.InputStream getByteStream();
78
 
    /**
79
 
     *  An attribute of a language and binding dependent type that represents 
80
 
     * a stream of bytes. 
81
 
     * <br> If the application knows the character encoding of the byte 
82
 
     * stream, it should set the encoding attribute. Setting the encoding in 
83
 
     * this way will override any encoding specified in an XML declaration 
84
 
     * in the data. 
85
 
     */
86
 
    public void setByteStream(java.io.InputStream byteStream);
87
 
 
88
 
    /**
89
 
     *  String data to parse. If provided, this will always be treated as a 
90
 
     * sequence of 16-bit units (UTF-16 encoded characters). 
91
 
     */
92
 
    public String getStringData();
93
 
    /**
94
 
     *  String data to parse. If provided, this will always be treated as a 
95
 
     * sequence of 16-bit units (UTF-16 encoded characters). 
96
 
     */
97
 
    public void setStringData(String stringData);
98
 
 
99
 
    /**
100
 
     *  The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this 
101
 
     * input source. The system identifier is optional if there is a byte 
102
 
     * stream, a character stream, or string data, but it is still useful to 
103
 
     * provide one, since the application will use it to resolve any 
104
 
     * relative URIs and can include it in error messages and warnings (the 
105
 
     * <code>LSParser</code> will only attempt to fetch the resource 
106
 
     * identified by the URI reference if there is no other input available 
107
 
     * in the input source). 
108
 
     * <br> If the application knows the character encoding of the object 
109
 
     * pointed to by the system identifier, it can set the encoding using 
110
 
     * the <code>encoding</code> attribute. 
111
 
     * <br> If the specified system ID is a relative URI reference (see 
112
 
     * section 5 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the DOM 
113
 
     * implementation will attempt to resolve the relative URI with the 
114
 
     * <code>baseURI</code> as the base, if that fails, the behavior is 
115
 
     * implementation dependent. 
116
 
     */
117
 
    public String getSystemId();
118
 
    /**
119
 
     *  The system identifier, a URI reference [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>], for this 
120
 
     * input source. The system identifier is optional if there is a byte 
121
 
     * stream, a character stream, or string data, but it is still useful to 
122
 
     * provide one, since the application will use it to resolve any 
123
 
     * relative URIs and can include it in error messages and warnings (the 
124
 
     * <code>LSParser</code> will only attempt to fetch the resource 
125
 
     * identified by the URI reference if there is no other input available 
126
 
     * in the input source). 
127
 
     * <br> If the application knows the character encoding of the object 
128
 
     * pointed to by the system identifier, it can set the encoding using 
129
 
     * the <code>encoding</code> attribute. 
130
 
     * <br> If the specified system ID is a relative URI reference (see 
131
 
     * section 5 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]), the DOM 
132
 
     * implementation will attempt to resolve the relative URI with the 
133
 
     * <code>baseURI</code> as the base, if that fails, the behavior is 
134
 
     * implementation dependent. 
135
 
     */
136
 
    public void setSystemId(String systemId);
137
 
 
138
 
    /**
139
 
     *  The public identifier for this input source. This may be mapped to an 
140
 
     * input source using an implementation dependent mechanism (such as 
141
 
     * catalogues or other mappings). The public identifier, if specified, 
142
 
     * may also be reported as part of the location information when errors 
143
 
     * are reported. 
144
 
     */
145
 
    public String getPublicId();
146
 
    /**
147
 
     *  The public identifier for this input source. This may be mapped to an 
148
 
     * input source using an implementation dependent mechanism (such as 
149
 
     * catalogues or other mappings). The public identifier, if specified, 
150
 
     * may also be reported as part of the location information when errors 
151
 
     * are reported. 
152
 
     */
153
 
    public void setPublicId(String publicId);
154
 
 
155
 
    /**
156
 
     *  The base URI to be used (see section 5.1.4 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]) for 
157
 
     * resolving a relative <code>systemId</code> to an absolute URI. 
158
 
     * <br> If, when used, the base URI is itself a relative URI, an empty 
159
 
     * string, or null, the behavior is implementation dependent. 
160
 
     */
161
 
    public String getBaseURI();
162
 
    /**
163
 
     *  The base URI to be used (see section 5.1.4 in [<a href='http://www.ietf.org/rfc/rfc2396.txt'>IETF RFC 2396</a>]) for 
164
 
     * resolving a relative <code>systemId</code> to an absolute URI. 
165
 
     * <br> If, when used, the base URI is itself a relative URI, an empty 
166
 
     * string, or null, the behavior is implementation dependent. 
167
 
     */
168
 
    public void setBaseURI(String baseURI);
169
 
 
170
 
    /**
171
 
     *  The character encoding, if known. The encoding must be a string 
172
 
     * acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2000/REC-xml-20001006'>XML 1.0</a>] section 
173
 
     * 4.3.3 "Character Encoding in Entities"). 
174
 
     * <br> This attribute has no effect when the application provides a 
175
 
     * character stream or string data. For other sources of input, an 
176
 
     * encoding specified by means of this attribute will override any 
177
 
     * encoding specified in the XML declaration or the Text declaration, or 
178
 
     * an encoding obtained from a higher level protocol, such as HTTP [<a href='http://www.ietf.org/rfc/rfc2616.txt'>IETF RFC 2616</a>]. 
179
 
     */
180
 
    public String getEncoding();
181
 
    /**
182
 
     *  The character encoding, if known. The encoding must be a string 
183
 
     * acceptable for an XML encoding declaration ([<a href='http://www.w3.org/TR/2000/REC-xml-20001006'>XML 1.0</a>] section 
184
 
     * 4.3.3 "Character Encoding in Entities"). 
185
 
     * <br> This attribute has no effect when the application provides a 
186
 
     * character stream or string data. For other sources of input, an 
187
 
     * encoding specified by means of this attribute will override any 
188
 
     * encoding specified in the XML declaration or the Text declaration, or 
189
 
     * an encoding obtained from a higher level protocol, such as HTTP [<a href='http://www.ietf.org/rfc/rfc2616.txt'>IETF RFC 2616</a>]. 
190
 
     */
191
 
    public void setEncoding(String encoding);
192
 
 
193
 
    /**
194
 
     *  If set to true, assume that the input is certified (see section 2.13 
195
 
     * in [<a href='http://www.w3.org/TR/2003/PR-xml11-20031105/'>XML 1.1</a>]) when 
196
 
     * parsing [<a href='http://www.w3.org/TR/2003/PR-xml11-20031105/'>XML 1.1</a>]. 
197
 
     */
198
 
    public boolean getCertifiedText();
199
 
    /**
200
 
     *  If set to true, assume that the input is certified (see section 2.13 
201
 
     * in [<a href='http://www.w3.org/TR/2003/PR-xml11-20031105/'>XML 1.1</a>]) when 
202
 
     * parsing [<a href='http://www.w3.org/TR/2003/PR-xml11-20031105/'>XML 1.1</a>]. 
203
 
     */
204
 
    public void setCertifiedText(boolean certifiedText);
205
 
 
206
 
}