jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DOMInputImpl.java
author joehw
Thu, 28 Jul 2016 22:58:41 -0700
changeset 39907 db51759e3695
parent 25868 686eef1e7a79
child 44797 8b3b3b911b8a
permissions -rw-r--r--
8158084: Catalog API: JAXP XML Processor Support Reviewed-by: lancea, clanger
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 2001, 2002,2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *      http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
package com.sun.org.apache.xerces.internal.dom;
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
import org.w3c.dom.ls.LSInput;
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
import java.io.Reader;
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import java.io.InputStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
 * This Class <code>DOMInputImpl</code> represents a single input source for an XML entity.
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
 * <p> This Class allows an application to encapsulate information about
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * an input source in a single object, which may include a public
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * identifier, a system identifier, a byte stream (possibly with a specified
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * encoding), and/or a character stream.
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * <p> The exact definitions of a byte stream and a character stream are
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * binding dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * <p> There are two places that the application will deliver this input
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * source to the parser: as the argument to the <code>parse</code> method,
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * or as the return value of the <code>DOMResourceResolver.resolveEntity</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *  method.
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * <p> The <code>DOMParser</code> will use the <code>LSInput</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * object to determine how to read XML input. If there is a character stream
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * available, the parser will read that stream directly; if not, the parser
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 * will use a byte stream, if available; if neither a character stream nor a
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * byte stream is available, the parser will attempt to open a URI
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * connection to the resource identified by the system identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 * <p> An <code>LSInput</code> object belongs to the application: the
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * parser shall never modify it in any way (it may modify a copy if
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 * necessary).  Eventhough all attributes in this interface are writable the
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
 * DOM implementation is expected to never mutate a LSInput.
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
 * <p>See also the <a href='http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025'>Document Object Model (DOM) Level 3 Abstract Schemas and Load
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
and Save Specification</a>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
 * @xerces.internal
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
 * @author Gopal Sharma, SUN Microsystems Inc.
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
// REVISIT:
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
// 1. it should be possible to do the following
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
// DOMInputImpl extends XMLInputSource implements LSInput
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
// 2. we probably need only the default constructor.  -- el
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
public class DOMInputImpl implements LSInput {
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
        //
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
        // Data
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
        //
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
        protected String fPublicId = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
        protected String fSystemId = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
        protected String fBaseSystemId = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
        protected InputStream fByteStream = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
        protected Reader fCharStream    = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
        protected String fData = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
        protected String fEncoding = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
        protected boolean fCertifiedText = false;
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
   /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
     * Default Constructor, constructs an input source
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
     public DOMInputImpl() {}
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
   /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
     * Constructs an input source from just the public and system
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
     * identifiers, leaving resolution of the entity and opening of
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
     * the input stream up to the caller.
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
     * @param publicId     The public identifier, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
     * @param systemId     The system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
     *                     always be set, if possible, and can be
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     *                     relative or absolute. If the system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     *                     is relative, then the base system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
     *                     should be set.
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
     * @param baseSystemId The base system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
     *                     always be set to the fully expanded URI of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
     *                     base system identifier, if possible.
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
    public DOMInputImpl(String publicId, String systemId,
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
                          String baseSystemId) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
                fPublicId = publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
                fSystemId = systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
                fBaseSystemId = baseSystemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
    } // DOMInputImpl(String,String,String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
     * Constructs an input source from a byte stream.
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
     * @param publicId     The public identifier, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
     * @param systemId     The system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     *                     always be set, if possible, and can be
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     *                     relative or absolute. If the system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     *                     is relative, then the base system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     *                     should be set.
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
     * @param baseSystemId The base system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
     *                     always be set to the fully expanded URI of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
     *                     base system identifier, if possible.
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
     * @param byteStream   The byte stream.
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
     * @param encoding     The encoding of the byte stream, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
    public DOMInputImpl(String publicId, String systemId,
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
                          String baseSystemId, InputStream byteStream,
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
                          String encoding) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
                fPublicId = publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
                fSystemId = systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
                fBaseSystemId = baseSystemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
                fByteStream = byteStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
                fEncoding = encoding;
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
    } // DOMInputImpl(String,String,String,InputStream,String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
   /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     * Constructs an input source from a character stream.
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
     * @param publicId     The public identifier, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
     * @param systemId     The system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
     *                     always be set, if possible, and can be
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     *                     relative or absolute. If the system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     *                     is relative, then the base system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     *                     should be set.
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     * @param baseSystemId The base system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
     *                     always be set to the fully expanded URI of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
     *                     base system identifier, if possible.
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
     * @param charStream   The character stream.
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
     * @param encoding     The original encoding of the byte stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
     *                     used by the reader, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
     public DOMInputImpl(String publicId, String systemId,
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
                          String baseSystemId, Reader charStream,
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
                          String encoding) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
                fPublicId = publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
                fSystemId = systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
                fBaseSystemId = baseSystemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
                fCharStream = charStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
                fEncoding = encoding;
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
     } // DOMInputImpl(String,String,String,Reader,String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
   /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     * Constructs an input source from a String.
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
     * @param publicId     The public identifier, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
     * @param systemId     The system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
     *                     always be set, if possible, and can be
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
     *                     relative or absolute. If the system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
     *                     is relative, then the base system identifier
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
     *                     should be set.
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
     * @param baseSystemId The base system identifier. This value should
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
     *                     always be set to the fully expanded URI of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
     *                     base system identifier, if possible.
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
     * @param data                 The String Data.
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
     * @param encoding     The original encoding of the byte stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
     *                     used by the reader, if known.
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
     public DOMInputImpl(String publicId, String systemId,
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
                          String baseSystemId, String data,
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
                          String encoding) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
                fPublicId = publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
                fSystemId = systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
                fBaseSystemId = baseSystemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
                fData = data;
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
                fEncoding = encoding;
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
     } // DOMInputImpl(String,String,String,String,String)
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
   /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
     * An attribute of a language-binding dependent type that represents a
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
     * stream of bytes.
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
     * <br>The parser will ignore this if there is also a character stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
     * specified, but it will use a byte stream in preference to opening a
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
     * URI connection itself.
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
     * <br>If the application knows the character encoding of the byte stream,
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
     * it should set the encoding property. Setting the encoding in this way
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
     * will override any encoding specified in the XML declaration itself.
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
    public InputStream getByteStream(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
        return fByteStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
     * An attribute of a language-binding dependent type that represents a
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
     * stream of bytes.
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
     * <br>The parser will ignore this if there is also a character stream
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
     * specified, but it will use a byte stream in preference to opening a
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
     * URI connection itself.
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
     * <br>If the application knows the character encoding of the byte stream,
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
     * it should set the encoding property. Setting the encoding in this way
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
     * will override any encoding specified in the XML declaration itself.
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
     public void setByteStream(InputStream byteStream){
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
        fByteStream = byteStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
     }
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
     *  An attribute of a language-binding dependent type that represents a
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
     * stream of 16-bit units. Application must encode the stream using
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
     * UTF-16 (defined in  and Amendment 1 of ).
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
     * <br>If a character stream is specified, the parser will ignore any byte
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
     * stream and will not attempt to open a URI connection to the system
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
     * identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
    public Reader getCharacterStream(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
        return fCharStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
     *  An attribute of a language-binding dependent type that represents a
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
     * stream of 16-bit units. Application must encode the stream using
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
     * UTF-16 (defined in  and Amendment 1 of ).
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
     * <br>If a character stream is specified, the parser will ignore any byte
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
     * stream and will not attempt to open a URI connection to the system
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
     * identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
     public void setCharacterStream(Reader characterStream){
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
        fCharStream = characterStream;
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
     }
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
     * A string attribute that represents a sequence of 16 bit units (utf-16
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
     * encoded characters).
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
     * <br>If string data is available in the input source, the parser will
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
     * ignore the character stream and the byte stream and will not attempt
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
     * to open a URI connection to the system identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
    public String getStringData(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
        return fData;
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
   /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
     * A string attribute that represents a sequence of 16 bit units (utf-16
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
     * encoded characters).
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
     * <br>If string data is available in the input source, the parser will
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
     * ignore the character stream and the byte stream and will not attempt
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
     * to open a URI connection to the system identifier.
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
     public void setStringData(String stringData){
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
                fData = stringData;
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
     }
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
     *  The character encoding, if known. The encoding must be a string
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
     * acceptable for an XML encoding declaration ( section 4.3.3 "Character
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
     * Encoding in Entities").
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
     * <br>This attribute has no effect when the application provides a
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
     * character stream. For other sources of input, an encoding specified
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
     * by means of this attribute will override any encoding specified in
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
     * the XML claration or the Text Declaration, or an encoding obtained
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
     * from a higher level protocol, such as HTTP .
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
    public String getEncoding(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
        return fEncoding;
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
     *  The character encoding, if known. The encoding must be a string
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
     * acceptable for an XML encoding declaration ( section 4.3.3 "Character
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
     * Encoding in Entities").
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
     * <br>This attribute has no effect when the application provides a
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
     * character stream. For other sources of input, an encoding specified
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
     * by means of this attribute will override any encoding specified in
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
     * the XML claration or the Text Declaration, or an encoding obtained
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
     * from a higher level protocol, such as HTTP .
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
    public void setEncoding(String encoding){
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
        fEncoding = encoding;
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
     * The public identifier for this input source. The public identifier is
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
     * always optional: if the application writer includes one, it will be
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
     * provided as part of the location information.
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
    public String getPublicId(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
        return fPublicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
     * The public identifier for this input source. The public identifier is
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
     * always optional: if the application writer includes one, it will be
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
     * provided as part of the location information.
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
    public void setPublicId(String publicId){
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
        fPublicId = publicId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
     * The system identifier, a URI reference , for this input source. The
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
     * system identifier is optional if there is a byte stream or a
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
     * character stream, but it is still useful to provide one, since the
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
     * application can use it to resolve relative URIs and can include it in
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
     * error messages and warnings (the parser will attempt to fetch the
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
     * ressource identifier by the URI reference only if there is no byte
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
     * stream or character stream specified).
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
     * <br>If the application knows the character encoding of the object
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
     * pointed to by the system identifier, it can register the encoding by
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
     * setting the encoding attribute.
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
     * <br>If the system ID is a relative URI reference (see section 5 in ),
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
     * the behavior is implementation dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
    public String getSystemId(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
        return fSystemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
     * The system identifier, a URI reference , for this input source. The
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
     * system identifier is optional if there is a byte stream or a
7f561c08de6b Initial load
duke
parents:
diff changeset
   340
     * character stream, but it is still useful to provide one, since the
7f561c08de6b Initial load
duke
parents:
diff changeset
   341
     * application can use it to resolve relative URIs and can include it in
7f561c08de6b Initial load
duke
parents:
diff changeset
   342
     * error messages and warnings (the parser will attempt to fetch the
7f561c08de6b Initial load
duke
parents:
diff changeset
   343
     * ressource identifier by the URI reference only if there is no byte
7f561c08de6b Initial load
duke
parents:
diff changeset
   344
     * stream or character stream specified).
7f561c08de6b Initial load
duke
parents:
diff changeset
   345
     * <br>If the application knows the character encoding of the object
7f561c08de6b Initial load
duke
parents:
diff changeset
   346
     * pointed to by the system identifier, it can register the encoding by
7f561c08de6b Initial load
duke
parents:
diff changeset
   347
     * setting the encoding attribute.
7f561c08de6b Initial load
duke
parents:
diff changeset
   348
     * <br>If the system ID is a relative URI reference (see section 5 in ),
7f561c08de6b Initial load
duke
parents:
diff changeset
   349
     * the behavior is implementation dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
   350
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   351
    public void setSystemId(String systemId){
7f561c08de6b Initial load
duke
parents:
diff changeset
   352
        fSystemId = systemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   353
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   354
7f561c08de6b Initial load
duke
parents:
diff changeset
   355
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   356
     *  The base URI to be used (see section 5.1.4 in ) for resolving relative
7f561c08de6b Initial load
duke
parents:
diff changeset
   357
     * URIs to absolute URIs. If the baseURI is itself a relative URI, the
7f561c08de6b Initial load
duke
parents:
diff changeset
   358
     * behavior is implementation dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
   359
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   360
    public String getBaseURI(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   361
        return fBaseSystemId;
7f561c08de6b Initial load
duke
parents:
diff changeset
   362
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   363
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   364
     *  The base URI to be used (see section 5.1.4 in ) for resolving relative
7f561c08de6b Initial load
duke
parents:
diff changeset
   365
     * URIs to absolute URIs. If the baseURI is itself a relative URI, the
7f561c08de6b Initial load
duke
parents:
diff changeset
   366
     * behavior is implementation dependent.
7f561c08de6b Initial load
duke
parents:
diff changeset
   367
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   368
    public void setBaseURI(String baseURI){
7f561c08de6b Initial load
duke
parents:
diff changeset
   369
        fBaseSystemId = baseURI;
7f561c08de6b Initial load
duke
parents:
diff changeset
   370
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   371
7f561c08de6b Initial load
duke
parents:
diff changeset
   372
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   373
      *  If set to true, assume that the input is certified (see section 2.13
7f561c08de6b Initial load
duke
parents:
diff changeset
   374
      * in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>]) when
7f561c08de6b Initial load
duke
parents:
diff changeset
   375
      * parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>].
7f561c08de6b Initial load
duke
parents:
diff changeset
   376
      */
7f561c08de6b Initial load
duke
parents:
diff changeset
   377
    public boolean getCertifiedText(){
7f561c08de6b Initial load
duke
parents:
diff changeset
   378
      return fCertifiedText;
7f561c08de6b Initial load
duke
parents:
diff changeset
   379
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   380
7f561c08de6b Initial load
duke
parents:
diff changeset
   381
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   382
      *  If set to true, assume that the input is certified (see section 2.13
7f561c08de6b Initial load
duke
parents:
diff changeset
   383
      * in [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>]) when
7f561c08de6b Initial load
duke
parents:
diff changeset
   384
      * parsing [<a href='http://www.w3.org/TR/2002/CR-xml11-20021015/'>XML 1.1</a>].
7f561c08de6b Initial load
duke
parents:
diff changeset
   385
      */
7f561c08de6b Initial load
duke
parents:
diff changeset
   386
7f561c08de6b Initial load
duke
parents:
diff changeset
   387
    public void setCertifiedText(boolean certifiedText){
7f561c08de6b Initial load
duke
parents:
diff changeset
   388
      fCertifiedText = certifiedText;
7f561c08de6b Initial load
duke
parents:
diff changeset
   389
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   390
7f561c08de6b Initial load
duke
parents:
diff changeset
   391
}// class DOMInputImpl