1 57 58 package com.sun.org.apache.xerces.internal.impl; 59 60 import java.io.IOException ; 61 62 import com.sun.org.apache.xerces.internal.util.SymbolTable; 63 import com.sun.org.apache.xerces.internal.util.XML11Char; 64 import com.sun.org.apache.xerces.internal.util.XMLChar; 65 import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; 66 import com.sun.org.apache.xerces.internal.xni.XMLString; 67 import com.sun.org.apache.xerces.internal.xni.XNIException; 68 69 92 public class XML11DTDScannerImpl 93 extends XMLDTDScannerImpl { 94 95 96 private String [] fStrings = new String [3]; 97 98 99 private XMLString fString = new XMLString(); 100 101 102 private XMLStringBuffer fStringBuffer = new XMLStringBuffer(); 103 104 105 private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer(); 106 private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer(); 107 108 112 113 public XML11DTDScannerImpl() {super();} 115 116 public XML11DTDScannerImpl(SymbolTable symbolTable, 117 XMLErrorReporter errorReporter, XMLEntityManager entityManager) { 118 super(symbolTable, errorReporter, entityManager); 119 } 120 121 125 151 protected boolean scanPubidLiteral(XMLString literal) 152 throws IOException , XNIException 153 { 154 int quote = fEntityScanner.scanChar(); 155 if (quote != '\'' && quote != '"') { 156 reportFatalError("QuoteRequiredInPublicID", null); 157 return false; 158 } 159 160 fStringBuffer.clear(); 161 boolean skipSpace = true; 163 boolean dataok = true; 164 while (true) { 165 int c = fEntityScanner.scanChar(); 166 if (c == ' ' || c == '\n' || c == '\r' || c == 0x85 || c == 0x2028) { 168 if (!skipSpace) { 169 fStringBuffer.append(' '); 171 skipSpace = true; 172 } 173 } 174 else if (c == quote) { 175 if (skipSpace) { 176 fStringBuffer.length--; 178 } 179 literal.setValues(fStringBuffer); 180 break; 181 } 182 else if (XMLChar.isPubid(c)) { 183 fStringBuffer.append((char)c); 184 skipSpace = false; 185 } 186 else if (c == -1) { 187 reportFatalError("PublicIDUnterminated", null); 188 return false; 189 } 190 else { 191 dataok = false; 192 reportFatalError("InvalidCharInPublicID", 193 new Object []{Integer.toHexString(c)}); 194 } 195 } 196 return dataok; 197 } 198 199 203 protected void normalizeWhitespace(XMLString value) { 204 int end = value.offset + value.length; 205 for (int i = value.offset; i < end; i++) { 206 int c = value.ch[i]; 207 if (XMLChar.isSpace(c)) { 208 value.ch[i] = ' '; 209 } 210 } 211 } 212 213 protected boolean isInvalid(int value) { 217 return (!XML11Char.isXML11Valid(value)); 218 } 220 protected boolean isInvalidLiteral(int value) { 224 return (!XML11Char.isXML11ValidLiteral(value)); 225 } 227 protected boolean isValidNameChar(int value) { 231 return (XML11Char.isXML11Name(value)); 232 } 234 protected boolean isValidNameStartChar(int value) { 238 return (XML11Char.isXML11NameStart(value)); 239 } 241 protected boolean isValidNCName(int value) { 245 return (XML11Char.isXML11NCName(value)); 246 } 248 protected boolean isValidNameStartHighSurrogate(int value) { 253 return XML11Char.isXML11NameHighSurrogate(value); 254 } 256 protected boolean versionSupported(String version) { 260 return version.equals("1.1") || version.equals ("1.0"); 261 } 263 protected String getVersionNotSupportedKey () { 267 return "VersionNotSupported11"; 268 } 270 } | Popular Tags |