This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 18731
Collapse All | Expand All

(-)dom/DeferredDocumentImpl.java (-2 / +4 lines)
Lines 75-81 Link Here
75
 * which associates them with the Document within whose context they
75
 * which associates them with the Document within whose context they
76
 * were created.
76
 * were created.
77
 *
77
 *
78
 * @version $Id: DeferredDocumentImpl.java,v 1.38 2001/12/17 20:47:13 elena Exp $
78
 * @version $Id: DeferredDocumentImpl.java,v 1.39 2001/12/20 21:30:24 elena Exp $
79
 * @since  PR-DOM-Level-1-19980818.
79
 * @since  PR-DOM-Level-1-19980818.
80
 */
80
 */
81
public class DeferredDocumentImpl
81
public class DeferredDocumentImpl
Lines 1025-1031 Link Here
1025
            if (prevSib != -1 &&
1025
            if (prevSib != -1 &&
1026
                getNodeType(prevSib, false) == Node.TEXT_NODE) {
1026
                getNodeType(prevSib, false) == Node.TEXT_NODE) {
1027
                // append data that is stored in fNodeValue
1027
                // append data that is stored in fNodeValue
1028
                fBufferStr.append(value);                
1028
                // REVISIT: for text nodes it works differently than for CDATA
1029
                //          nodes.
1030
                fStrChunks.addElement(value);
1029
                do {
1031
                do {
1030
                    // go in reverse order: find last child, then
1032
                    // go in reverse order: find last child, then
1031
                    // its previous sibling, etc
1033
                    // its previous sibling, etc
(-)impl/XMLDTDScannerImpl.java (-6 / +26 lines)
Lines 102-108 Link Here
102
 * @author Glenn Marcy, IBM
102
 * @author Glenn Marcy, IBM
103
 * @author Eric Ye, IBM
103
 * @author Eric Ye, IBM
104
 *
104
 *
105
 * @version $Id: XMLDTDScannerImpl.java,v 1.11 2001/12/14 20:48:32 lmartin Exp $
105
 * @version $Id: XMLDTDScannerImpl.java,v 1.12 2002/01/02 20:35:14 elena Exp $
106
 */
106
 */
107
public class XMLDTDScannerImpl
107
public class XMLDTDScannerImpl
108
    extends XMLScanner
108
    extends XMLScanner
Lines 192-197 Link Here
192
    /** Parameter entity stack to check well-formedness. */
192
    /** Parameter entity stack to check well-formedness. */
193
    private int[] fPEStack = new int[5];
193
    private int[] fPEStack = new int[5];
194
194
195
196
    /** Parameter entity stack to report start/end entity calls. */
197
    private boolean[] fPEReport = new boolean[5];
198
195
    /** Number of opened parameter entities. */
199
    /** Number of opened parameter entities. */
196
    private int fPEDepth;
200
    private int fPEDepth;
197
201
Lines 457-463 Link Here
457
            fExtEntityDepth++;
461
            fExtEntityDepth++;
458
        }
462
        }
459
        else if (name.charAt(0) == '%') {
463
        else if (name.charAt(0) == '%') {
460
            pushPEStack(fMarkUpDepth);
464
            pushPEStack(fMarkUpDepth, fReportEntity);
461
            if (fEntityScanner.isExternal()) {
465
            if (fEntityScanner.isExternal()) {
462
                fExtEntityDepth++;
466
                fExtEntityDepth++;
463
            }
467
            }
Lines 483-488 Link Here
483
        // Handle end of PE
487
        // Handle end of PE
484
        boolean reportEntity = fReportEntity;
488
        boolean reportEntity = fReportEntity;
485
        if (name.startsWith("%")) {
489
        if (name.startsWith("%")) {
490
            reportEntity = peekReportEntity();
486
            // check well-formedness of the enity
491
            // check well-formedness of the enity
487
            int startMarkUpDepth = popPEStack();
492
            int startMarkUpDepth = popPEStack();
488
            if (startMarkUpDepth != fMarkUpDepth) {
493
            if (startMarkUpDepth != fMarkUpDepth) {
Lines 1649-1666 Link Here
1649
1654
1650
        fReportEntity = false;
1655
        fReportEntity = false;
1651
        skipSeparator(false, !scanningInternalSubset());
1656
        skipSeparator(false, !scanningInternalSubset());
1657
1652
        if (fEntityScanner.skipString("INCLUDE")) {
1658
        if (fEntityScanner.skipString("INCLUDE")) {
1653
            skipSeparator(false, !scanningInternalSubset());
1659
            skipSeparator(false, !scanningInternalSubset());
1654
            // call handler
1660
            // call handler
1661
            if (!fEntityScanner.skipChar('[')) {
1662
                reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
1663
            }
1664
1655
            if (fDTDHandler != null) {
1665
            if (fDTDHandler != null) {
1656
                fDTDHandler.startConditional(
1666
                fDTDHandler.startConditional(
1657
                                            XMLDTDHandler.CONDITIONAL_INCLUDE);
1667
                                            XMLDTDHandler.CONDITIONAL_INCLUDE);
1658
            }
1668
            }
1659
            if (!fEntityScanner.skipChar('[')) {
1660
                reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
1661
            }
1662
            fIncludeSectDepth++;
1669
            fIncludeSectDepth++;
1663
            // just stop there and go back to the main loop
1670
            // just stop there and go back to the main loop
1671
            fReportEntity = true;
1664
        }
1672
        }
1665
        else if (fEntityScanner.skipString("IGNORE")) {
1673
        else if (fEntityScanner.skipString("IGNORE")) {
1666
            skipSeparator(false, !scanningInternalSubset());
1674
            skipSeparator(false, !scanningInternalSubset());
Lines 1901-1917 Link Here
1901
    /*
1909
    /*
1902
     * Parameter Entity Stack
1910
     * Parameter Entity Stack
1903
     */
1911
     */
1904
    private final void pushPEStack(int depth) {
1912
    private final void pushPEStack(int depth, boolean report) {
1905
        if (fPEStack.length == fPEDepth) {
1913
        if (fPEStack.length == fPEDepth) {
1906
            int[] newIntStack = new int[fPEDepth * 2];
1914
            int[] newIntStack = new int[fPEDepth * 2];
1907
            System.arraycopy(fPEStack, 0, newIntStack, 0, fPEDepth);
1915
            System.arraycopy(fPEStack, 0, newIntStack, 0, fPEDepth);
1908
            fPEStack = newIntStack;
1916
            fPEStack = newIntStack;
1917
            // report end/start calls
1918
            boolean[] newBooleanStack = new boolean[fPEDepth * 2];
1919
            System.arraycopy(fPEReport, 0, newBooleanStack, 0, fPEDepth);
1920
            fPEReport = newBooleanStack;
1921
1909
        }
1922
        }
1923
        fPEReport[fPEDepth] = report;
1910
        fPEStack[fPEDepth++] = depth;
1924
        fPEStack[fPEDepth++] = depth;
1911
    }
1925
    }
1912
1926
1927
    /** pop the stack */
1913
    private final int popPEStack() {
1928
    private final int popPEStack() {
1914
        return fPEStack[--fPEDepth];
1929
        return fPEStack[--fPEDepth];
1930
    }
1931
1932
    /** look at the top of the stack */
1933
    private final boolean peekReportEntity() {
1934
        return fPEReport[fPEDepth-1];
1915
    }
1935
    }
1916
1936
1917
1937
(-)impl/XMLEntityManager.java (-36 / +107 lines)
Lines 71-76 Link Here
71
71
72
import org.apache.xerces.impl.XMLErrorReporter;
72
import org.apache.xerces.impl.XMLErrorReporter;
73
import org.apache.xerces.impl.io.ASCIIReader;
73
import org.apache.xerces.impl.io.ASCIIReader;
74
import org.apache.xerces.impl.io.UCSReader;
74
import org.apache.xerces.impl.io.UTF8Reader;
75
import org.apache.xerces.impl.io.UTF8Reader;
75
import org.apache.xerces.impl.msg.XMLMessageFormatter;
76
import org.apache.xerces.impl.msg.XMLMessageFormatter;
76
77
Lines 112-118 Link Here
112
 * @author Andy Clark, IBM
113
 * @author Andy Clark, IBM
113
 * @author Arnaud  Le Hors, IBM
114
 * @author Arnaud  Le Hors, IBM
114
 *
115
 *
115
 * @version $Id: XMLEntityManager.java,v 1.14 2001/12/17 16:41:12 neilg Exp $
116
 * @version $Id: XMLEntityManager.java,v 1.16 2002/01/04 23:27:49 neilg Exp $
116
 */
117
 */
117
public class XMLEntityManager
118
public class XMLEntityManager
118
    implements XMLComponent, XMLEntityResolver {
119
    implements XMLComponent, XMLEntityResolver {
Lines 703-708 Link Here
703
        final String systemId = xmlInputSource.getSystemId();
704
        final String systemId = xmlInputSource.getSystemId();
704
        String baseSystemId = xmlInputSource.getBaseSystemId();
705
        String baseSystemId = xmlInputSource.getBaseSystemId();
705
        String encoding = xmlInputSource.getEncoding();
706
        String encoding = xmlInputSource.getEncoding();
707
        Boolean isBigEndian = null;
706
708
707
        // create reader
709
        // create reader
708
        InputStream stream = null;
710
        InputStream stream = null;
Lines 728-734 Link Here
728
                    b4[count] = (byte)stream.read();
730
                    b4[count] = (byte)stream.read();
729
                }
731
                }
730
                if (count == 4) {
732
                if (count == 4) {
731
                    encoding = getEncodingName(b4, count);
733
                    Object [] encodingDesc = getEncodingName(b4, count);
734
                    encoding = (String)(encodingDesc[0]);
735
                    isBigEndian = (Boolean)(encodingDesc[1]);
732
736
733
                    // removed use of pushback inputstream--neilg
737
                    // removed use of pushback inputstream--neilg
734
                    /*****
738
                    /*****
Lines 765-782 Link Here
765
                    //          indirection to get at the underlying bytes. -Ac
769
                    //          indirection to get at the underlying bytes. -Ac
766
770
767
                    // create reader from input stream
771
                    // create reader from input stream
768
                    reader = createReader(new RewindableInputStream(pbstream), encoding);
772
                    reader = createReader(new RewindableInputStream(pbstream), encoding, isBigEndian);
769
                    ******/
773
                    ******/
770
                    reader = createReader(stream, encoding);
774
                    reader = createReader(stream, encoding, isBigEndian);
771
                }
775
                }
772
                else {
776
                else {
773
                    reader = createReader(stream, encoding);
777
                    reader = createReader(stream, encoding, isBigEndian);
774
                }
778
                }
775
            }
779
            }
776
780
777
            // use specified encoding
781
            // use specified encoding
778
            else {
782
            else {
779
                reader = createReader(stream, encoding);
783
                reader = createReader(stream, encoding, isBigEndian);
780
            }
784
            }
781
785
782
            // read one character at a time so we don't jump too far
786
            // read one character at a time so we don't jump too far
Lines 1136-1150 Link Here
1136
1140
1137
    /**
1141
    /**
1138
     * Returns the IANA encoding name that is auto-detected from
1142
     * Returns the IANA encoding name that is auto-detected from
1139
     * the bytes specified.
1143
     * the bytes specified, with the endian-ness of that encoding where appropriate.
1140
     *
1144
     *
1141
     * @param b4    The first four bytes of the input.
1145
     * @param b4    The first four bytes of the input.
1142
     * @param count The number of bytes actually read.
1146
     * @param count The number of bytes actually read.
1147
     * @return a 2-element array:  the first element, an IANA-encoding string, 
1148
     *  the second element a Boolean which is true iff the document is big endian, false
1149
     *  if it's little-endian, and null if the distinction isn't relevant.
1143
     */
1150
     */
1144
    protected String getEncodingName(byte[] b4, int count) {
1151
    protected Object[] getEncodingName(byte[] b4, int count) {
1145
1152
1146
        if (count < 2) {
1153
        if (count < 2) {
1147
            return "UTF-8";
1154
            return new Object[]{"UTF-8", null};
1148
        }
1155
        }
1149
1156
1150
        // UTF-16, with BOM
1157
        // UTF-16, with BOM
Lines 1152-1223 Link Here
1152
        int b1 = b4[1] & 0xFF;
1159
        int b1 = b4[1] & 0xFF;
1153
        if (b0 == 0xFE && b1 == 0xFF) {
1160
        if (b0 == 0xFE && b1 == 0xFF) {
1154
            // UTF-16, big-endian
1161
            // UTF-16, big-endian
1155
            return "UTF-16";
1162
            return new Object [] {"UTF-16BE", new Boolean(true)};
1156
        }
1163
        }
1157
        if (b0 == 0xFF && b1 == 0xFE) {
1164
        if (b0 == 0xFF && b1 == 0xFE) {
1158
            // UTF-16, little-endian
1165
            // UTF-16, little-endian
1159
            return "UTF-16";
1166
            return new Object [] {"UTF-16LE", new Boolean(false)};
1160
        }
1167
        }
1161
1168
1162
        // default to UTF-8 if we don't have enough bytes to make a
1169
        // default to UTF-8 if we don't have enough bytes to make a
1163
        // good determination of the encoding
1170
        // good determination of the encoding
1164
        if (count < 3) {
1171
        if (count < 3) {
1165
            return "UTF-8";
1172
            return new Object [] {"UTF-8", null};
1166
        }
1173
        }
1167
1174
1168
        // UTF-8 with a BOM
1175
        // UTF-8 with a BOM
1169
        int b2 = b4[2] & 0xFF;
1176
        int b2 = b4[2] & 0xFF;
1170
        if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) {
1177
        if (b0 == 0xEF && b1 == 0xBB && b2 == 0xBF) {
1171
            return "UTF-8";
1178
            return new Object [] {"UTF-8", null};
1172
        }
1179
        }
1173
1180
1174
        // default to UTF-8 if we don't have enough bytes to make a
1181
        // default to UTF-8 if we don't have enough bytes to make a
1175
        // good determination of the encoding
1182
        // good determination of the encoding
1176
        if (count < 4) {
1183
        if (count < 4) {
1177
            return "UTF-8";
1184
            return new Object [] {"UTF-8", null};
1178
        }
1185
        }
1179
1186
1180
        // other encodings
1187
        // other encodings
1181
        int b3 = b4[3] & 0xFF;
1188
        int b3 = b4[3] & 0xFF;
1182
        if (b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C) {
1189
        if (b0 == 0x00 && b1 == 0x00 && b2 == 0x00 && b3 == 0x3C) {
1183
            // UCS-4, big endian (1234)
1190
            // UCS-4, big endian (1234)
1184
            // REVISIT: What should this be?
1191
            return new Object [] {"ISO-10646-UCS-4", new Boolean(true)};
1185
            return "UnicodeBig";
1186
        }
1192
        }
1187
        if (b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00) {
1193
        if (b0 == 0x3C && b1 == 0x00 && b2 == 0x00 && b3 == 0x00) {
1188
            // UCS-4, little endian (4321)
1194
            // UCS-4, little endian (4321)
1189
            // REVISIT: What should this be?
1195
            return new Object [] {"ISO-10646-UCS-4", new Boolean(false)};
1190
            return "UnicodeLittleUnmarked";
1191
        }
1196
        }
1192
        if (b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00) {
1197
        if (b0 == 0x00 && b1 == 0x00 && b2 == 0x3C && b3 == 0x00) {
1193
            // UCS-4, unusual octet order (2143)
1198
            // UCS-4, unusual octet order (2143)
1194
            // REVISIT: What should this be?
1199
            // REVISIT: What should this be?
1195
            return "UnicodeBigUnmarked";
1200
            return new Object [] {"ISO-10646-UCS-4", null};
1196
        }
1201
        }
1197
        if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00) {
1202
        if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x00) {
1198
            // UCS-4, unusual octect order (3412)
1203
            // UCS-4, unusual octect order (3412)
1199
            // REVISIT: What should this be?
1204
            // REVISIT: What should this be?
1200
            return "UnicodeLittleUnmarked";
1205
            return new Object [] {"ISO-10646-UCS-4", null};
1201
        }
1206
        }
1202
        if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) {
1207
        if (b0 == 0x00 && b1 == 0x3C && b2 == 0x00 && b3 == 0x3F) {
1203
            // UTF-16, big-endian, no BOM
1208
            // UTF-16, big-endian, no BOM
1209
            // (or could turn out to be UCS-2...
1204
            // REVISIT: What should this be?
1210
            // REVISIT: What should this be?
1205
            return "UnicodeBig";
1211
            return new Object [] {"UTF-16BE", new Boolean(true)};
1206
        }
1212
        }
1207
        if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) {
1213
        if (b0 == 0x3C && b1 == 0x00 && b2 == 0x3F && b3 == 0x00) {
1208
            // UTF-16, little-endian, no BOM
1214
            // UTF-16, little-endian, no BOM
1209
            return "UnicodeLittle";
1215
            // (or could turn out to be UCS-2...
1216
            return new Object [] {"UTF-16LE", new Boolean(false)};
1210
        }
1217
        }
1211
        if (b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94) {
1218
        if (b0 == 0x4C && b1 == 0x6F && b2 == 0xA7 && b3 == 0x94) {
1212
            // EBCDIC
1219
            // EBCDIC
1213
            // a la xerces1, return CP037 instead of EBCDIC here
1220
            // a la xerces1, return CP037 instead of EBCDIC here
1214
            return "CP037";
1221
            return new Object [] {"CP037", null};
1215
        }
1222
        }
1216
1223
1217
        // default encoding
1224
        // default encoding
1218
        return "UTF-8";
1225
        return new Object [] {"UTF-8", null};
1219
1226
1220
    } // getEncodingName(byte[],int):String
1227
    } // getEncodingName(byte[],int):Object[]
1221
1228
1222
    /**
1229
    /**
1223
     * Creates a reader capable of reading the given input stream in
1230
     * Creates a reader capable of reading the given input stream in
Lines 1229-1238 Link Here
1229
     *                     Java encoding names are allowed, then the
1236
     *                     Java encoding names are allowed, then the
1230
     *                     encoding name may be a Java encoding name;
1237
     *                     encoding name may be a Java encoding name;
1231
     *                     otherwise, it is an ianaEncoding name.
1238
     *                     otherwise, it is an ianaEncoding name.
1239
     * @param isBigEndian   For encodings (like uCS-4), whose names cannot
1240
     *                      specify a byte order, this tells whether the order is bigEndian.  null menas 
1241
     *                      unknown or not relevant.
1232
     *
1242
     *
1233
     * @return Returns a reader.
1243
     * @return Returns a reader.
1234
     */
1244
     */
1235
    protected Reader createReader(InputStream inputStream, String encoding)
1245
    protected Reader createReader(InputStream inputStream, String encoding, Boolean isBigEndian)
1236
        throws IOException {
1246
        throws IOException {
1237
1247
1238
        // normalize encoding name
1248
        // normalize encoding name
Lines 1254-1259 Link Here
1254
            }
1264
            }
1255
            return new ASCIIReader(inputStream, fBufferSize);
1265
            return new ASCIIReader(inputStream, fBufferSize);
1256
        }
1266
        }
1267
        if(ENCODING.equals("ISO-10646-UCS-4")) {
1268
            if(isBigEndian != null) {
1269
                boolean isBE = isBigEndian.booleanValue();
1270
                if(isBE) {
1271
                    return new UCSReader(inputStream, UCSReader.UCS4BE);
1272
                } else {
1273
                    return new UCSReader(inputStream, UCSReader.UCS4LE);
1274
                }
1275
            } else {
1276
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
1277
                                       "EncodingByteOrderUnsupported",
1278
                                       new Object[] { encoding },
1279
                                       XMLErrorReporter.SEVERITY_FATAL_ERROR);
1280
            }
1281
        }
1282
        if(ENCODING.equals("ISO-10646-UCS-2")) {
1283
            if(isBigEndian != null) { // sould never happen with this encoding...
1284
                boolean isBE = isBigEndian.booleanValue();
1285
                if(isBE) {
1286
                    return new UCSReader(inputStream, UCSReader.UCS2BE);
1287
                } else {
1288
                    return new UCSReader(inputStream, UCSReader.UCS2LE);
1289
                }
1290
            } else {
1291
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
1292
                                       "EncodingByteOrderUnsupported",
1293
                                       new Object[] { encoding },
1294
                                       XMLErrorReporter.SEVERITY_FATAL_ERROR);
1295
            }
1296
        }
1257
1297
1258
        // check for valid name
1298
        // check for valid name
1259
        boolean validIANA = XMLChar.isValidIANAEncoding(encoding);
1299
        boolean validIANA = XMLChar.isValidIANAEncoding(encoding);
Lines 1277-1283 Link Here
1277
        // try to use a Java reader
1317
        // try to use a Java reader
1278
        String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING);
1318
        String javaEncoding = EncodingMap.getIANA2JavaMapping(ENCODING);
1279
        if (javaEncoding == null) {
1319
        if (javaEncoding == null) {
1320
            if(fAllowJavaEncodings) {
1280
            javaEncoding = encoding;
1321
            javaEncoding = encoding;
1322
            } else {
1323
                fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
1324
                                       "EncodingDeclInvalid",
1325
                                       new Object[] { encoding },
1326
                                       XMLErrorReporter.SEVERITY_FATAL_ERROR);
1327
                // see comment above.
1328
                javaEncoding = "ISO8859_1";
1329
            }
1281
        }
1330
        }
1282
        if (DEBUG_ENCODINGS) {
1331
        if (DEBUG_ENCODINGS) {
1283
            System.out.print("$$$ creating Java InputStreamReader: encoding="+javaEncoding);
1332
            System.out.print("$$$ creating Java InputStreamReader: encoding="+javaEncoding);
Lines 1288-1294 Link Here
1288
        }
1337
        }
1289
        return new InputStreamReader(inputStream, javaEncoding);
1338
        return new InputStreamReader(inputStream, javaEncoding);
1290
1339
1291
    } // createReader(InputStream,String):
1340
    } // createReader(InputStream,String, Boolean): Reader
1292
1341
1293
    //
1342
    //
1294
    // Protected static methods
1343
    // Protected static methods
Lines 1772-1777 Link Here
1772
                //       a single char! -Ac
1821
                //       a single char! -Ac
1773
                if (fCurrentEntity.encoding == null ||
1822
                if (fCurrentEntity.encoding == null ||
1774
                    !fCurrentEntity.encoding.equals(encoding)) {
1823
                    !fCurrentEntity.encoding.equals(encoding)) {
1824
                    // UTF-16 is a bit of a special case.  If the encoding is UTF-16,
1825
                    // and we know the endian-ness, we shouldn't change readers.
1826
                    // If it's ISO-10646-UCS-(2|4), then we'll have to deduce
1827
                    // the endian-ness from the encoding we presently have.
1828
                    if(fCurrentEntity.encoding != null && fCurrentEntity.encoding.startsWith("UTF-16")) {
1829
                        String ENCODING = encoding.toUpperCase();
1830
                        if(ENCODING.equals("UTF-16")) return;
1831
                        if(ENCODING.equals("ISO-10646-UCS-4")) {
1832
                            if(fCurrentEntity.encoding.equals("UTF-16BE")) {
1833
                                fCurrentEntity.reader = new UCSReader(fCurrentEntity.stream, UCSReader.UCS4BE);
1834
                            } else {
1835
                                fCurrentEntity.reader = new UCSReader(fCurrentEntity.stream, UCSReader.UCS4LE);
1836
                            }
1837
                            return;
1838
                        }
1839
                        if(ENCODING.equals("ISO-10646-UCS-2")) {
1840
                            if(fCurrentEntity.encoding.equals("UTF-16BE")) {
1841
                                fCurrentEntity.reader = new UCSReader(fCurrentEntity.stream, UCSReader.UCS2BE);
1842
                            } else {
1843
                                fCurrentEntity.reader = new UCSReader(fCurrentEntity.stream, UCSReader.UCS2LE);
1844
                            }
1845
                            return;
1846
                        }
1847
                    }
1775
                    // wrap a new reader around the input stream, changing
1848
                    // wrap a new reader around the input stream, changing
1776
                    // the encoding
1849
                    // the encoding
1777
                    if (DEBUG_ENCODINGS) {
1850
                    if (DEBUG_ENCODINGS) {
Lines 1779-1785 Link Here
1779
                                           fCurrentEntity.stream);
1852
                                           fCurrentEntity.stream);
1780
                    }
1853
                    }
1781
                    //fCurrentEntity.stream.reset();
1854
                    //fCurrentEntity.stream.reset();
1782
                    fCurrentEntity.reader = createReader(fCurrentEntity.stream, encoding);
1855
                    fCurrentEntity.reader = createReader(fCurrentEntity.stream, encoding, null);
1783
                } else {
1856
                } else {
1784
                    if (DEBUG_ENCODINGS) 
1857
                    if (DEBUG_ENCODINGS) 
1785
                        System.out.println("$$$ reusing old reader on stream");
1858
                        System.out.println("$$$ reusing old reader on stream");
Lines 3146-3155 Link Here
3146
        }
3219
        }
3147
    
3220
    
3148
        public int read() throws IOException {
3221
        public int read() throws IOException {
3149
            int b;
3222
            int b = 0;
3150
            if (fOffset < fLength) {
3223
            if (fOffset < fLength) {
3151
                System.err.println("REturned buffered:  " + (char)(fData[fOffset++] & 0xFF));
3224
                return fData[fOffset++] & 0xff;
3152
                return fData[fOffset++] & 0xFF;
3153
            }
3225
            }
3154
            if (fOffset == fEndOffset) {
3226
            if (fOffset == fEndOffset) {
3155
                return -1;
3227
                return -1;
Lines 3166-3172 Link Here
3166
            }
3238
            }
3167
            fData[fLength++] = (byte)b;
3239
            fData[fLength++] = (byte)b;
3168
            fOffset++;
3240
            fOffset++;
3169
            return b;
3241
            return b & 0xff;
3170
        }
3242
        }
3171
3243
3172
        public int read(byte[] b, int off, int len) throws IOException {
3244
        public int read(byte[] b, int off, int len) throws IOException {
Lines 3179-3191 Link Here
3179
                if(fCurrentEntity.mayReadChunks) {
3251
                if(fCurrentEntity.mayReadChunks) {
3180
                    return fInputStream.read(b, off, len);
3252
                    return fInputStream.read(b, off, len);
3181
                }
3253
                }
3182
                b[off] = (byte)read();
3254
                int returnedVal = read();
3183
                if(b[off] == -1) {
3255
                if(returnedVal == -1) {
3184
                    fEndOffset = fOffset;
3256
                    fEndOffset = fOffset;
3185
                    return -1;
3257
                    return -1;
3186
                }
3258
                }
3187
                byte [] c = new byte[off];
3259
                b[off] = (byte)returnedVal;
3188
                System.arraycopy(b,0,c,0,off);
3189
                return 1;
3260
                return 1;
3190
            }
3261
            }
3191
            if (len < bytesLeft) {
3262
            if (len < bytesLeft) {
(-)impl/dtd/XMLDTDValidator.java (-2 / +2 lines)
Lines 124-130 Link Here
124
 * @author Andy Clark, IBM
124
 * @author Andy Clark, IBM
125
 * @author Jeffrey Rodriguez IBM
125
 * @author Jeffrey Rodriguez IBM
126
 *
126
 *
127
 * @version $Id: XMLDTDValidator.java,v 1.5 2001/12/14 20:48:51 lmartin Exp $
127
 * @version $Id: XMLDTDValidator.java,v 1.6 2002/01/08 18:24:30 lmartin Exp $
128
 */
128
 */
129
public class XMLDTDValidator
129
public class XMLDTDValidator
130
implements XMLComponent, 
130
implements XMLComponent, 
Lines 2550-2556 Link Here
2550
                return attrDecl.simpleType.list ? fIDREFSSymbol : fIDREFSymbol;
2550
                return attrDecl.simpleType.list ? fIDREFSSymbol : fIDREFSymbol;
2551
            }
2551
            }
2552
        case XMLSimpleType.TYPE_NMTOKEN: {
2552
        case XMLSimpleType.TYPE_NMTOKEN: {
2553
                return attrDecl.simpleType.list ? fNMTOKENSSymbol : fNMTOKENSSymbol;
2553
                return attrDecl.simpleType.list ? fNMTOKENSSymbol : fNMTOKENSymbol;
2554
            }
2554
            }
2555
        case XMLSimpleType.TYPE_NOTATION: {
2555
        case XMLSimpleType.TYPE_NOTATION: {
2556
                return fNOTATIONSymbol;
2556
                return fNOTATIONSymbol;
(-)impl/dv/XSSimpleType.java (-7 / +35 lines)
Lines 69-75 Link Here
69
 *
69
 *
70
 * @author Sandy Gao, IBM
70
 * @author Sandy Gao, IBM
71
 *
71
 *
72
 * @version $Id: XSSimpleType.java,v 1.3 2001/12/06 23:11:55 sandygao Exp $
72
 * @version $Id: XSSimpleType.java,v 1.4 2002/01/04 19:52:38 sandygao Exp $
73
 */
73
 */
74
public interface XSSimpleType extends XSTypeDecl {
74
public interface XSSimpleType extends XSTypeDecl {
75
75
Lines 236-255 Link Here
236
     * REVISIT: this method makes ID special, which is not a good design.
236
     * REVISIT: this method makes ID special, which is not a good design.
237
     *          but since ID is not a primitive, there doesn't seem to be a
237
     *          but since ID is not a primitive, there doesn't seem to be a
238
     *          clean way of doing it except to define special method like this.
238
     *          clean way of doing it except to define special method like this.
239
     * 
240
     * @return  whether this simple type is or is derived from ID.
239
     */
241
     */
240
    public boolean isIDType();
242
    public boolean isIDType();
241
243
242
    /**
244
    /**
243
     * Check whether this type is or is derived from NOTATION.
245
     * Check whether this type is or is derived from NOTATION.
244
     * REVISIT: this method makes NOTATION special, which is not a good design.
246
     * REVISIT: this method makes NOTATION special, which is not a good design.
247
     * 
248
     * @return  whether this simple type is or is derived from NOTATION.
245
     */
249
     */
246
    public boolean isNOTATIONType();
250
    public boolean isNOTATIONType();
247
251
248
    // REVISIT: the following methods are for PSVI. they are not implemented yet.
252
    // REVISIT: it's not decided yet how to return the facets,
253
    //          as String's or as values (Object's).
249
    //public XSFacet[] getFacets();
254
    //public XSFacet[] getFacets();
250
    // the following four are for fundamental facets
255
    
251
    //public short getOrderedFacet();
256
    /**
252
    //public boolean isBounded();
257
     * Return the value of the "ordered" fundamental facet.
253
    //public boolean isNumeric();
258
     * 
254
    //public short getCardinalityFacet();
259
     * @return  a constant corresponding to the "ordered" facet.
260
     */
261
    public short getOrderedFacet();
262
    
263
    /**
264
     * Return the value of the "bounded" fundamental facet.
265
     * 
266
     * @return  whether the this type is bounded.
267
     */
268
    public boolean isBounded();
269
    
270
    /**
271
     * Return the value of the "numeric" fundamental facet.
272
     * 
273
     * @return  whether the this type is numeric.
274
     */
275
    public boolean isNumeric();
276
    
277
    /**
278
     * Return the value of the "cardinality" fundamental facet.
279
     * 
280
     * @return  a constant corresponding to the "cardinality" facet.
281
     */
282
    public short getCardinalityFacet();
255
}
283
}
(-)impl/dv/xs_new/AnyURIDV.java (-4 / +11 lines)
Lines 67-76 Link Here
67
 * @author Neeraj Bajaj, Sun Microsystems, inc.
67
 * @author Neeraj Bajaj, Sun Microsystems, inc.
68
 * @author Sandy Gao, IBM
68
 * @author Sandy Gao, IBM
69
 *
69
 *
70
 * @version $Id: AnyURIDV.java,v 1.1 2001/11/19 20:13:01 sandygao Exp $
70
 * @version $Id: AnyURIDV.java,v 1.2 2002/01/03 20:14:13 sandygao Exp $
71
 */
71
 */
72
public class AnyURIDV extends TypeValidator {
72
public class AnyURIDV extends TypeValidator {
73
73
74
    private static URI BASE_URI = null;
75
    static {
76
        try {
77
            BASE_URI = new URI("http://www.template.com");
78
        } catch (URI.MalformedURIException ex) {
79
        }
80
    }
81
74
    public short getAllowedFacets(){
82
    public short getAllowedFacets(){
75
        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
83
        return (XSSimpleTypeDecl.FACET_LENGTH | XSSimpleTypeDecl.FACET_MINLENGTH | XSSimpleTypeDecl.FACET_MAXLENGTH | XSSimpleTypeDecl.FACET_PATTERN | XSSimpleTypeDecl.FACET_ENUMERATION | XSSimpleTypeDecl.FACET_WHITESPACE );
76
    }
84
    }
Lines 81-93 Link Here
81
        // check 3.2.17.c0 must: URI (rfc 2396/2723)
89
        // check 3.2.17.c0 must: URI (rfc 2396/2723)
82
        try {
90
        try {
83
            if( content.length() != 0 ) {
91
            if( content.length() != 0 ) {
84
                URI tempURI = new URI("http://www.template.com");
85
                // Support for relative URLs
92
                // Support for relative URLs
86
                // According to Java 1.1: URLs may also be specified with a
93
                // According to Java 1.1: URLs may also be specified with a
87
                // String and the URL object that it is related to.
94
                // String and the URL object that it is related to.
88
                new URI(tempURI, content );
95
                new URI(BASE_URI, content );
89
            }
96
            }
90
        } catch (  URI.MalformedURIException ex ) {
97
        } catch (URI.MalformedURIException ex) {
91
            throw new InvalidDatatypeValueException("Value '"+content+"' is a Malformed URI");
98
            throw new InvalidDatatypeValueException("Value '"+content+"' is a Malformed URI");
92
        }
99
        }
93
100
(-)impl/dv/xs_new/MonthDV.java (-1 / +7 lines)
Lines 66-72 Link Here
66
 * @author Elena Litani
66
 * @author Elena Litani
67
 * @author Gopal Sharma, SUN Microsystem Inc.
67
 * @author Gopal Sharma, SUN Microsystem Inc.
68
 *
68
 *
69
 * @version $Id: MonthDV.java,v 1.3 2001/11/30 19:29:22 sandygao Exp $
69
 * @version $Id: MonthDV.java,v 1.4 2002/01/04 19:52:38 sandygao Exp $
70
 */
70
 */
71
71
72
public class MonthDV extends AbstractDateTimeDV {
72
public class MonthDV extends AbstractDateTimeDV {
Lines 96-101 Link Here
96
     */
96
     */
97
    protected int[] parse(String str, int[] date) throws SchemaDateTimeException{
97
    protected int[] parse(String str, int[] date) throws SchemaDateTimeException{
98
98
99
        //REVISIT: change --MM-- to --MM
99
        resetBuffer(str);
100
        resetBuffer(str);
100
101
101
        //create structure to hold an object
102
        //create structure to hold an object
Lines 136-141 Link Here
136
137
137
    /**
138
    /**
138
     * Overwrite compare algorithm to optimize month comparison
139
     * Overwrite compare algorithm to optimize month comparison
140
     *
141
     * REVISIT: this one is lack of the third parameter: boolean strict, so it
142
     *          doesn't override the method in the base. But maybe this method
143
     *          is not correctly implemented, and I did encounter errors when
144
     *          trying to add the extra parameter. I'm leaving it as is. -SG
139
     *
145
     *
140
     * @param date1
146
     * @param date1
141
     * @param date2
147
     * @param date2
(-)impl/dv/xs_new/SchemaDVFactoryImpl.java (-23 / +23 lines)
Lines 71-77 Link Here
71
 * @author Neeraj Bajaj, Sun Microsystems, inc.
71
 * @author Neeraj Bajaj, Sun Microsystems, inc.
72
 * @author Sandy Gao, IBM
72
 * @author Sandy Gao, IBM
73
 *
73
 *
74
 * @version $Id: SchemaDVFactoryImpl.java,v 1.2 2001/11/28 17:54:52 sandygao Exp $
74
 * @version $Id: SchemaDVFactoryImpl.java,v 1.3 2002/01/04 19:52:38 sandygao Exp $
75
 */
75
 */
76
public class SchemaDVFactoryImpl extends SchemaDVFactory {
76
public class SchemaDVFactoryImpl extends SchemaDVFactory {
77
77
Lines 228-250 Link Here
228
        //REVISIT: passing "anyType" here.
228
        //REVISIT: passing "anyType" here.
229
        XSSimpleTypeDecl anySimpleType = XSSimpleTypeDecl.fAnySimpleType;
229
        XSSimpleTypeDecl anySimpleType = XSSimpleTypeDecl.fAnySimpleType;
230
        fBuiltInTypes.put(ANYSIMPLETYPE, anySimpleType);
230
        fBuiltInTypes.put(ANYSIMPLETYPE, anySimpleType);
231
        XSSimpleTypeDecl stringDV = new XSSimpleTypeDecl(anySimpleType, STRING, XSSimpleTypeDecl.DV_STRING);
231
        XSSimpleTypeDecl stringDV = new XSSimpleTypeDecl(anySimpleType, STRING, XSSimpleTypeDecl.DV_STRING, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false );
232
        fBuiltInTypes.put(STRING, stringDV);
232
        fBuiltInTypes.put(STRING, stringDV);
233
        fBuiltInTypes.put(BOOLEAN, new XSSimpleTypeDecl(anySimpleType, STRING, XSSimpleTypeDecl.DV_BOOLEAN));
233
        fBuiltInTypes.put(BOOLEAN, new XSSimpleTypeDecl(anySimpleType, STRING, XSSimpleTypeDecl.DV_BOOLEAN, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_FINITE, false));
234
        XSSimpleTypeDecl decimalDV = new XSSimpleTypeDecl(anySimpleType, DECIMAL, XSSimpleTypeDecl.DV_DECIMAL);
234
        XSSimpleTypeDecl decimalDV = new XSSimpleTypeDecl(anySimpleType, DECIMAL, XSSimpleTypeDecl.DV_DECIMAL, XSSimpleType.ORDERED_TOTAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, true);
235
        fBuiltInTypes.put(DECIMAL, decimalDV);
235
        fBuiltInTypes.put(DECIMAL, decimalDV);
236
236
237
        fBuiltInTypes.put(ANYURI, new XSSimpleTypeDecl(anySimpleType, ANYURI, XSSimpleTypeDecl.DV_ANYURI));
237
        fBuiltInTypes.put(ANYURI, new XSSimpleTypeDecl(anySimpleType, ANYURI, XSSimpleTypeDecl.DV_ANYURI, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
238
        fBuiltInTypes.put(BASE64BINARY, new XSSimpleTypeDecl(anySimpleType, BASE64BINARY, XSSimpleTypeDecl.DV_BASE64BINARY));
238
        fBuiltInTypes.put(BASE64BINARY, new XSSimpleTypeDecl(anySimpleType, BASE64BINARY, XSSimpleTypeDecl.DV_BASE64BINARY, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
239
        fBuiltInTypes.put(DURATION, new XSSimpleTypeDecl(anySimpleType, DURATION, XSSimpleTypeDecl.DV_DURATION));
239
        fBuiltInTypes.put(DURATION, new XSSimpleTypeDecl(anySimpleType, DURATION, XSSimpleTypeDecl.DV_DURATION, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
240
        fBuiltInTypes.put(DATETIME, new XSSimpleTypeDecl(anySimpleType, DATETIME, XSSimpleTypeDecl.DV_DATETIME));
240
        fBuiltInTypes.put(DATETIME, new XSSimpleTypeDecl(anySimpleType, DATETIME, XSSimpleTypeDecl.DV_DATETIME, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
241
        fBuiltInTypes.put(TIME, new XSSimpleTypeDecl(anySimpleType, TIME, XSSimpleTypeDecl.DV_TIME));
241
        fBuiltInTypes.put(TIME, new XSSimpleTypeDecl(anySimpleType, TIME, XSSimpleTypeDecl.DV_TIME, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
242
        fBuiltInTypes.put(DATE, new XSSimpleTypeDecl(anySimpleType, DATE, XSSimpleTypeDecl.DV_DATE));
242
        fBuiltInTypes.put(DATE, new XSSimpleTypeDecl(anySimpleType, DATE, XSSimpleTypeDecl.DV_DATE, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
243
        fBuiltInTypes.put(YEARMONTH, new XSSimpleTypeDecl(anySimpleType, YEARMONTH, XSSimpleTypeDecl.DV_GYEARMONTH));
243
        fBuiltInTypes.put(YEARMONTH, new XSSimpleTypeDecl(anySimpleType, YEARMONTH, XSSimpleTypeDecl.DV_GYEARMONTH, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
244
        fBuiltInTypes.put(YEAR, new XSSimpleTypeDecl(anySimpleType, YEAR, XSSimpleTypeDecl.DV_GYEAR));
244
        fBuiltInTypes.put(YEAR, new XSSimpleTypeDecl(anySimpleType, YEAR, XSSimpleTypeDecl.DV_GYEAR, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
245
        fBuiltInTypes.put(MONTHDAY, new XSSimpleTypeDecl(anySimpleType, MONTHDAY, XSSimpleTypeDecl.DV_GMONTHDAY));
245
        fBuiltInTypes.put(MONTHDAY, new XSSimpleTypeDecl(anySimpleType, MONTHDAY, XSSimpleTypeDecl.DV_GMONTHDAY, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
246
        fBuiltInTypes.put(DAY, new XSSimpleTypeDecl(anySimpleType, DAY, XSSimpleTypeDecl.DV_GDAY));
246
        fBuiltInTypes.put(DAY, new XSSimpleTypeDecl(anySimpleType, DAY, XSSimpleTypeDecl.DV_GDAY, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
247
        fBuiltInTypes.put(MONTH, new XSSimpleTypeDecl(anySimpleType, MONTH, XSSimpleTypeDecl.DV_GMONTH));
247
        fBuiltInTypes.put(MONTH, new XSSimpleTypeDecl(anySimpleType, MONTH, XSSimpleTypeDecl.DV_GMONTH, XSSimpleType.ORDERED_PARTIAL, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
248
248
249
        facets.fractionDigits = 0;
249
        facets.fractionDigits = 0;
250
        XSSimpleTypeDecl integerDV = new XSSimpleTypeDecl(decimalDV, INTEGER, URI_SCHEMAFORSCHEMA, (short)0);
250
        XSSimpleTypeDecl integerDV = new XSSimpleTypeDecl(decimalDV, INTEGER, URI_SCHEMAFORSCHEMA, (short)0);
Lines 317-326 Link Here
317
        fBuiltInTypes.put(POSITIVEINTEGER, positiveIntegerDV);
317
        fBuiltInTypes.put(POSITIVEINTEGER, positiveIntegerDV);
318
318
319
319
320
        fBuiltInTypes.put(FLOAT, new XSSimpleTypeDecl(anySimpleType, FLOAT, XSSimpleTypeDecl.DV_FLOAT));
320
        fBuiltInTypes.put(FLOAT, new XSSimpleTypeDecl(anySimpleType, FLOAT, XSSimpleTypeDecl.DV_FLOAT, XSSimpleType.ORDERED_TOTAL, true, XSSimpleType.CARDINALITY_FINITE, true));
321
        fBuiltInTypes.put(DOUBLE, new XSSimpleTypeDecl(anySimpleType, DOUBLE, XSSimpleTypeDecl.DV_DOUBLE));
321
        fBuiltInTypes.put(DOUBLE, new XSSimpleTypeDecl(anySimpleType, DOUBLE, XSSimpleTypeDecl.DV_DOUBLE, XSSimpleType.ORDERED_TOTAL, true, XSSimpleType.CARDINALITY_FINITE, true));
322
        fBuiltInTypes.put(HEXBINARY, new XSSimpleTypeDecl(anySimpleType, HEXBINARY, XSSimpleTypeDecl.DV_HEXBINARY));
322
        fBuiltInTypes.put(HEXBINARY, new XSSimpleTypeDecl(anySimpleType, HEXBINARY, XSSimpleTypeDecl.DV_HEXBINARY, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
323
        fBuiltInTypes.put(NOTATION, new XSSimpleTypeDecl(anySimpleType, NOTATION, XSSimpleTypeDecl.DV_NOTATION));
323
        fBuiltInTypes.put(NOTATION, new XSSimpleTypeDecl(anySimpleType, NOTATION, XSSimpleTypeDecl.DV_NOTATION, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
324
324
325
325
326
        facets.whiteSpace =  XSSimpleType.WS_REPLACE;
326
        facets.whiteSpace =  XSSimpleType.WS_REPLACE;
Lines 350-359 Link Here
350
        ncnameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_TOKEN_NCNAME);
350
        ncnameDV.applyFacets1(facets, XSSimpleType.FACET_WHITESPACE, (short)0, XSSimpleTypeDecl.SPECIAL_TOKEN_NCNAME);
351
        fBuiltInTypes.put(NCNAME, ncnameDV);
351
        fBuiltInTypes.put(NCNAME, ncnameDV);
352
352
353
        fBuiltInTypes.put(QNAME, new XSSimpleTypeDecl(anySimpleType, QNAME, XSSimpleTypeDecl.DV_QNAME));
353
        fBuiltInTypes.put(QNAME, new XSSimpleTypeDecl(anySimpleType, QNAME, XSSimpleTypeDecl.DV_QNAME, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false));
354
354
355
        fBuiltInTypes.put(ID, new XSSimpleTypeDecl(ncnameDV,  ID , XSSimpleTypeDecl.DV_ID ));
355
        fBuiltInTypes.put(ID, new XSSimpleTypeDecl(ncnameDV,  ID, XSSimpleTypeDecl.DV_ID, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false ));
356
        XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV,  IDREF , XSSimpleTypeDecl.DV_IDREF);
356
        XSSimpleTypeDecl idrefDV = new XSSimpleTypeDecl(ncnameDV,  IDREF , XSSimpleTypeDecl.DV_IDREF, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false);
357
        fBuiltInTypes.put(IDREF, idrefDV);
357
        fBuiltInTypes.put(IDREF, idrefDV);
358
358
359
        facets.minLength = 1;
359
        facets.minLength = 1;
Lines 362-368 Link Here
362
        idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
362
        idrefsDV.applyFacets1(facets, XSSimpleType.FACET_MINLENGTH, (short)0);
363
        fBuiltInTypes.put(IDREFS, idrefsDV);
363
        fBuiltInTypes.put(IDREFS, idrefsDV);
364
364
365
        XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY);
365
        XSSimpleTypeDecl entityDV = new XSSimpleTypeDecl(ncnameDV, ENTITY , XSSimpleTypeDecl.DV_ENTITY, XSSimpleType.ORDERED_FALSE, false, XSSimpleType.CARDINALITY_COUNTABLY_INFINITE, false);
366
        fBuiltInTypes.put(ENTITY, entityDV);
366
        fBuiltInTypes.put(ENTITY, entityDV);
367
367
368
        facets.minLength = 1;
368
        facets.minLength = 1;
(-)impl/dv/xs_new/XSSimpleTypeDecl.java (-12 / +225 lines)
Lines 77-83 Link Here
77
 * @author Sandy Gao, IBM
77
 * @author Sandy Gao, IBM
78
 * @author Neeraj Bajaj, Sun Microsystems, inc.
78
 * @author Neeraj Bajaj, Sun Microsystems, inc.
79
 *
79
 *
80
 * @version $Id: XSSimpleTypeDecl.java,v 1.3 2001/11/30 19:29:22 sandygao Exp $
80
 * @version $Id: XSSimpleTypeDecl.java,v 1.4 2002/01/04 19:52:38 sandygao Exp $
81
 */
81
 */
82
class XSSimpleTypeDecl implements XSAtomicSimpleType, XSListSimpleType, XSUnionSimpleType {
82
class XSSimpleTypeDecl implements XSAtomicSimpleType, XSListSimpleType, XSUnionSimpleType {
83
83
Lines 148-154 Link Here
148
        "preserve", "collapse", "replace",
148
        "preserve", "collapse", "replace",
149
    };
149
    };
150
150
151
    //private short fPrimitiveDV = -1;
152
    private XSSimpleTypeDecl fItemType;
151
    private XSSimpleTypeDecl fItemType;
153
    private XSSimpleTypeDecl[] fMemberTypes;
152
    private XSSimpleTypeDecl[] fMemberTypes;
154
153
Lines 162-174 Link Here
162
    private short fFacetsDefined = 0;
161
    private short fFacetsDefined = 0;
163
    private short fFixedFacet = 0;
162
    private short fFixedFacet = 0;
164
163
164
    //for constraining facets
165
    private short fWhiteSpace = 0;
165
    private short fWhiteSpace = 0;
166
    private int fLength = -1;
166
    private int fLength = -1;
167
    private int fMinLength = -1;
167
    private int fMinLength = -1;
168
    private int fMaxLength = -1;
168
    private int fMaxLength = -1;
169
    private int fTotalDigits = -1;
169
    private int fTotalDigits = -1;
170
    private int fFractionDigits = -1;
170
    private int fFractionDigits = -1;
171
    private short fTokenType = SPECIAL_TOKEN_NONE;
172
    private Vector fPattern;
171
    private Vector fPattern;
173
    private Vector fEnumeration;
172
    private Vector fEnumeration;
174
    private Object fMaxInclusive;
173
    private Object fMaxInclusive;
Lines 176-192 Link Here
176
    private Object fMinExclusive;
175
    private Object fMinExclusive;
177
    private Object fMinInclusive;
176
    private Object fMinInclusive;
178
177
178
    private short fTokenType = SPECIAL_TOKEN_NONE;
179
180
    // for fundamental facets
181
    private short fOrdered;
182
    private short fCardinality;
183
    private boolean fBounded;
184
    private boolean fNumeric;
185
179
    private ValidatedInfo fTempInfo = new ValidatedInfo();
186
    private ValidatedInfo fTempInfo = new ValidatedInfo();
180
187
181
    //Create a new built-in primitive types (and id/idref/entity)
188
    //Create a new built-in primitive types (and id/idref/entity)
182
    protected XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, short validateDV) {
189
    protected XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, short validateDV,
190
                               short ordered, boolean bounded,
191
                               short cardinality, boolean numeric) {
183
        fBase = base;
192
        fBase = base;
184
        fTypeName = name;
193
        fTypeName = name;
185
        fTargetNamespace = SchemaDVFactoryImpl.URI_SCHEMAFORSCHEMA;
194
        fTargetNamespace = SchemaDVFactoryImpl.URI_SCHEMAFORSCHEMA;
186
        fVariety = VARIETY_ATOMIC;
195
        fVariety = VARIETY_ATOMIC;
187
        //fPrimitiveDV = validateDV;
188
        //if (validateDV == DV_ID || validateDV == DV_IDREF || validateDV == DV_ENTITY)
189
        //    fPrimitiveDV = DV_STRING;
190
        fValidationDV = validateDV;
196
        fValidationDV = validateDV;
191
        fFacetsDefined = FACET_WHITESPACE;
197
        fFacetsDefined = FACET_WHITESPACE;
192
        if (validateDV == DV_STRING) {
198
        if (validateDV == DV_STRING) {
Lines 208-214 Link Here
208
        fValidationDV = fBase.fValidationDV;
214
        fValidationDV = fBase.fValidationDV;
209
        switch (fVariety) {
215
        switch (fVariety) {
210
        case VARIETY_ATOMIC:
216
        case VARIETY_ATOMIC:
211
            //fPrimitiveDV = fBase.fPrimitiveDV;
212
            break;
217
            break;
213
        case VARIETY_LIST:
218
        case VARIETY_LIST:
214
            fItemType = fBase.fItemType;
219
            fItemType = fBase.fItemType;
Lines 235-240 Link Here
235
        fTokenType = fBase.fTokenType;
240
        fTokenType = fBase.fTokenType;
236
        fFixedFacet = fBase.fFixedFacet;
241
        fFixedFacet = fBase.fFixedFacet;
237
        fFacetsDefined = fBase.fFacetsDefined;
242
        fFacetsDefined = fBase.fFacetsDefined;
243
244
        //we also set fundamental facets information in case applyFacets is not called.
245
        caclFundamentalFacets();
238
    }
246
    }
239
247
240
    //Create a new simple type for list.
248
    //Create a new simple type for list.
Lines 250-255 Link Here
250
        fFacetsDefined = FACET_WHITESPACE;
258
        fFacetsDefined = FACET_WHITESPACE;
251
        fFixedFacet = FACET_WHITESPACE;
259
        fFixedFacet = FACET_WHITESPACE;
252
        fWhiteSpace = WS_COLLAPSE;
260
        fWhiteSpace = WS_COLLAPSE;
261
262
        //setting fundamental facets
263
        caclFundamentalFacets();
253
    }
264
    }
254
265
255
    //Create a new simple type for union.
266
    //Create a new simple type for union.
Lines 268-273 Link Here
268
        // if fFacetsDefined != 0
279
        // if fFacetsDefined != 0
269
        fFacetsDefined = FACET_WHITESPACE;
280
        fFacetsDefined = FACET_WHITESPACE;
270
        fWhiteSpace = WS_COLLAPSE;
281
        fWhiteSpace = WS_COLLAPSE;
282
283
        //setting fundamental facets
284
        caclFundamentalFacets();
271
    }
285
    }
272
286
273
    public short getXSType () {
287
    public short getXSType () {
Lines 1009-1017 Link Here
1009
        // step 5: mark fixed values
1023
        // step 5: mark fixed values
1010
        fFixedFacet |= fBase.fFixedFacet;
1024
        fFixedFacet |= fBase.fFixedFacet;
1011
1025
1012
        //inherit baseBuiltInTypeName.
1026
        //step 6: setting fundamental facets
1027
        caclFundamentalFacets();
1013
1028
1014
    } //init4Restriction()
1029
    } //applyFacets()
1015
1030
1016
    /**
1031
    /**
1017
     * validate a value, and return the compiled form
1032
     * validate a value, and return the compiled form
Lines 1273-1279 Link Here
1273
                    regex = (RegularExpression)fPattern.elementAt(idx);
1288
                    regex = (RegularExpression)fPattern.elementAt(idx);
1274
                    if (!regex.matches(nvalue)){
1289
                    if (!regex.matches(nvalue)){
1275
                        throw new InvalidDatatypeValueException("Value '"+content+
1290
                        throw new InvalidDatatypeValueException("Value '"+content+
1276
                                                                "' does not match regular expression facet '" + fPattern + "'" );
1291
                                                                "' does not match regular expression facet '" + regex + "'" );
1277
                    }
1292
                    }
1278
                }
1293
                }
1279
            }
1294
            }
Lines 1442-1447 Link Here
1442
        }
1457
        }
1443
    }
1458
    }
1444
1459
1445
    static final XSSimpleTypeDecl fAnySimpleType = new XSSimpleTypeDecl(null, "anySimpleType", DV_ANYSIMPLETYPE);
1460
    public short getOrderedFacet() {
1461
        return fOrdered;
1462
    }
1463
1464
    public boolean isBounded(){
1465
        return fBounded;
1466
    }
1467
1468
    public short getCardinalityFacet(){
1469
        return fCardinality;
1470
    }
1471
1472
    public boolean isNumeric(){
1473
        return fNumeric;
1474
    }
1475
1476
    private void caclFundamentalFacets() {
1477
        setOrdered();
1478
        setNumeric();
1479
        setBounded();
1480
        setCardinality();
1481
    }
1482
1483
    private void setOrdered(){
1484
1485
        // When {variety} is atomic, {value} is inherited from {value} of {base type definition}. For all ·primitive· types {value} is as specified in the table in Fundamental Facets (C.1).
1486
        if(fVariety == VARIETY_ATOMIC){
1487
            this.fOrdered = fBase.fOrdered;
1488
        }
1489
1490
        // When {variety} is list, {value} is false.
1491
        else if(fVariety == VARIETY_LIST){
1492
            this.fOrdered = ORDERED_FALSE;
1493
        }
1494
1495
        // When {variety} is union, the {value} is partial unless one of the following:
1496
        // 1. If every member of {member type definitions} is derived from a common ancestor other than the simple ur-type, then {value} is the same as that ancestor's ordered facet.
1497
        // 2. If every member of {member type definitions} has a {value} of false for the ordered facet, then {value} is false.
1498
        else if(fVariety == VARIETY_UNION){
1499
            int length = fMemberTypes.length;
1500
            // REVISIT: is the length possible to be 0?
1501
            if (length == 0) {
1502
                this.fOrdered = ORDERED_PARTIAL;
1503
                return;
1504
            }
1505
            // we need to process the first member type before entering the loop
1506
            short ancestorId = getPrimitiveDV(fMemberTypes[0].fValidationDV);
1507
            boolean commonAnc = ancestorId != DV_ANYSIMPLETYPE;
1508
            boolean allFalse = fMemberTypes[0].fOrdered == ORDERED_FALSE;
1509
            // for the other member types, check whether the value is false
1510
            // and whether they have the same ancestor as the first one
1511
            for (int i = 1; i < fMemberTypes.length && (commonAnc || allFalse); i++) {
1512
                if (commonAnc)
1513
                    commonAnc = ancestorId == getPrimitiveDV(fMemberTypes[i].fValidationDV);
1514
                if (allFalse)
1515
                    allFalse = fMemberTypes[i].fOrdered == ORDERED_FALSE;
1516
            }
1517
            if (commonAnc) {
1518
                // REVISIT: all member types should have the same ordered value
1519
                //          just use the first one. Can we assume this?
1520
                this.fOrdered = fMemberTypes[0].fOrdered;
1521
            } else if (allFalse) {
1522
                this.fOrdered = ORDERED_FALSE;
1523
            } else {
1524
                this.fOrdered = ORDERED_PARTIAL;
1525
            }
1526
        }
1527
1528
    }//setOrdered
1529
1530
    private void setNumeric(){
1531
        if(fVariety == VARIETY_ATOMIC){
1532
            this.fNumeric = fBase.fNumeric;
1533
        }
1534
        else if(fVariety == VARIETY_LIST){
1535
            this.fNumeric = false;
1536
        }
1537
        else if(fVariety == VARIETY_UNION){
1538
            XSSimpleType [] memberTypes = this.getMemberTypes();
1539
            for(int i = 0 ; i < memberTypes.length ; i++){
1540
                if( ! memberTypes[i].isNumeric() ){
1541
                    this.fNumeric = false;
1542
                    return;
1543
                }
1544
            }
1545
            this.fNumeric = true;
1546
        }
1547
1548
    }//setNumeric
1549
1550
    private void setBounded(){
1551
        if(fVariety == VARIETY_ATOMIC){
1552
            if( (((this.fFacetsDefined & FACET_MININCLUSIVE) != 0)  || ((this.fFacetsDefined & FACET_MINEXCLUSIVE) != 0))
1553
                &&  (((this.fFacetsDefined & FACET_MAXINCLUSIVE) != 0)  || ((this.fFacetsDefined & FACET_MAXEXCLUSIVE) != 0)) ){
1554
                this.fBounded = true;
1555
            }
1556
            else{
1557
                this.fBounded = false;
1558
            }
1559
        }
1560
        else if(fVariety == VARIETY_LIST){
1561
            if( ((this.fFacetsDefined & FACET_LENGTH) != 0 ) || ( ((this.fFacetsDefined & FACET_MINLENGTH) != 0 )
1562
                                                            &&  ((this.fFacetsDefined & FACET_MAXLENGTH) != 0 )) ){
1563
                this.fBounded = true;
1564
            }
1565
            else{
1566
                this.fBounded = false;
1567
            }
1568
1569
        }
1570
        else if(fVariety == VARIETY_UNION){
1571
1572
            XSSimpleTypeDecl [] memberTypes = this.fMemberTypes;
1573
            short ancestorId = 0 ;
1574
1575
            if(memberTypes.length > 0){
1576
                ancestorId = getPrimitiveDV(memberTypes[0].fValidationDV);
1577
            }
1578
1579
            for(int i = 0 ; i < memberTypes.length ; i++){
1580
                if( ! memberTypes[i].isBounded() || (ancestorId != getPrimitiveDV(memberTypes[i].fValidationDV)) ){
1581
                    this.fBounded = false;
1582
                    return;
1583
                }
1584
            }
1585
            this.fBounded = true;
1586
        }
1587
1588
    }//setBounded
1589
1590
    private boolean specialCardinalityCheck(){
1591
        if( (fBase.fValidationDV == XSSimpleTypeDecl.DV_DATE) || (fBase.fValidationDV == XSSimpleTypeDecl.DV_GYEARMONTH)
1592
            || (fBase.fValidationDV == XSSimpleTypeDecl.DV_GYEAR) || (fBase.fValidationDV == XSSimpleTypeDecl.DV_GMONTHDAY)
1593
            || (fBase.fValidationDV == XSSimpleTypeDecl.DV_GDAY) || (fBase.fValidationDV == XSSimpleTypeDecl.DV_GMONTH) ){
1594
            return true;
1595
        }
1596
        return false;
1597
1598
    } //specialCardinalityCheck()
1599
1600
    private void setCardinality(){
1601
        if(fVariety == VARIETY_ATOMIC){
1602
            if(fBase.fCardinality == CARDINALITY_FINITE){
1603
                this.fCardinality = CARDINALITY_FINITE;
1604
            }
1605
            else {// (fBase.fCardinality == CARDINALITY_COUNTABLY_INFINITE)
1606
                if ( ((this.fFacetsDefined & FACET_LENGTH) != 0 ) || ((this.fFacetsDefined & FACET_MAXLENGTH) != 0 )
1607
                     || ((this.fFacetsDefined & FACET_TOTALDIGITS) != 0 ) ){
1608
                    this.fCardinality = CARDINALITY_FINITE;
1609
                }
1610
                else if( (((this.fFacetsDefined & FACET_MININCLUSIVE) != 0 ) || ((this.fFacetsDefined & FACET_MINEXCLUSIVE) != 0 ))
1611
                        && (((this.fFacetsDefined & FACET_MAXINCLUSIVE) != 0 ) || ((this.fFacetsDefined & FACET_MAXEXCLUSIVE) != 0 )) ){
1612
                    if( ((this.fFacetsDefined & FACET_FRACTIONDIGITS) != 0 ) || specialCardinalityCheck()){
1613
                        this.fCardinality = CARDINALITY_FINITE;
1614
                    }
1615
                    else{
1616
                        this.fCardinality = CARDINALITY_COUNTABLY_INFINITE;
1617
                    }
1618
                }
1619
                else{
1620
                    this.fCardinality = CARDINALITY_COUNTABLY_INFINITE;
1621
                }
1622
            }
1623
        }
1624
        else if(fVariety == VARIETY_LIST){
1625
            if( ((this.fFacetsDefined & FACET_LENGTH) != 0 ) || ( ((this.fFacetsDefined & FACET_MINLENGTH) != 0 )
1626
                                                            && ((this.fFacetsDefined & FACET_MAXLENGTH) != 0 )) ){
1627
                this.fCardinality = CARDINALITY_FINITE;
1628
            }
1629
            else{
1630
                this.fCardinality = CARDINALITY_COUNTABLY_INFINITE;
1631
            }
1632
1633
        }
1634
        else if(fVariety == VARIETY_UNION){
1635
            XSSimpleType [] memberTypes = this.getMemberTypes();
1636
            for(int i = 0 ; i < memberTypes.length ; i++){
1637
                if( ! (memberTypes[i].getCardinalityFacet() == CARDINALITY_FINITE) ){
1638
                    this.fCardinality = CARDINALITY_COUNTABLY_INFINITE;
1639
                    return;
1640
                }
1641
            }
1642
            this.fCardinality = CARDINALITY_FINITE;
1643
        }
1644
1645
    }//setCardinality
1646
1647
    private short getPrimitiveDV(short validationDV){
1648
1649
        if (validationDV == DV_ID || validationDV == DV_IDREF || validationDV == DV_ENTITY){
1650
            return DV_STRING;
1651
        }
1652
        else{
1653
            return validationDV;
1654
        }
1655
1656
    }//getPrimitiveDV()
1657
1658
    static final XSSimpleTypeDecl fAnySimpleType = new XSSimpleTypeDecl(null, "anySimpleType", DV_ANYSIMPLETYPE, ORDERED_FALSE, false, CARDINALITY_FINITE, false);
1446
1659
1447
} // class XSComplexTypeDecl
1660
} // class XSComplexTypeDecl
(-)impl/msg/XMLMessages.properties (+1 lines)
Lines 111-116 Link Here
111
        PINotInOneEntity = The processing instruction must be entirely contained within the same parsed entity.
111
        PINotInOneEntity = The processing instruction must be entirely contained within the same parsed entity.
112
# 4.3.3 Character Encoding in Entities
112
# 4.3.3 Character Encoding in Entities
113
        EncodingDeclInvalid = Invalid encoding name \"{0}\".
113
        EncodingDeclInvalid = Invalid encoding name \"{0}\".
114
        EncodingByteOrderUnsupported = Given byte order for encoding \"{0}\" is not supported.
114
	
115
	
115
# DTD Messages
116
# DTD Messages
116
# 2.2 Characters
117
# 2.2 Characters
(-)impl/msg/XMLSchemaMessages.properties (-1 / +7 lines)
Lines 193-198 Link Here
193
        src-redefine.6.1.1 = src-redefine.6.1.1:  if a group child of a <redefine> element contains a group ref'ing itself, it must have exactly 1; this one has ''{0}''.
193
        src-redefine.6.1.1 = src-redefine.6.1.1:  if a group child of a <redefine> element contains a group ref'ing itself, it must have exactly 1; this one has ''{0}''.
194
        src-redefine.6.1.2 = src-redefine.6.1.2:  the group ''{0}'' which contains a reference to a group being redefined must have minOccurs = maxOccurs = 1.
194
        src-redefine.6.1.2 = src-redefine.6.1.2:  the group ''{0}'' which contains a reference to a group being redefined must have minOccurs = maxOccurs = 1.
195
        src-redefine.6.2.1 = src-redefine.6.2.1: no group in the redefined schema with a name matching ''{0}''.
195
        src-redefine.6.2.1 = src-redefine.6.2.1: no group in the redefined schema with a name matching ''{0}''.
196
        src-redefine.6.2.2 = src-redefine.6.2.2: group ''{0}'' does not properly restrict the group it redefines; constraint violated:  ''{1}''.
196
        src-redefine.7.1 = src-redefine.7.1:  if an attributeGroup child of a <redefine> element contains an attributeGroup ref'ing itself, it must have exactly 1; this one has ''{0}''.
197
        src-redefine.7.1 = src-redefine.7.1:  if an attributeGroup child of a <redefine> element contains an attributeGroup ref'ing itself, it must have exactly 1; this one has ''{0}''.
197
        src-redefine.7.2.1 = src-redefine.7.2.1: no attributeGroup in the redefined schema with a name matching ''{0}''.
198
        src-redefine.7.2.1 = src-redefine.7.2.1: no attributeGroup in the redefined schema with a name matching ''{0}''.
198
        src-redefine.7.2.2 = src-redefine.7.2.2: attributeGroup ''{0}'' does not properly restrict the attributeGroup it redefines; constraint violated:  ''{1}''.
199
        src-redefine.7.2.2 = src-redefine.7.2.2: attributeGroup ''{0}'' does not properly restrict the attributeGroup it redefines; constraint violated:  ''{1}''.
Lines 320-326 Link Here
320
        rcase-RecurseUnordered.2 = rcase-RecurseUnordered.2: There is not a complete functional mapping between the particles.  
321
        rcase-RecurseUnordered.2 = rcase-RecurseUnordered.2: There is not a complete functional mapping between the particles.  
321
        sch-props-correct.1 = sch-props-correct.1: schema components of type ''{0}'' cannot occur after declarations or are not permitted as children of a <schema> element.
322
        sch-props-correct.1 = sch-props-correct.1: schema components of type ''{0}'' cannot occur after declarations or are not permitted as children of a <schema> element.
322
        sch-props-correct.2 = sch-props-correct.2: a schema cannot contain two global components with the same name; this one contains two occurrences of ''{0}''.
323
        sch-props-correct.2 = sch-props-correct.2: a schema cannot contain two global components with the same name; this one contains two occurrences of ''{0}''.
323
        st-props-correct = st-props-correct: error.
324
        st-props-correct.1 = st-props-correct.1: error.
325
        st-props-correct.2 = st-props-correct.2: circular definitions detected for type ''{0}''.
326
        st-props-correct.3 = st-props-correct.3: {final} of the {base type definition} contains restriction.
327
        st-props-correct.4.1 = st-props-correct.4.1: The type definition is not a valid restriction with repect to the base type ''{0}''.
328
        st-props-correct.4.2.1 = st-props-correct.4.2.1: {final} of the {base type definition} contains list.
329
        st-props-correct.4.2.2 = st-props-correct.4.2.2: {final} of the {base type definition} contains union.
324
        totalDigits-valid-restriction = totalDigits-valid-restriction: error.
330
        totalDigits-valid-restriction = totalDigits-valid-restriction: error.
325
        whiteSpace-valid-restriction = whiteSpace-valid-restriction: error.
331
        whiteSpace-valid-restriction = whiteSpace-valid-restriction: error.
326
        w-props-correct = w-props-correct: error.
332
        w-props-correct = w-props-correct: error.
(-)impl/xs/SchemaGrammar.java (-1 / +34 lines)
Lines 79-85 Link Here
79
 * @author Sandy Gao, IBM
79
 * @author Sandy Gao, IBM
80
 * @author Elena Litani, IBM
80
 * @author Elena Litani, IBM
81
 *
81
 *
82
 * @version $Id: SchemaGrammar.java,v 1.6 2001/12/06 21:49:36 neilg Exp $
82
 * @version $Id: SchemaGrammar.java,v 1.8 2002/01/07 20:02:59 neilg Exp $
83
 */
83
 */
84
84
85
public class SchemaGrammar  extends Grammar {
85
public class SchemaGrammar  extends Grammar {
Lines 280-285 Link Here
280
    private int fCTCount = 0;
280
    private int fCTCount = 0;
281
    private XSComplexTypeDecl[] fComplexTypeDecls = new XSComplexTypeDecl[INITIAL_SIZE];
281
    private XSComplexTypeDecl[] fComplexTypeDecls = new XSComplexTypeDecl[INITIAL_SIZE];
282
282
283
    // an array to store groups being redefined by restriction
284
    // even-numbered elements are the derived groups, odd-numbered ones their bases
285
    private static final int REDEFINED_GROUP_INIT_SIZE = 2; 
286
    private int fRGCount = 0;
287
    private XSGroupDecl[] fRedefinedGroupDecls = new XSGroupDecl[REDEFINED_GROUP_INIT_SIZE];
288
283
    // a flag to indicate whether we have checked the 3 constraints on this
289
    // a flag to indicate whether we have checked the 3 constraints on this
284
    // grammar.
290
    // grammar.
285
    boolean fFullChecked = false;
291
    boolean fFullChecked = false;
Lines 294-299 Link Here
294
    }
300
    }
295
301
296
    /**
302
    /**
303
     * add a group redefined by restriction: for later constraint checking
304
     */
305
    public final void addRedefinedGroupDecl(XSGroupDecl derived, XSGroupDecl base) {
306
        if (fRGCount == fRedefinedGroupDecls.length)
307
            // double array size each time.
308
            fRedefinedGroupDecls = resize(fRedefinedGroupDecls, fRGCount << 1);
309
        fRedefinedGroupDecls[fRGCount++] = derived;
310
        fRedefinedGroupDecls[fRGCount++] = base;
311
    }
312
313
    /**
297
     * get all complex type decls: for later constraint checking
314
     * get all complex type decls: for later constraint checking
298
     */
315
     */
299
    final XSComplexTypeDecl[] getUncheckedComplexTypeDecls() {
316
    final XSComplexTypeDecl[] getUncheckedComplexTypeDecls() {
Lines 303-308 Link Here
303
    }
320
    }
304
321
305
    /**
322
    /**
323
     * get all redefined groups: for later constraint checking
324
     */
325
    final XSGroupDecl[] getRedefinedGroupDecls() {
326
        if (fRGCount < fRedefinedGroupDecls.length)
327
            fRedefinedGroupDecls = resize(fRedefinedGroupDecls, fRGCount);
328
        return fRedefinedGroupDecls;
329
    }
330
331
332
    /**
306
     * after the first-round checking, some types don't need to be checked
333
     * after the first-round checking, some types don't need to be checked
307
     * against UPA again. here we trim the array to the proper size.
334
     * against UPA again. here we trim the array to the proper size.
308
     */
335
     */
Lines 352-357 Link Here
352
379
353
    static final XSComplexTypeDecl[] resize(XSComplexTypeDecl[] oldArray, int newSize) {
380
    static final XSComplexTypeDecl[] resize(XSComplexTypeDecl[] oldArray, int newSize) {
354
        XSComplexTypeDecl[] newArray = new XSComplexTypeDecl[newSize];
381
        XSComplexTypeDecl[] newArray = new XSComplexTypeDecl[newSize];
382
        System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));
383
        return newArray;
384
    }
385
386
    static final XSGroupDecl[] resize(XSGroupDecl[] oldArray, int newSize) {
387
        XSGroupDecl[] newArray = new XSGroupDecl[newSize];
355
        System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));
388
        System.arraycopy(oldArray, 0, newArray, 0, Math.min(oldArray.length, newSize));
356
        return newArray;
389
        return newArray;
357
    }
390
    }
(-)impl/xs/XSConstraints.java (-1 / +36 lines)
Lines 73-79 Link Here
73
 *
73
 *
74
 * @author Sandy Gao, IBM
74
 * @author Sandy Gao, IBM
75
 *
75
 *
76
 * @version $Id: XSConstraints.java,v 1.12 2001/12/05 16:36:42 lmartin Exp $
76
 * @version $Id: XSConstraints.java,v 1.13 2002/01/07 19:03:17 neilg Exp $
77
 */
77
 */
78
public class XSConstraints {
78
public class XSConstraints {
79
79
Lines 316-321 Link Here
316
        SchemaGrammar[] grammars = grammarResolver.getGrammars();
316
        SchemaGrammar[] grammars = grammarResolver.getGrammars();
317
        for (int i = grammars.length-1; i >= 0; i--) {
317
        for (int i = grammars.length-1; i >= 0; i--) {
318
            SGHandler.addSubstitutionGroup(grammars[i].getSubstitutionGroups());
318
            SGHandler.addSubstitutionGroup(grammars[i].getSubstitutionGroups());
319
        }
320
321
        // before worrying about complexTypes, let's get
322
        // groups redefined by restriction out of the way.
323
        for (int g = grammars.length-1; g >= 0; g--) {
324
            XSGroupDecl [] redefinedGroups = grammars[g].getRedefinedGroupDecls();
325
            for(int i=0; i<redefinedGroups.length; ) {
326
                XSGroupDecl derivedGrp = redefinedGroups[i++];
327
                XSParticleDecl derivedParticle = derivedGrp.fParticle;
328
                XSGroupDecl baseGrp = redefinedGroups[i++];
329
                XSParticleDecl baseParticle = baseGrp.fParticle;
330
                if(baseParticle == null) {
331
                    if(derivedParticle != null) { // can't be a restriction!
332
                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
333
                                        "src-redefine.6.2.2",
334
                                        new Object[]{derivedGrp.fName, "rcase-Recurse.2"},
335
                                        XMLErrorReporter.SEVERITY_ERROR);
336
                    } 
337
                } else {
338
                    try {
339
                        particleValidRestriction(SGHandler, 
340
                            derivedParticle, baseParticle);
341
                    } catch (XMLSchemaException e) {
342
                        String key = e.getKey();
343
                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
344
                                        key,
345
                                        e.getArgs(),
346
                                        XMLErrorReporter.SEVERITY_ERROR);
347
                        errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
348
                                        "src-redefine.6.2.2",
349
                                        new Object[]{derivedGrp.fName, key},
350
                                        XMLErrorReporter.SEVERITY_ERROR);
351
                    }
352
                }
353
            }
319
        }
354
        }
320
355
321
        // for each complex type, check the 3 constraints.
356
        // for each complex type, check the 3 constraints.
(-)impl/xs/XSGroupDecl.java (-2 / +2 lines)
Lines 62-68 Link Here
62
 * schema component is a global <group> element information item
62
 * schema component is a global <group> element information item
63
 *
63
 *
64
 * @author Sandy Gao, IBM
64
 * @author Sandy Gao, IBM
65
 * @version $Id: XSGroupDecl.java,v 1.1 2001/10/25 20:36:02 elena Exp $
65
 * @version $Id: XSGroupDecl.java,v 1.2 2002/01/07 20:02:59 neilg Exp $
66
 */
66
 */
67
public class XSGroupDecl {
67
public class XSGroupDecl {
68
68
Lines 73-76 Link Here
73
    // particle of the group
73
    // particle of the group
74
    public XSParticleDecl fParticle = null;
74
    public XSParticleDecl fParticle = null;
75
75
76
} // class XSWildcardDecl
76
} // class XSGroupDecl
(-)impl/xs/traversers/XSDElementTraverser.java (-1 / +4 lines)
Lines 98-104 Link Here
98
 *
98
 *
99
 * @author Sandy Gao, IBM
99
 * @author Sandy Gao, IBM
100
 *
100
 *
101
 * @version $Id: XSDElementTraverser.java,v 1.9 2001/12/14 20:04:16 sandygao Exp $
101
 * @version $Id: XSDElementTraverser.java,v 1.10 2001/12/20 16:45:51 sandygao Exp $
102
 */
102
 */
103
class XSDElementTraverser extends XSDAbstractTraverser {
103
class XSDElementTraverser extends XSDAbstractTraverser {
104
104
Lines 359-364 Link Here
359
359
360
                if (childName.equals(SchemaSymbols.ELT_KEY) ||
360
                if (childName.equals(SchemaSymbols.ELT_KEY) ||
361
                        childName.equals(SchemaSymbols.ELT_UNIQUE)) {
361
                        childName.equals(SchemaSymbols.ELT_UNIQUE)) {
362
                    // need to set <key>/<unique> to hidden before traversing it,
363
                    // because it has global scope
364
                    DOMUtil.setHidden(child);
362
                    fSchemaHandler.fUniqueOrKeyTraverser.traverse(child, element, schemaDoc, grammar);
365
                    fSchemaHandler.fUniqueOrKeyTraverser.traverse(child, element, schemaDoc, grammar);
363
                    if(DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME).length() != 0 ) {
366
                    if(DOMUtil.getAttrValue(child, SchemaSymbols.ATT_NAME).length() != 0 ) {
364
                        fSchemaHandler.checkForDuplicateNames(
367
                        fSchemaHandler.checkForDuplicateNames(
(-)impl/xs/traversers/XSDGroupTraverser.java (-1 / +12 lines)
Lines 78-84 Link Here
78
 * @author Rahul Srivastava, Sun Microsystems Inc.
78
 * @author Rahul Srivastava, Sun Microsystems Inc.
79
 * @author Elena Litani, IBM
79
 * @author Elena Litani, IBM
80
 * @author Lisa Martin,  IBM
80
 * @author Lisa Martin,  IBM
81
 * @version $Id: XSDGroupTraverser.java,v 1.1 2001/10/25 20:36:04 elena Exp $
81
 * @version $Id: XSDGroupTraverser.java,v 1.2 2002/01/07 19:03:17 neilg Exp $
82
 */
82
 */
83
class  XSDGroupTraverser extends XSDAbstractParticleTraverser {
83
class  XSDGroupTraverser extends XSDAbstractParticleTraverser {
84
84
Lines 205-210 Link Here
205
                group.fTargetNamespace = schemaDoc.fTargetNamespace;
205
                group.fTargetNamespace = schemaDoc.fTargetNamespace;
206
                group.fParticle = particle;
206
                group.fParticle = particle;
207
                grammar.addGlobalGroupDecl(group);
207
                grammar.addGlobalGroupDecl(group);
208
            }
209
        }
210
        if(group != null) { 
211
            // store groups redefined by restriction in the grammar so
212
            // that we can get at them at full-schema-checking time.
213
            Object redefinedGrp = fSchemaHandler.getGrpOrAttrGrpRedefinedByRestriction(XSDHandler.GROUP_TYPE,
214
                new QName(fSchemaHandler.EMPTY_STRING, strNameAttr, strNameAttr, schemaDoc.fTargetNamespace),
215
                schemaDoc);
216
            if(redefinedGrp != null) {
217
                // store in grammar
218
                grammar.addRedefinedGroupDecl(group, (XSGroupDecl)redefinedGrp);
208
            }
219
            }
209
        }
220
        }
210
221
(-)impl/xs/traversers/XSDHandler.java (-6 / +27 lines)
Lines 97-103 Link Here
97
 * schema, other grammars may be constructed as a side-effect.
97
 * schema, other grammars may be constructed as a side-effect.
98
 *
98
 *
99
 * @author Neil Graham, IBM
99
 * @author Neil Graham, IBM
100
 * @version $Id: XSDHandler.java,v 1.7 2001/12/10 23:30:16 sandygao Exp $
100
 * @version $Id: XSDHandler.java,v 1.10 2002/01/07 20:02:37 neilg Exp $
101
 */
101
 */
102
102
103
public class XSDHandler {
103
public class XSDHandler {
Lines 344-350 Link Here
344
                                     String schemaHint) {
344
                                     String schemaHint) {
345
345
346
        // first phase:  construct trees.
346
        // first phase:  construct trees.
347
        Document schemaRoot = getSchema(schemaNamespace, schemaHint, null, true);
347
        Document schemaRoot = getSchema(schemaNamespace, schemaHint, null, true, true);
348
        if (schemaRoot == null) {
348
        if (schemaRoot == null) {
349
            // something went wrong right off the hop
349
            // something went wrong right off the hop
350
            reportGenericSchemaError("Could not locate a schema document corresponding to grammar " + schemaNamespace);
350
            reportGenericSchemaError("Could not locate a schema document corresponding to grammar " + schemaNamespace);
Lines 443-449 Link Here
443
                fAttributeChecker.returnAttrArray(includeAttrs, currSchemaInfo);
443
                fAttributeChecker.returnAttrArray(includeAttrs, currSchemaInfo);
444
                // consciously throw away whether was a duplicate; don't care.
444
                // consciously throw away whether was a duplicate; don't care.
445
                // pass the systemId of the current document as the base systemId
445
                // pass the systemId of the current document as the base systemId
446
                newSchemaRoot = getSchema(schemaNamespace, schemaHint, (String)fDoc2SystemId.get(schemaRoot), true);
446
                newSchemaRoot = getSchema(schemaNamespace, schemaHint, (String)fDoc2SystemId.get(schemaRoot), false, true);
447
            }
447
            }
448
            else if ((localName.equals(SchemaSymbols.ELT_INCLUDE)) ||
448
            else if ((localName.equals(SchemaSymbols.ELT_INCLUDE)) ||
449
                     (localName.equals(SchemaSymbols.ELT_REDEFINE))) {
449
                     (localName.equals(SchemaSymbols.ELT_REDEFINE))) {
Lines 457-463 Link Here
457
                if (schemaHint == null)
457
                if (schemaHint == null)
458
                    reportGenericSchemaError("schemaLocation attribute must appear in <include> and <redefine>");
458
                    reportGenericSchemaError("schemaLocation attribute must appear in <include> and <redefine>");
459
                // pass the systemId of the current document as the base systemId
459
                // pass the systemId of the current document as the base systemId
460
                newSchemaRoot = getSchema(null, schemaHint, (String)fDoc2SystemId.get(schemaRoot), false);
460
                boolean mustResolve = false;
461
                if(localName.equals(SchemaSymbols.ELT_REDEFINE)) {
462
                    mustResolve = nonAnnotationContent(child);
463
                }
464
                newSchemaRoot = getSchema(null, schemaHint, (String)fDoc2SystemId.get(schemaRoot), mustResolve, false);
461
                schemaNamespace = currSchemaInfo.fTargetNamespace;
465
                schemaNamespace = currSchemaInfo.fTargetNamespace;
462
            }
466
            }
463
            else {
467
            else {
Lines 966-971 Link Here
966
            keyrefSchemaDoc.fNamespaceSupport.makeGlobal();
970
            keyrefSchemaDoc.fNamespaceSupport.makeGlobal();
967
            keyrefSchemaDoc.fNamespaceSupport.setEffectiveContext( fKeyrefNamespaceContext[i] );
971
            keyrefSchemaDoc.fNamespaceSupport.setEffectiveContext( fKeyrefNamespaceContext[i] );
968
            SchemaGrammar keyrefGrammar = fGrammarResolver.getGrammar(keyrefSchemaDoc.fTargetNamespace);
972
            SchemaGrammar keyrefGrammar = fGrammarResolver.getGrammar(keyrefSchemaDoc.fTargetNamespace);
973
            // need to set <keyref> to hidden before traversing it,
974
            // because it has global scope
975
            DOMUtil.setHidden(fKeyrefs[i]);
969
            fKeyrefTraverser.traverse(fKeyrefs[i], fKeyrefElems[i], keyrefSchemaDoc, keyrefGrammar);
976
            fKeyrefTraverser.traverse(fKeyrefs[i], fKeyrefElems[i], keyrefSchemaDoc, keyrefGrammar);
970
        }
977
        }
971
    } // end resolveKeyRefs
978
    } // end resolveKeyRefs
Lines 1012-1018 Link Here
1012
    // otherwise.  schemaDoc is null if and only if no schema document
1019
    // otherwise.  schemaDoc is null if and only if no schema document
1013
    // was resolved to.
1020
    // was resolved to.
1014
    private Document getSchema(String schemaNamespace, String schemaHint,
1021
    private Document getSchema(String schemaNamespace, String schemaHint,
1015
                               String baseSystemId, boolean useProperties) {
1022
                               String baseSystemId, boolean mustResolve, boolean useProperties) {
1016
        // contents of this method will depend on the system we adopt for entity resolution--i.e., XMLEntityHandler, EntityHandler, etc.
1023
        // contents of this method will depend on the system we adopt for entity resolution--i.e., XMLEntityHandler, EntityHandler, etc.
1017
        XMLInputSource schemaSource=null;
1024
        XMLInputSource schemaSource=null;
1018
        Document schemaDoc = null;
1025
        Document schemaDoc = null;
Lines 1061-1066 Link Here
1061
            fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
1068
            fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
1062
                                       "General",
1069
                                       "General",
1063
                                       new Object[]{"file not found: " + schemaHint},
1070
                                       new Object[]{"file not found: " + schemaHint},
1071
                                       // when using namespace, then hint is optional,
1072
                                       // and it's not an error if the file is not found
1073
                                       // but if not using namespace (include),
1074
                                       // it's a warning if the file is not found.
1075
                                       mustResolve ?
1076
                                       XMLErrorReporter.SEVERITY_ERROR: 
1064
                                       XMLErrorReporter.SEVERITY_WARNING);
1077
                                       XMLErrorReporter.SEVERITY_WARNING);
1065
        }
1078
        }
1066
        catch (IOException ex) {
1079
        catch (IOException ex) {
Lines 1071-1077 Link Here
1071
        schemaDoc = null;
1084
        schemaDoc = null;
1072
        fLastSchemaWasDuplicate = false;
1085
        fLastSchemaWasDuplicate = false;
1073
        return null;
1086
        return null;
1074
    } // getSchema(String, String):  Document
1087
    } // getSchema(String, String, String, boolean, boolean):  Document
1075
1088
1076
    // initialize all the traversers.
1089
    // initialize all the traversers.
1077
    // this should only need to be called once during the construction
1090
    // this should only need to be called once during the construction
Lines 1550-1555 Link Here
1550
        return null;
1563
        return null;
1551
        **********/
1564
        **********/
1552
    } // findXSDocumentForDecl(XSDocumentInfo, Element):  XSDocumentInfo
1565
    } // findXSDocumentForDecl(XSDocumentInfo, Element):  XSDocumentInfo
1566
1567
    // returns whether more than <annotation>s occur in children of elem
1568
    private boolean nonAnnotationContent(Element elem) {
1569
        for(Element child = DOMUtil.getFirstChildElement(elem); child != null; child = DOMUtil.getNextSiblingElement(child)) {
1570
            if(!(DOMUtil.getLocalName(child).equals(SchemaSymbols.ELT_ANNOTATION))) return true;
1571
        }
1572
        return false;
1573
    } // nonAnnotationContent(Element):  boolean
1553
1574
1554
    private void setSchemasVisible(XSDocumentInfo startSchema) {
1575
    private void setSchemasVisible(XSDocumentInfo startSchema) {
1555
        if (DOMUtil.isHidden(startSchema.fSchemaDoc)) {
1576
        if (DOMUtil.isHidden(startSchema.fSchemaDoc)) {
(-)impl/xs/traversers/XSDSimpleTypeTraverser.java (-11 / +15 lines)
Lines 65-70 Link Here
65
import org.apache.xerces.impl.XMLErrorReporter;
65
import org.apache.xerces.impl.XMLErrorReporter;
66
import org.apache.xerces.impl.xs.SchemaGrammar;
66
import org.apache.xerces.impl.xs.SchemaGrammar;
67
import org.apache.xerces.impl.xs.SchemaSymbols;
67
import org.apache.xerces.impl.xs.SchemaSymbols;
68
import org.apache.xerces.impl.xs.XSTypeDecl;
68
69
69
import org.apache.xerces.util.DOMUtil;
70
import org.apache.xerces.util.DOMUtil;
70
import org.apache.xerces.impl.xs.util.XInt;
71
import org.apache.xerces.impl.xs.util.XInt;
Lines 115-121 Link Here
115
 *
116
 *
116
 * @author Elena Litani, IBM
117
 * @author Elena Litani, IBM
117
 * @author Neeraj Bajaj, Sun Microsystems, Inc.
118
 * @author Neeraj Bajaj, Sun Microsystems, Inc.
118
 * @version $Id: XSDSimpleTypeTraverser.java,v 1.5 2001/12/14 20:04:16 sandygao Exp $
119
 * @version $Id: XSDSimpleTypeTraverser.java,v 1.6 2002/01/03 20:59:43 sandygao Exp $
119
 */
120
 */
120
class XSDSimpleTypeTraverser extends XSDAbstractTraverser {
121
class XSDSimpleTypeTraverser extends XSDAbstractTraverser {
121
122
Lines 297-309 Link Here
297
                if (baseValidator == null) {
298
                if (baseValidator == null) {
298
                    Object[] args = {content.getAttribute( SchemaSymbols.ATT_BASE )};
299
                    Object[] args = {content.getAttribute( SchemaSymbols.ATT_BASE )};
299
                    reportSchemaError("dt-unknown-basetype", args);
300
                    reportSchemaError("dt-unknown-basetype", args);
300
                    return (XSSimpleType)SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYSIMPLETYPE);
301
                    return SchemaGrammar.fAnySimpleType;
301
                }
302
                }
302
            }
303
            }
303
            else {
304
            else {
304
                Object[] args = { simpleTypeDecl.getAttribute( SchemaSymbols.ATT_NAME )};
305
                Object[] args = { simpleTypeDecl.getAttribute( SchemaSymbols.ATT_NAME )};
305
                reportSchemaError("dt-simpleType",new Object[]{SchemaSymbols.ELT_SIMPLETYPE, nameProperty, "(annotation?, (restriction | list | union))"});
306
                reportSchemaError("dt-simpleType",new Object[]{SchemaSymbols.ELT_SIMPLETYPE, nameProperty, "(annotation?, (restriction | list | union))"});
306
                return (XSSimpleType)SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYSIMPLETYPE);
307
                return SchemaGrammar.fAnySimpleType;
307
            }
308
            }
308
        }
309
        }
309
        else {
310
        else {
Lines 328-334 Link Here
328
                if (baseValidator == null) {
329
                if (baseValidator == null) {
329
                    Object[] args = { content.getAttribute( SchemaSymbols.ATT_BASE ), nameProperty};
330
                    Object[] args = { content.getAttribute( SchemaSymbols.ATT_BASE ), nameProperty};
330
                    reportSchemaError("dt-unknown-basetype", args);
331
                    reportSchemaError("dt-unknown-basetype", args);
331
                    baseValidator = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYSIMPLETYPE);
332
                    baseValidator = SchemaGrammar.fAnySimpleType;
332
                }
333
                }
333
                // ------------------------------
334
                // ------------------------------
334
                // (variety is list)cos-list-of-atomic
335
                // (variety is list)cos-list-of-atomic
Lines 417-423 Link Here
417
                if (baseValidator == null) {
418
                if (baseValidator == null) {
418
                    Object[] args = { content.getAttribute( SchemaSymbols.ATT_BASE ), nameProperty};
419
                    Object[] args = { content.getAttribute( SchemaSymbols.ATT_BASE ), nameProperty};
419
                    reportSchemaError("dt-unknown-basetype", args);
420
                    reportSchemaError("dt-unknown-basetype", args);
420
                    baseValidator = (XSSimpleType)SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYSIMPLETYPE);
421
                    baseValidator = SchemaGrammar.fAnySimpleType;
421
                }
422
                }
422
                content   = DOMUtil.getNextSiblingElement( content );
423
                content   = DOMUtil.getNextSiblingElement( content );
423
            }
424
            }
Lines 520-539 Link Here
520
            (baseTypeStr.localpart.equals(SchemaSymbols.ATTVAL_ANYSIMPLETYPE) ||
521
            (baseTypeStr.localpart.equals(SchemaSymbols.ATTVAL_ANYSIMPLETYPE) ||
521
             baseTypeStr.localpart.equals(SchemaSymbols.ATTVAL_ANYTYPE)) &&
522
             baseTypeStr.localpart.equals(SchemaSymbols.ATTVAL_ANYTYPE)) &&
522
            baseRefContext == SchemaSymbols.RESTRICTION) {
523
            baseRefContext == SchemaSymbols.RESTRICTION) {
523
            String base = baseTypeStr.localpart;
524
            reportSchemaError("dt-unknown-basetype", new Object[] {
524
            reportSchemaError("dt-unknown-basetype", new Object[] {
525
                                       DOMUtil.getAttrValue(elm, SchemaSymbols.ATT_NAME), DOMUtil.getAttrValue(elm, SchemaSymbols.ATT_BASE)});
525
                                       DOMUtil.getAttrValue(elm, SchemaSymbols.ATT_NAME), DOMUtil.getAttrValue(elm, SchemaSymbols.ATT_BASE)});
526
            return  (XSSimpleType)SchemaGrammar.SG_SchemaNS.getGlobalTypeDecl(SchemaSymbols.ATTVAL_ANYSIMPLETYPE);
526
            return SchemaGrammar.fAnySimpleType;
527
        }
527
        }
528
528
529
        XSSimpleType baseType = null;
529
        XSTypeDecl baseType = (XSTypeDecl)fSchemaHandler.getGlobalDecl(schemaDoc, fSchemaHandler.TYPEDECL_TYPE, baseTypeStr);
530
        baseType = (XSSimpleType)fSchemaHandler.getGlobalDecl(schemaDoc, fSchemaHandler.TYPEDECL_TYPE, baseTypeStr);
531
        if (baseType != null) {
530
        if (baseType != null) {
531
            if (baseType.getXSType() != XSTypeDecl.SIMPLE_TYPE) {
532
                reportSchemaError("st-props-correct.4.1", new Object[] { baseTypeStr.rawname} );
533
                return SchemaGrammar.fAnySimpleType;
534
            }
532
            if ((baseType.getFinalSet() & baseRefContext) != 0) {
535
            if ((baseType.getFinalSet() & baseRefContext) != 0) {
533
                reportSchemaError("dt-restiction-final",new Object[] { baseTypeStr.rawname} );
536
                reportSchemaError("dt-restiction-final", new Object[] { baseTypeStr.rawname} );
534
            }
537
            }
535
        }
538
        }
536
        return baseType;
539
540
        return (XSSimpleType)baseType;
537
    }
541
    }
538
542
539
    // find if union datatype validator has list datatype member.
543
    // find if union datatype validator has list datatype member.
(-)parsers/AbstractDOMParser.java (-3 / +234 lines)
Lines 102-108 Link Here
102
 * @author Andy Clark, IBM
102
 * @author Andy Clark, IBM
103
 * @author Elena Litani, IBM
103
 * @author Elena Litani, IBM
104
 *
104
 *
105
 * @version $Id: AbstractDOMParser.java,v 1.22 2001/12/17 19:03:21 lehors Exp $
105
 * @version $Id: AbstractDOMParser.java,v 1.24 2001/12/22 23:25:49 andyc Exp $
106
 */
106
 */
107
public abstract class AbstractDOMParser
107
public abstract class AbstractDOMParser
108
    extends AbstractXMLDocumentParser {
108
    extends AbstractXMLDocumentParser {
Lines 189-194 Link Here
189
    protected Node fCurrentNode;
189
    protected Node fCurrentNode;
190
    protected CDATASection fCurrentCDATASection;
190
    protected CDATASection fCurrentCDATASection;
191
191
192
    // internal subset
193
194
    /** Internal subset buffer. */
195
    protected StringBuffer fInternalSubset;
192
196
193
    // deferred expansion data
197
    // deferred expansion data
194
198
Lines 202-207 Link Here
202
206
203
    // state
207
    // state
204
208
209
    /** True if inside DTD external subset. */
210
    protected boolean fInDTDExternalSubset;
211
205
    /** True if inside document. */
212
    /** True if inside document. */
206
    protected boolean fInDocument;
213
    protected boolean fInDocument;
207
214
Lines 352-357 Link Here
352
        // reset state information
359
        // reset state information
353
        fInDocument = false;
360
        fInDocument = false;
354
        fInDTD = false;
361
        fInDTD = false;
362
        fInDTDExternalSubset = false;
355
        fInCDATASection = false;
363
        fInCDATASection = false;
356
        fCurrentCDATASection = null;
364
        fCurrentCDATASection = null;
357
        fCurrentCDATASectionIndex = -1;
365
        fCurrentCDATASectionIndex = -1;
Lines 420-429 Link Here
420
     * 
428
     * 
421
     * @param version  The XML version, or null if not specified.
429
     * @param version  The XML version, or null if not specified.
422
     * @param encoding The IANA encoding name of the entity.
430
     * @param encoding The IANA encoding name of the entity.
431
     * @param augs       Additional information that may include infoset augmentations
423
     *
432
     *
424
     * @throws XNIException Thrown by handler to signal an error.
433
     * @throws XNIException Thrown by handler to signal an error.
425
     */
434
     */
426
    public void textDecl(String version, String encoding) throws XNIException {
435
    public void textDecl(String version, String encoding, Augmentations augs) throws XNIException {
427
        if (!fDeferNodeExpansion) {
436
        if (!fDeferNodeExpansion) {
428
            // REVISIT: when DOM Level 3 is REC rely on Document.support
437
            // REVISIT: when DOM Level 3 is REC rely on Document.support
429
            //          instead of specific class
438
            //          instead of specific class
Lines 593-602 Link Here
593
     * @param encoding   The IANA encoding name of the document, or null if
602
     * @param encoding   The IANA encoding name of the document, or null if
594
     *                   not specified.
603
     *                   not specified.
595
     * @param standalone The standalone value, or null if not specified.
604
     * @param standalone The standalone value, or null if not specified.
605
     * @param augs       Additional information that may include infoset augmentations
596
     *
606
     *
597
     * @throws XNIException Thrown by handler to signal an error.
607
     * @throws XNIException Thrown by handler to signal an error.
598
     */
608
     */
599
    public void xmlDecl(String version, String encoding, String standalone)
609
    public void xmlDecl(String version, String encoding, String standalone, 
610
                        Augmentations augs)
600
        throws XNIException {
611
        throws XNIException {
601
        if (!fDeferNodeExpansion) {
612
        if (!fDeferNodeExpansion) {
602
            // REVISIT: when DOM Level 3 is REC rely on Document.support
613
            // REVISIT: when DOM Level 3 is REC rely on Document.support
Lines 999-1004 Link Here
999
    //
1010
    //
1000
1011
1001
    /**
1012
    /**
1013
     * The start of the DTD.
1014
     *
1015
     * @throws XNIException Thrown by handler to signal an error.
1016
     */
1017
    public void startDTD(XMLLocator locator) throws XNIException {
1018
        super.startDTD(locator);
1019
        if (fDeferNodeExpansion || fDocumentImpl != null) {
1020
            fInternalSubset = new StringBuffer(1024);
1021
        }
1022
    } // startDTD(XMLLocator)
1023
1024
    /**
1025
     * The end of the DTD.
1026
     *
1027
     * @throws XNIException Thrown by handler to signal an error.
1028
     */
1029
    public void endDTD() throws XNIException {
1030
        super.endDTD();
1031
        String internalSubset = fInternalSubset != null && fInternalSubset.length() > 0
1032
                              ? fInternalSubset.toString() : null;
1033
        if (fDeferNodeExpansion) {
1034
            if (internalSubset != null) {
1035
                fDeferredDocumentImpl.setInternalSubset(fDocumentTypeIndex, internalSubset);
1036
            }
1037
        }
1038
        else if (fDocumentImpl != null) {
1039
            if (internalSubset != null) {
1040
                ((DocumentTypeImpl)fDocumentType).setInternalSubset(internalSubset);
1041
            }
1042
        }
1043
    } // endDTD()
1044
1045
    /**
1046
     * This method notifies of the start of an entity. The DTD has the 
1047
     * pseudo-name of "[dtd]" and parameter entity names start with '%'.
1048
     * <p>
1049
     * 
1050
     * @param name     The name of the entity.
1051
     * @param publicId The public identifier of the entity if the entity
1052
     *                 is external, null otherwise.
1053
     * @param systemId The system identifier of the entity if the entity
1054
     *                 is external, null otherwise.
1055
     * @param baseSystemId The base system identifier of the entity if
1056
     *                     the entity is external, null otherwise.
1057
     * @param encoding The auto-detected IANA encoding name of the entity
1058
     *                 stream. This value will be null in those situations
1059
     *                 where the entity encoding is not auto-detected (e.g.
1060
     *                 internal parameter entities).
1061
     *
1062
     * @throws XNIException Thrown by handler to signal an error.
1063
     */
1064
    public void startEntity(String name, 
1065
                            String publicId, String systemId,
1066
                            String baseSystemId,
1067
                            String encoding) throws XNIException {
1068
        if (name.equals("[dtd]")) {
1069
            fInDTDExternalSubset = true;
1070
        }
1071
    } // startEntity(String,String,String,String,String)
1072
1073
    /**
1074
     * This method notifies the end of an entity. The DTD has the pseudo-name
1075
     * of "[dtd]" and parameter entity names start with '%'.
1076
     * <p>
1077
     * 
1078
     * @param name The name of the entity.
1079
     *
1080
     * @throws XNIException Thrown by handler to signal an error.
1081
     */
1082
    public void endEntity(String name) throws XNIException {
1083
        if (name.equals("[dtd]")) {
1084
            fInDTDExternalSubset = false;
1085
        }
1086
    } // endEntity(String)
1087
1088
    /**
1002
     * An internal entity declaration.
1089
     * An internal entity declaration.
1003
     * 
1090
     * 
1004
     * @param name The name of the entity. Parameter entity names start with
1091
     * @param name The name of the entity. Parameter entity names start with
Lines 1016-1021 Link Here
1016
                                   XMLString nonNormalizedText) 
1103
                                   XMLString nonNormalizedText) 
1017
        throws XNIException {
1104
        throws XNIException {
1018
1105
1106
        // internal subset string
1107
        if (fInternalSubset != null && !fInDTDExternalSubset) {
1108
            fInternalSubset.append("<!ENTITY ");
1109
            if (name.startsWith("%")) {
1110
                fInternalSubset.append("% ");
1111
                fInternalSubset.append(name.substring(1));
1112
            }
1113
            else {
1114
                fInternalSubset.append(name);
1115
            }
1116
            fInternalSubset.append(' ');
1117
            String value = nonNormalizedText.toString();
1118
            boolean singleQuote = value.indexOf('\'') == -1;
1119
            fInternalSubset.append(singleQuote ? '\'' : '"');
1120
            fInternalSubset.append(value);
1121
            fInternalSubset.append(singleQuote ? '\'' : '"');
1122
            fInternalSubset.append(">\n");
1123
        }
1124
1019
        // NOTE: We only know how to create these nodes for the Xerces
1125
        // NOTE: We only know how to create these nodes for the Xerces
1020
        //       DOM implementation because DOM Level 2 does not specify 
1126
        //       DOM implementation because DOM Level 2 does not specify 
1021
        //       that functionality. -Ac
1127
        //       that functionality. -Ac
Lines 1075-1080 Link Here
1075
                                   String publicId, String systemId,
1181
                                   String publicId, String systemId,
1076
                                   String baseSystemId) throws XNIException {
1182
                                   String baseSystemId) throws XNIException {
1077
1183
1184
        // internal subset string
1185
        if (fInternalSubset != null && !fInDTDExternalSubset) {
1186
            fInternalSubset.append("<!ENTITY ");
1187
            if (name.startsWith("%")) {
1188
                fInternalSubset.append("% ");
1189
                fInternalSubset.append(name.substring(1));
1190
            }
1191
            else {
1192
                fInternalSubset.append(name);
1193
            }
1194
            fInternalSubset.append(' ');
1195
            if (publicId != null) {
1196
                fInternalSubset.append("PUBLIC '");
1197
                fInternalSubset.append(publicId);
1198
                fInternalSubset.append("' '");
1199
            }
1200
            else {
1201
                fInternalSubset.append("SYSTEM '");
1202
            }
1203
            fInternalSubset.append(systemId);
1204
            fInternalSubset.append("'>\n");
1205
        }
1206
1078
        // NOTE: We only know how to create these nodes for the Xerces
1207
        // NOTE: We only know how to create these nodes for the Xerces
1079
        //       DOM implementation because DOM Level 2 does not specify 
1208
        //       DOM implementation because DOM Level 2 does not specify 
1080
        //       that functionality. -Ac
1209
        //       that functionality. -Ac
Lines 1134-1139 Link Here
1134
                                   String publicId, String systemId, 
1263
                                   String publicId, String systemId, 
1135
                                   String notation) throws XNIException {
1264
                                   String notation) throws XNIException {
1136
1265
1266
        // internal subset string
1267
        if (fInternalSubset != null && !fInDTDExternalSubset) {
1268
            fInternalSubset.append("<!ENTITY ");
1269
            fInternalSubset.append(name);
1270
            fInternalSubset.append(' ');
1271
            if (publicId != null) {
1272
                fInternalSubset.append("PUBLIC '");
1273
                fInternalSubset.append(publicId);
1274
                if (systemId != null) {
1275
                    fInternalSubset.append("' '");
1276
                    fInternalSubset.append(systemId);
1277
                }
1278
            }
1279
            else {
1280
                fInternalSubset.append("SYSTEM '");
1281
                fInternalSubset.append(systemId);
1282
            }
1283
            fInternalSubset.append("' NDATA ");
1284
            fInternalSubset.append(notation);
1285
            fInternalSubset.append(">\n");
1286
        }
1287
1137
        // NOTE: We only know how to create these nodes for the Xerces
1288
        // NOTE: We only know how to create these nodes for the Xerces
1138
        //       DOM implementation because DOM Level 2 does not specify 
1289
        //       DOM implementation because DOM Level 2 does not specify 
1139
        //       that functionality. -Ac
1290
        //       that functionality. -Ac
Lines 1189-1194 Link Here
1189
    public void notationDecl(String name, String publicId, String systemId)
1340
    public void notationDecl(String name, String publicId, String systemId)
1190
        throws XNIException {
1341
        throws XNIException {
1191
1342
1343
        // internal subset string
1344
        if (fInternalSubset != null && !fInDTDExternalSubset) {
1345
            fInternalSubset.append("<!NOTATION ");
1346
            if (publicId != null) {
1347
                fInternalSubset.append("PUBLIC '");
1348
                fInternalSubset.append(publicId);
1349
                if (systemId != null) {
1350
                    fInternalSubset.append("' '");
1351
                    fInternalSubset.append(systemId);
1352
                }
1353
            }
1354
            else {
1355
                fInternalSubset.append("SYSTEM '");
1356
                fInternalSubset.append(systemId);
1357
            }
1358
            fInternalSubset.append("'>\n");
1359
        }
1360
1192
        // NOTE: We only know how to create these nodes for the Xerces
1361
        // NOTE: We only know how to create these nodes for the Xerces
1193
        //       DOM implementation because DOM Level 2 does not specify 
1362
        //       DOM implementation because DOM Level 2 does not specify 
1194
        //       that functionality. -Ac
1363
        //       that functionality. -Ac
Lines 1229-1234 Link Here
1229
    } // notationDecl(String,String,String)
1398
    } // notationDecl(String,String,String)
1230
1399
1231
    /**
1400
    /**
1401
     * An element declaration.
1402
     * 
1403
     * @param name         The name of the element.
1404
     * @param contentModel The element content model.
1405
     *
1406
     * @throws XNIException Thrown by handler to signal an error.
1407
     */
1408
    public void elementDecl(String name, String contentModel)
1409
        throws XNIException {
1410
1411
        // internal subset string
1412
        if (fInternalSubset != null && !fInDTDExternalSubset) {
1413
            fInternalSubset.append("<!ELEMENT ");
1414
            fInternalSubset.append(name);
1415
            fInternalSubset.append(' ');
1416
            fInternalSubset.append(contentModel);
1417
            fInternalSubset.append(">\n");
1418
        }
1419
1420
    } // elementDecl(String,String)
1421
1422
    /**
1232
     * An attribute declaration.
1423
     * An attribute declaration.
1233
     * 
1424
     * 
1234
     * @param elementName   The name of the element that this attribute
1425
     * @param elementName   The name of the element that this attribute
Lines 1253-1258 Link Here
1253
                              String type, String[] enumeration, 
1444
                              String type, String[] enumeration, 
1254
                              String defaultType, XMLString defaultValue)
1445
                              String defaultType, XMLString defaultValue)
1255
        throws XNIException {
1446
        throws XNIException {
1447
1448
        // internal subset string
1449
        if (fInternalSubset != null && !fInDTDExternalSubset) {
1450
            fInternalSubset.append("<!ATTLIST ");
1451
            fInternalSubset.append(elementName);
1452
            fInternalSubset.append(' ');
1453
            fInternalSubset.append(attributeName);
1454
            fInternalSubset.append(' ');
1455
            if (type.equals("ENUMERATION")) {
1456
                fInternalSubset.append('(');
1457
                for (int i = 0; i < enumeration.length; i++) {
1458
                    if (i > 0) {
1459
                        fInternalSubset.append('|');
1460
                    }
1461
                    fInternalSubset.append(enumeration[i]);
1462
                }
1463
                fInternalSubset.append(')');
1464
            }
1465
            else {
1466
                fInternalSubset.append(type);
1467
            }
1468
            if (defaultType != null) {
1469
                fInternalSubset.append(' ');
1470
                fInternalSubset.append(defaultType);
1471
            }
1472
            if (defaultValue != null) {
1473
                fInternalSubset.append(" '");
1474
                for (int i = 0; i < defaultValue.length; i++) {
1475
                    char c = defaultValue.ch[defaultValue.offset + i];
1476
                    if (c == '\'') {
1477
                        fInternalSubset.append("&apos;");
1478
                    }
1479
                    else {
1480
                        fInternalSubset.append(c);
1481
                    }
1482
                }
1483
                fInternalSubset.append('\'');
1484
            }
1485
            fInternalSubset.append(">\n");
1486
        }
1256
1487
1257
        // deferred expansion
1488
        // deferred expansion
1258
        if (fDeferredDocumentImpl != null) {
1489
        if (fDeferredDocumentImpl != null) {
(-)parsers/AbstractSAXParser.java (-5 / +12 lines)
Lines 110-116 Link Here
110
 * @author Arnaud Le Hors, IBM
110
 * @author Arnaud Le Hors, IBM
111
 * @author Andy Clark, IBM
111
 * @author Andy Clark, IBM
112
 *
112
 *
113
 * @version $Id: AbstractSAXParser.java,v 1.10 2001/12/14 20:49:16 lmartin Exp $
113
 * @version $Id: AbstractSAXParser.java,v 1.11 2001/12/20 13:44:51 rahuls Exp $
114
 */
114
 */
115
public abstract class AbstractSAXParser
115
public abstract class AbstractSAXParser
116
    extends AbstractXMLDocumentParser
116
    extends AbstractXMLDocumentParser
Lines 392-406 Link Here
392
            // SAX2
392
            // SAX2
393
            if (fContentHandler != null) {
393
            if (fContentHandler != null) {
394
394
395
                if (!fNamespacePrefixes) {
396
                    // remove namespace declaration attributes
397
                    int len = attributes.getLength();
395
                    int len = attributes.getLength();
398
                    for (int i = len - 1; i >= 0; i--) {
396
                    for (int i = len - 1; i >= 0; i--) {
399
                        attributes.getName(i, fQName);
397
                        attributes.getName(i, fQName);
400
                        if (fQName.rawname == fXmlnsSymbol ||
398
                    if (fQName.prefix == fXmlnsSymbol || 
401
                            fQName.prefix == fXmlnsSymbol) {
399
                        fQName.rawname == fXmlnsSymbol) {
400
                        if (!fNamespacePrefixes) {
401
                            // remove namespace declaration attributes
402
                            attributes.removeAttributeAt(i);
402
                            attributes.removeAttributeAt(i);
403
                        }
403
                        }
404
                        else if (fNamespaces && fNamespacePrefixes) {
405
                            // localpart should be empty string as per SAX documentation:
406
                            // http://www.saxproject.org/?selected=namespaces
407
                            fQName.prefix = fEmptySymbol;
408
                            fQName.localpart = fEmptySymbol;
409
                            attributes.setName(i, fQName);
410
                        }
404
                    }
411
                    }
405
                }
412
                }
406
413
(-)parsers/StandardParserConfiguration.java (-1 / +7 lines)
Lines 121-127 Link Here
121
 * @author Arnaud  Le Hors, IBM
121
 * @author Arnaud  Le Hors, IBM
122
 * @author Andy Clark, IBM
122
 * @author Andy Clark, IBM
123
 *
123
 *
124
 * @version $Id: StandardParserConfiguration.java,v 1.10 2001/12/14 20:50:21 lmartin Exp $
124
 * @version $Id: StandardParserConfiguration.java,v 1.11 2002/01/03 19:50:08 sandygao Exp $
125
 */
125
 */
126
public class StandardParserConfiguration
126
public class StandardParserConfiguration
127
    extends BasicParserConfiguration 
127
    extends BasicParserConfiguration 
Lines 773-778 Link Here
773
        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
773
        if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
774
            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
774
            String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
775
            if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
775
            if (property.equals(Constants.DTD_SCANNER_PROPERTY)) {
776
                return;
777
            }
778
            if (property.equals(Constants.SCHEMA_LOCATION)) {
779
                return;
780
            }
781
            if (property.equals(Constants.SCHEMA_NONS_LOCATION)) {
776
                return;
782
                return;
777
            }
783
            }
778
        }
784
        }
(-)util/EncodingMap.java (-1 / +5 lines)
Lines 507-513 Link Here
507
 * @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
507
 * @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
508
 * @author Andy Clark, IBM
508
 * @author Andy Clark, IBM
509
 *
509
 *
510
 * @version $Id: EncodingMap.java,v 1.3 2001/12/11 21:57:38 neilg Exp $
510
 * @version $Id: EncodingMap.java,v 1.4 2002/01/04 23:27:49 neilg Exp $
511
 */
511
 */
512
public class EncodingMap {
512
public class EncodingMap {
513
513
Lines 647-652 Link Here
647
        fIANA2JavaMap.put("CP367",        "ASCII");
647
        fIANA2JavaMap.put("CP367",        "ASCII");
648
        fIANA2JavaMap.put("UTF-8",           "UTF8");
648
        fIANA2JavaMap.put("UTF-8",           "UTF8");
649
        fIANA2JavaMap.put("UTF-16",           "Unicode");
649
        fIANA2JavaMap.put("UTF-16",           "Unicode");
650
        fIANA2JavaMap.put("UTF-16BE",           "UnicodeBig");
651
        fIANA2JavaMap.put("UTF-16LE",           "UnicodeLittle");
650
652
651
        // REVISIT:
653
        // REVISIT:
652
        //   j:CNS11643 -> EUC-TW?
654
        //   j:CNS11643 -> EUC-TW?
Lines 686-691 Link Here
686
        fJava2IANAMap.put("SJIS",      "SHIFT_JIS");
688
        fJava2IANAMap.put("SJIS",      "SHIFT_JIS");
687
        fJava2IANAMap.put("UTF8",      "UTF-8");
689
        fJava2IANAMap.put("UTF8",      "UTF-8");
688
        fJava2IANAMap.put("Unicode",   "UTF-16");
690
        fJava2IANAMap.put("Unicode",   "UTF-16");
691
        fJava2IANAMap.put("UnicodeBig",   "UTF-16BE");
692
        fJava2IANAMap.put("UnicodeLittle",   "UTF-16LE");
689
        fJava2IANAMap.put("JIS0201",  "X0201");
693
        fJava2IANAMap.put("JIS0201",  "X0201");
690
        fJava2IANAMap.put("JIS0208",  "X0208");
694
        fJava2IANAMap.put("JIS0208",  "X0208");
691
        fJava2IANAMap.put("JIS0212",  "ISO-IR-159");
695
        fJava2IANAMap.put("JIS0212",  "ISO-IR-159");
(-)util/XMLAttributesImpl.java (-1 / +1 lines)
Lines 293-299 Link Here
293
    public void setValue(int attrIndex, String attrValue) {
293
    public void setValue(int attrIndex, String attrValue) {
294
        Attribute attribute = fAttributes[attrIndex];
294
        Attribute attribute = fAttributes[attrIndex];
295
        attribute.value = attrValue;
295
        attribute.value = attrValue;
296
        attribute.nonNormalizedValue = attrValue;
296
//        attribute.nonNormalizedValue = attrValue;
297
    } // setValue(int,String)
297
    } // setValue(int,String)
298
298
299
    /**
299
    /**

Return to bug 18731