1824 { 1825 panic(FAULT); 1826 } 1827 ids.value = null; 1828 break; 1829 } 1830 return ids; 1831 } else if ("SYSTEM".equals(str) == true) { 1832 ids.name = null; 1833 bqstr(' '); 1834 ids.value = new String(mBuff, 1, mBuffIdx); 1835 return ids; 1836 } 1837 panic(FAULT); 1838 return null; 1839 } 1840 1841 /** 1842 * Reads an attribute value. 1843 * 1844 * The grammar which this method can read is:<br /> 1845 * <code>eqstr := S "=" qstr</code><br /> 1846 * <code>qstr := S ("'" string "'") | 1847 * ('"' string '"')</code><br /> This method resolves entities 1848 * inside a string unless the parser parses DTD. 1849 * 1850 * @param flag The '=' character forces the method to accept the '=' 1851 * character before quoted string and read the following string as not an 1852 * attribute ('-'), 'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; 1853 * '-' - not an attribute value; 'd' - in DTD context. 1854 * @return The content of the quoted strign as a string. 1855 * @exception Exception is parser specific exception form panic method. 1856 * @exception IOException 1857 */ 1858 protected String eqstr(char flag) throws Exception { 1859 if (flag == '=') { 1860 wsskip(); 1861 if (getch() != '=') { 1862 panic(FAULT); 1863 } 1864 } 1865 bqstr((flag == '=') ? '-' : flag); 1866 return new String(mBuff, 1, mBuffIdx); 1867 } 3273 if (mInp.src != null) { 3274 try { 3275 mInp.src.close(); 3276 } catch (IOException ioe) { 3277 } 3278 mInp.src = null; 3279 } 3280 mInp = mInp.next; 3281 if (mInp != null) { 3282 mChars = mInp.chars; 3283 mChLen = mInp.chLen; 3284 mChIdx = mInp.chIdx; 3285 } else { 3286 mChars = null; 3287 mChLen = 0; 3288 mChIdx = 0; 3289 } 3290 } 3291 3292 /** 3293 * Maps a character to it's type. 3294 * 3295 * Possible character type values are:<br /> - ' ' for any kind of white 3296 * space character;<br /> - 'a' for any lower case alphabetical character 3297 * value;<br /> - 'A' for any upper case alphabetical character value;<br /> 3298 * - 'd' for any decimal digit character value;<br /> - 'z' for any 3299 * character less then ' ' except '\t', '\n', '\r';<br /> - 'X' for any not 3300 * ASCII character;<br /> - 'Z' for EOS character.<br /> An ASCII (7 bit) 3301 * character which does not fall in any category listed above is mapped to 3302 * it self. 3303 * 3304 * @param ch The character to map. 3305 * @return The type of character. 3306 */ 3307 protected char chtyp(char ch) { 3308 if (ch < 0x80) { 3309 return (char) asctyp[ch]; 3310 } 3311 return (ch != EOS) ? 'X' : 'Z'; 3312 } 3313 3314 /** 3315 * Retrives the next character in the document. 3316 * 3317 * @return The next character in the document. 3318 */ 3319 protected char getch() 3320 throws IOException { 3321 if (mChIdx >= mChLen) { 3322 if (mInp.src == null) { | 1824 { 1825 panic(FAULT); 1826 } 1827 ids.value = null; 1828 break; 1829 } 1830 return ids; 1831 } else if ("SYSTEM".equals(str) == true) { 1832 ids.name = null; 1833 bqstr(' '); 1834 ids.value = new String(mBuff, 1, mBuffIdx); 1835 return ids; 1836 } 1837 panic(FAULT); 1838 return null; 1839 } 1840 1841 /** 1842 * Reads an attribute value. 1843 * 1844 * The grammar which this method can read is: 1845 * <pre>{@code 1846 * eqstr := S "=" qstr 1847 * qstr := S ("'" string "'") | ('"' string '"') 1848 * }</pre> 1849 * This method resolves entities 1850 * inside a string unless the parser parses DTD. 1851 * 1852 * @param flag The '=' character forces the method to accept the '=' 1853 * character before quoted string and read the following string as not an 1854 * attribute ('-'), 'c' - CDATA, 'i' - non CDATA, ' ' - no normalization; 1855 * '-' - not an attribute value; 'd' - in DTD context. 1856 * @return The content of the quoted strign as a string. 1857 * @exception Exception is parser specific exception form panic method. 1858 * @exception IOException 1859 */ 1860 protected String eqstr(char flag) throws Exception { 1861 if (flag == '=') { 1862 wsskip(); 1863 if (getch() != '=') { 1864 panic(FAULT); 1865 } 1866 } 1867 bqstr((flag == '=') ? '-' : flag); 1868 return new String(mBuff, 1, mBuffIdx); 1869 } 3275 if (mInp.src != null) { 3276 try { 3277 mInp.src.close(); 3278 } catch (IOException ioe) { 3279 } 3280 mInp.src = null; 3281 } 3282 mInp = mInp.next; 3283 if (mInp != null) { 3284 mChars = mInp.chars; 3285 mChLen = mInp.chLen; 3286 mChIdx = mInp.chIdx; 3287 } else { 3288 mChars = null; 3289 mChLen = 0; 3290 mChIdx = 0; 3291 } 3292 } 3293 3294 /** 3295 * Maps a character to its type. 3296 * 3297 * Possible character type values are: 3298 * <ul> 3299 * <li>' ' - for any kind of whitespace character;</li> 3300 * <li>'a' - for any lower case alphabetical character value;</li> 3301 * <li>'A' - for any upper case alphabetical character value;</li> 3302 * <li>'d' - for any decimal digit character value;</li> 3303 * <li>'z' - for any character less than ' ' except '\t', '\n', '\r';</li> 3304 * <li>'X' - for any not ASCII character;</li> 3305 * <li>'Z' - for EOS character.</li> 3306 * </ul> 3307 * An ASCII (7 bit) character which does not fall in any category 3308 * listed above is mapped to itself. 3309 * 3310 * @param ch The character to map. 3311 * @return The type of character. 3312 */ 3313 protected char chtyp(char ch) { 3314 if (ch < 0x80) { 3315 return (char) asctyp[ch]; 3316 } 3317 return (ch != EOS) ? 'X' : 'Z'; 3318 } 3319 3320 /** 3321 * Retrives the next character in the document. 3322 * 3323 * @return The next character in the document. 3324 */ 3325 protected char getch() 3326 throws IOException { 3327 if (mChIdx >= mChLen) { 3328 if (mInp.src == null) { |