XML11DTDScannerImpl.java revision 286
286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * The Apache Software License, Version 1.1 286N/A * Copyright (c) 1999-2004 The Apache Software Foundation. 286N/A * Redistribution and use in source and binary forms, with or without 286N/A * modification, are permitted provided that the following conditions 286N/A * 1. Redistributions of source code must retain the above copyright 286N/A * notice, this list of conditions and the following disclaimer. 286N/A * 2. Redistributions in binary form must reproduce the above copyright 286N/A * notice, this list of conditions and the following disclaimer in 286N/A * the documentation and/or other materials provided with the 286N/A * 3. The end-user documentation included with the redistribution, 286N/A * if any, must include the following acknowledgment: 286N/A * "This product includes software developed by the 286N/A * Alternately, this acknowledgment may appear in the software itself, 286N/A * if and wherever such third-party acknowledgments normally appear. 286N/A * 4. The names "Xerces" and "Apache Software Foundation" must 286N/A * not be used to endorse or promote products derived from this 286N/A * software without prior written permission. For written 286N/A * permission, please contact apache@apache.org. 286N/A * 5. Products derived from this software may not be called "Apache", 286N/A * nor may "Apache" appear in their name, without prior written 286N/A * permission of the Apache Software Foundation. 286N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 286N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 286N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 286N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 286N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 286N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 286N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 286N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 286N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 286N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 286N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 286N/A * ==================================================================== 286N/A * This software consists of voluntary contributions made by many 286N/A * individuals on behalf of the Apache Software Foundation and was 286N/A * originally based on software copyright (c) 1999, International 286N/A * information on the Apache Software Foundation, please see 286N/A * This class is responsible for scanning the declarations found 286N/A * in the internal and external subsets of a DTD in an XML document. 286N/A * The scanner acts as the sources for the DTD information which is 286N/A * communicated to the DTD handlers. 286N/A * This component requires the following features and properties from the 286N/A * component manager that uses it: 286N/A * @author Arnaud Le Hors, IBM 286N/A * @author Andy Clark, IBM 286N/A * @author Glenn Marcy, IBM 286N/A /** Array of 3 strings. */ 286N/A /** Default constructor. */ 286N/A /** Constructor for he use of non-XMLComponentManagers. */ 286N/A // XMLDTDScanner methods 286N/A // NOTE: this is a carbon copy of the code in XML11DocumentScannerImpl; 286N/A // we need to override these methods in both places. Ah for 286N/A // multiple inheritance... 286N/A // This needs to be refactored!!! - NG 286N/A * Scans public ID literal. 286N/A * [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" 286N/A * [13] PubidChar::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] 286N/A * The returned string is normalized according to the following rule, 286N/A * Before a match is attempted, all strings of white space in the public 286N/A * identifier must be normalized to single space characters (#x20), and 286N/A * leading and trailing white space must be removed. 286N/A * @param literal The string to fill in with the public ID literal. 286N/A * @return True on success. 286N/A * <strong>Note:</strong> This method uses fStringBuffer, anything in it at 286N/A * the time of calling is lost. 286N/A // skip leading whitespace 286N/A // REVISIT: it could really only be \n or 0x20; all else is normalized, no? - neilg 286N/A if (c ==
' ' || c ==
'\n' || c ==
'\r' || c ==
0x85 || c ==
0x2028) {
286N/A // take the first whitespace as a space and skip the others 286N/A // if we finished on a space let's trim it 286N/A * Normalize whitespace in an XMLString converting all whitespace 286N/A * characters to space characters. 286N/A * Normalize whitespace in an XMLString converting all whitespace 286N/A * characters to space characters. 286N/A * Checks whether this string would be unchanged by normalization. 286N/A * @return -1 if the value would be unchanged by normalization, 286N/A * otherwise the index of the first whitespace character which 286N/A * would be transformed. 286N/A // returns true if the given character is not 286N/A // valid with respect to the version of 286N/A // XML understood by this scanner. 286N/A }
// isInvalid(int): boolean 286N/A // returns true if the given character is not 286N/A // valid or may not be used outside a character reference 286N/A // with respect to the version of XML understood by this scanner. 286N/A }
// isInvalidLiteral(int): boolean 286N/A // returns true if the given character is 286N/A // a valid nameChar with respect to the version of 286N/A // XML understood by this scanner. 286N/A }
// isValidNameChar(int): boolean 286N/A // returns true if the given character is 286N/A // a valid nameStartChar with respect to the version of 286N/A // XML understood by this scanner. 286N/A }
// isValidNameStartChar(int): boolean 286N/A // returns true if the given character is 286N/A // a valid NCName character with respect to the version of 286N/A // XML understood by this scanner. 286N/A }
// isValidNCName(int): boolean 286N/A // returns true if the given character is 286N/A // a valid high surrogate for a nameStartChar 286N/A // with respect to the version of XML understood 286N/A }
// isValidNameStartHighSurrogate(int): boolean 286N/A // note that, according to 4.3.4 of the XML 1.1 spec, XML 1.1 286N/A // documents may invoke 1.0 entities; thus either version decl (or none!) 286N/A // is allowed to appear in this context 286N/A }
// versionSupported(String): boolean 286N/A // returns the error message key for unsupported 286N/A // versions of XML with respect to the version of 286N/A // XML understood by this scanner. 286N/A return "VersionNotSupported11";
286N/A }
// getVersionNotSupportedKey: String 286N/A}
// class XML11DTDScannerImpl