1 57 58 package org.enhydra.apache.xerces.readers; 59 60 import org.enhydra.apache.xerces.utils.QName; 61 import org.enhydra.apache.xerces.utils.StringPool; 62 import org.xml.sax.InputSource ; 63 import org.xml.sax.Locator ; 64 65 72 public interface XMLEntityHandler extends Locator { 73 74 79 public static final int 80 CHARREF_RESULT_SEMICOLON_REQUIRED = -1, 81 CHARREF_RESULT_INVALID_CHAR = -2, 82 CHARREF_RESULT_OUT_OF_RANGE = -3; 83 84 89 public static final int 90 STRINGLIT_RESULT_QUOTE_REQUIRED = -1, 91 STRINGLIT_RESULT_INVALID_CHAR = -2; 92 93 100 public static final int 101 ATTVALUE_RESULT_COMPLEX = -1, 102 ATTVALUE_RESULT_LESSTHAN = -2, 103 ATTVALUE_RESULT_INVALID_CHAR = -3; 104 105 111 public static final int 112 ENTITYVALUE_RESULT_FINISHED = -1, 113 ENTITYVALUE_RESULT_REFERENCE = -2, 114 ENTITYVALUE_RESULT_PEREF = -3, 115 ENTITYVALUE_RESULT_INVALID_CHAR = -4, 116 ENTITYVALUE_RESULT_END_OF_INPUT = -5; 117 118 121 public static final int 122 CONTENT_RESULT_START_OF_PI = 0, 123 CONTENT_RESULT_START_OF_COMMENT = 1, 124 CONTENT_RESULT_START_OF_CDSECT = 2, 125 CONTENT_RESULT_END_OF_CDSECT = 3, 126 CONTENT_RESULT_START_OF_ETAG = 4, 127 CONTENT_RESULT_MATCHING_ETAG = 5, 128 CONTENT_RESULT_START_OF_ELEMENT = 6, 129 CONTENT_RESULT_START_OF_CHARREF = 7, 130 CONTENT_RESULT_START_OF_ENTITYREF = 8, 131 CONTENT_RESULT_INVALID_CHAR = 9, 132 CONTENT_RESULT_MARKUP_NOT_RECOGNIZED = 10, 133 CONTENT_RESULT_MARKUP_END_OF_INPUT = 11, 134 CONTENT_RESULT_REFERENCE_END_OF_INPUT = 12; 135 136 141 public static final int 142 ENTITYTYPE_INTERNAL_PE = 0, 143 ENTITYTYPE_EXTERNAL_PE = 1, 144 ENTITYTYPE_INTERNAL = 2, 145 ENTITYTYPE_EXTERNAL = 3, 146 ENTITYTYPE_UNPARSED = 4, 147 ENTITYTYPE_DOCUMENT = 5, 148 ENTITYTYPE_EXTERNAL_SUBSET = 6; 149 150 160 public static final int 161 ENTITYREF_IN_ATTVALUE = 0, 162 ENTITYREF_IN_DEFAULTATTVALUE = 1, 163 ENTITYREF_IN_CONTENT = 2, 164 ENTITYREF_IN_DTD_AS_MARKUP = 3, 165 ENTITYREF_IN_ENTITYVALUE = 4, 166 ENTITYREF_IN_DTD_WITHIN_MARKUP = 5, 167 ENTITYREF_DOCUMENT = 6, 168 ENTITYREF_EXTERNAL_SUBSET = 7; 169 170 178 public boolean startReadingFromDocument(InputSource source) throws Exception ; 179 180 194 public boolean startReadingFromEntity(int entityName, int readerDepth, int entityContext) throws Exception ; 195 196 201 public String expandSystemId(String systemId); 202 203 206 public interface DTDHandler { 207 215 public void startReadingFromExternalSubset(String publicId, String systemId, int readerDepth) throws Exception ; 216 217 221 public void stopReadingFromExternalSubset() throws Exception ; 222 223 230 public boolean startEntityDecl(boolean isPE, int entityName) throws Exception ; 231 232 236 public void endEntityDecl() throws Exception ; 237 238 241 public int addInternalPEDecl(int entityName, int value, boolean isExternal) throws Exception ; 242 public int addExternalPEDecl(int entityName, int publicId, int systemId, boolean isExternal) throws Exception ; 243 public int addInternalEntityDecl(int entityName, int value, boolean isExternal) throws Exception ; 244 public int addExternalEntityDecl(int entityName, int publicId, int systemId, boolean isExternal) throws Exception ; 245 public int addUnparsedEntityDecl(int entityName, int publicId, int systemId, int notationName, boolean isExternal) throws Exception ; 246 public int addNotationDecl(int notationName, int publicId, int systemId, boolean isExternal) throws Exception ; 247 248 255 public boolean isUnparsedEntity(int entityName); 256 257 264 public boolean isNotationDeclared(int entityName); 265 266 269 public void addRequiredNotation(int notationName, Locator locator, int majorCode, int minorCode, Object [] args); 270 271 274 public void checkRequiredNotations() throws Exception ; 275 } 276 277 280 public int getReaderId(); 281 282 285 public void setReaderDepth(int depth); 286 287 290 public int getReaderDepth(); 291 292 295 public EntityReader getEntityReader(); 296 297 304 public EntityReader changeReaders() throws Exception ; 305 306 315 public interface CharBuffer { 316 321 public void append(char ch); 322 323 330 public void append(char[] chars, int offset, int length); 331 332 338 public int length(); 339 340 347 public int addString(int offset, int length); 348 } 349 350 353 public void setCharDataHandler(XMLEntityHandler.CharDataHandler charDataHandler); 354 355 358 public XMLEntityHandler.CharDataHandler getCharDataHandler(); 359 360 363 public interface CharDataHandler { 364 372 public void processCharacters(char[] chars, int offset, int length) throws Exception ; 373 374 380 public void processCharacters(int stringHandle) throws Exception ; 381 382 390 public void processWhitespace(char[] chars, int offset, int length) throws Exception ; 391 392 398 public void processWhitespace(int stringHandle) throws Exception ; 399 } 400 401 411 public interface EntityReader { 412 417 public int currentOffset(); 418 419 424 public int getLineNumber(); 425 426 431 public int getColumnNumber(); 432 433 436 public void setInCDSect(boolean inCDSect); 437 438 441 public boolean getInCDSect(); 442 443 451 public void append(XMLEntityHandler.CharBuffer charBuffer, int offset, int length); 452 453 461 public int addString(int offset, int length); 462 463 471 public int addSymbol(int offset, int length); 472 473 482 public boolean lookingAtChar(char ch, boolean skipPastChar) throws Exception ; 483 484 492 public boolean lookingAtValidChar(boolean skipPastChar) throws Exception ; 493 494 502 public boolean lookingAtSpace(boolean skipPastChar) throws Exception ; 503 504 510 public void skipToChar(char ch) throws Exception ; 511 512 516 public void skipPastSpaces() throws Exception ; 517 518 522 public void skipPastName(char fastcheck) throws Exception ; 523 524 528 public void skipPastNmtoken(char fastcheck) throws Exception ; 529 530 538 public boolean skippedString(char[] s) throws Exception ; 539 540 546 public int scanInvalidChar() throws Exception ; 547 548 558 public int scanCharRef(boolean isHexadecimal) throws Exception ; 559 560 570 public int scanStringLiteral() throws Exception ; 571 572 584 public int scanAttValue(char qchar, boolean asSymbol) throws Exception ; 585 586 600 public int scanEntityValue(int qchar, boolean createString) throws Exception ; 601 602 614 public int scanName(char fastcheck) throws Exception ; 615 616 629 public boolean scanExpectedName(char fastcheck, StringPool.CharArrayRange expectedName) throws Exception ; 630 631 646 public void scanQName(char fastcheck, QName qname) throws Exception ; 647 648 669 public int scanContent(QName element) throws Exception ; 670 } 671 } 672 | Popular Tags |