1 16 17 package org.apache.xerces.parsers; 18 19 import org.apache.xerces.xni.Augmentations; 20 import org.apache.xerces.xni.NamespaceContext; 21 import org.apache.xerces.xni.QName; 22 import org.apache.xerces.xni.XMLAttributes; 23 import org.apache.xerces.xni.XMLDTDContentModelHandler; 24 import org.apache.xerces.xni.XMLDTDHandler; 25 import org.apache.xerces.xni.XMLDocumentHandler; 26 import org.apache.xerces.xni.XMLLocator; 27 import org.apache.xerces.xni.XMLResourceIdentifier; 28 import org.apache.xerces.xni.XMLString; 29 import org.apache.xerces.xni.XNIException; 30 import org.apache.xerces.xni.parser.XMLDTDContentModelSource; 31 import org.apache.xerces.xni.parser.XMLDTDSource; 32 import org.apache.xerces.xni.parser.XMLDocumentSource; 33 import org.apache.xerces.xni.parser.XMLParserConfiguration; 34 35 47 public abstract class AbstractXMLDocumentParser 48 extends XMLParser 49 implements XMLDocumentHandler, XMLDTDHandler, XMLDTDContentModelHandler { 50 51 55 57 58 protected boolean fInDTD; 59 60 61 protected XMLDocumentSource fDocumentSource; 62 63 64 protected XMLDTDSource fDTDSource; 65 66 67 protected XMLDTDContentModelSource fDTDContentModelSource; 68 69 73 77 protected AbstractXMLDocumentParser(XMLParserConfiguration config) { 78 super(config); 79 80 config.setDocumentHandler(this); 82 config.setDTDHandler(this); 83 config.setDTDContentModelHandler(this); 84 85 } 87 91 113 114 public void startDocument(XMLLocator locator, String encoding, 115 NamespaceContext namespaceContext, Augmentations augs) 116 throws XNIException { 117 } 119 132 public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) 133 throws XNIException { 134 } 136 148 public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) 149 throws XNIException { 150 } 152 163 public void startElement(QName element, XMLAttributes attributes, Augmentations augs) 164 throws XNIException { 165 } 167 176 public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs) 177 throws XNIException { 178 179 startElement(element, attributes, augs); 180 endElement(element, augs); 181 182 } 184 192 public void characters(XMLString text, Augmentations augs) throws XNIException { 193 } 195 208 public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException { 209 } 211 219 public void endElement(QName element, Augmentations augs) throws XNIException { 220 } 222 228 public void startCDATA(Augmentations augs) throws XNIException { 229 } 231 237 public void endCDATA(Augmentations augs) throws XNIException { 238 } 240 246 public void endDocument(Augmentations augs) throws XNIException { 247 } 249 250 267 public void startGeneralEntity(String name, 268 XMLResourceIdentifier identifier, 269 String encoding, 270 Augmentations augs) throws XNIException { 271 } 273 291 public void textDecl(String version, String encoding, Augmentations augs) throws XNIException { 292 } 294 306 public void endGeneralEntity(String name, Augmentations augs) 307 throws XNIException { 308 } 310 319 public void comment(XMLString text, Augmentations augs) throws XNIException { 320 } 322 340 public void processingInstruction(String target, XMLString data, Augmentations augs) 341 throws XNIException { 342 } 344 345 346 public void setDocumentSource(XMLDocumentSource source){ 347 fDocumentSource = source; 348 } 350 351 public XMLDocumentSource getDocumentSource (){ 352 return fDocumentSource; 353 } 358 372 public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException { 373 fInDTD = true; 374 } 376 377 385 public void startExternalSubset(XMLResourceIdentifier identifier, Augmentations augmentations) 386 throws XNIException { 387 } 389 397 public void endExternalSubset(Augmentations augmentations) 398 throws XNIException { 399 } 401 418 public void startParameterEntity(String name, 419 XMLResourceIdentifier identifier, 420 String encoding, 421 Augmentations augs) throws XNIException { 422 } 424 436 public void endParameterEntity(String name, Augmentations augs) 437 throws XNIException { 438 } 440 449 public void ignoredCharacters(XMLString text, Augmentations augs) throws XNIException { 450 } 452 462 public void elementDecl(String name, String contentModel, Augmentations augs) 463 throws XNIException { 464 } 466 476 public void startAttlist(String elementName, Augmentations augs) throws XNIException { 477 } 479 504 public void attributeDecl(String elementName, String attributeName, 505 String type, String [] enumeration, 506 String defaultType, XMLString defaultValue, 507 XMLString nonNormalizedDefaultValue, Augmentations augs) 508 throws XNIException { 509 } 511 519 public void endAttlist(Augmentations augs) throws XNIException { 520 } 522 538 public void internalEntityDecl(String name, XMLString text, 539 XMLString nonNormalizedText, Augmentations augs) 540 throws XNIException { 541 } 543 556 public void externalEntityDecl(String name, XMLResourceIdentifier identifier, 557 Augmentations augs) throws XNIException { 558 } 560 572 public void unparsedEntityDecl(String name, XMLResourceIdentifier identifier, 573 String notation, Augmentations augs) throws XNIException { 574 } 576 587 public void notationDecl(String name, XMLResourceIdentifier identifier, 588 Augmentations augs) 589 throws XNIException { 590 } 592 605 public void startConditional(short type, Augmentations augs) throws XNIException { 606 } 608 616 public void endConditional(Augmentations augs) throws XNIException { 617 } 619 627 public void endDTD(Augmentations augs) throws XNIException { 628 fInDTD = false; 629 } 631 public void setDTDSource(XMLDTDSource source) { 633 fDTDSource = source; 634 } 635 636 public XMLDTDSource getDTDSource() { 638 return fDTDSource; 639 } 640 641 645 656 public void startContentModel(String elementName, Augmentations augs) throws XNIException { 657 } 659 670 public void any(Augmentations augs) throws XNIException { 671 } 673 684 public void empty(Augmentations augs) throws XNIException { 685 } 687 701 public void startGroup(Augmentations augs) throws XNIException { 702 } 704 716 public void pcdata(Augmentations augs) throws XNIException { 717 } 719 728 public void element(String elementName, Augmentations augs) throws XNIException { 729 } 731 744 public void separator(short separator, Augmentations augs) throws XNIException { 745 } 747 762 public void occurrence(short occurrence, Augmentations augs) throws XNIException { 763 } 765 773 public void endGroup(Augmentations augs) throws XNIException { 774 } 776 784 public void endContentModel(Augmentations augs) throws XNIException { 785 } 787 public void setDTDContentModelSource(XMLDTDContentModelSource source) { 789 fDTDContentModelSource = source; 790 } 791 792 public XMLDTDContentModelSource getDTDContentModelSource() { 794 return fDTDContentModelSource; 795 } 796 797 801 804 protected void reset() throws XNIException { 805 super.reset(); 806 fInDTD = false; 807 } 809 } | Popular Tags |