* xmlSAXVersion: * @hdlr: the SAX handler * @version: the version, 1 or 2 * * Initialize the default XML SAX handler according to the version * * Returns 0 in case of success and -1 in case of error. */
| 2648 | * Returns 0 in case of success and -1 in case of error. |
| 2649 | */ |
| 2650 | int |
| 2651 | xmlSAXVersion(xmlSAXHandler *hdlr, int version) |
| 2652 | { |
| 2653 | if (hdlr == NULL) return(-1); |
| 2654 | if (version == 2) { |
| 2655 | hdlr->startElementNs = xmlSAX2StartElementNs; |
| 2656 | hdlr->endElementNs = xmlSAX2EndElementNs; |
| 2657 | hdlr->serror = NULL; |
| 2658 | hdlr->initialized = XML_SAX2_MAGIC; |
| 2659 | #ifdef LIBXML_SAX1_ENABLED |
| 2660 | } else if (version == 1) { |
| 2661 | hdlr->initialized = 1; |
| 2662 | #endif /* LIBXML_SAX1_ENABLED */ |
| 2663 | } else |
| 2664 | return(-1); |
| 2665 | #ifdef LIBXML_SAX1_ENABLED |
| 2666 | hdlr->startElement = xmlSAX2StartElement; |
| 2667 | hdlr->endElement = xmlSAX2EndElement; |
| 2668 | #else |
| 2669 | hdlr->startElement = NULL; |
| 2670 | hdlr->endElement = NULL; |
| 2671 | #endif /* LIBXML_SAX1_ENABLED */ |
| 2672 | hdlr->internalSubset = xmlSAX2InternalSubset; |
| 2673 | hdlr->externalSubset = xmlSAX2ExternalSubset; |
| 2674 | hdlr->isStandalone = xmlSAX2IsStandalone; |
| 2675 | hdlr->hasInternalSubset = xmlSAX2HasInternalSubset; |
| 2676 | hdlr->hasExternalSubset = xmlSAX2HasExternalSubset; |
| 2677 | hdlr->resolveEntity = xmlSAX2ResolveEntity; |
| 2678 | hdlr->getEntity = xmlSAX2GetEntity; |
| 2679 | hdlr->getParameterEntity = xmlSAX2GetParameterEntity; |
| 2680 | hdlr->entityDecl = xmlSAX2EntityDecl; |
| 2681 | hdlr->attributeDecl = xmlSAX2AttributeDecl; |
| 2682 | hdlr->elementDecl = xmlSAX2ElementDecl; |
| 2683 | hdlr->notationDecl = xmlSAX2NotationDecl; |
| 2684 | hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl; |
| 2685 | hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator; |
| 2686 | hdlr->startDocument = xmlSAX2StartDocument; |
| 2687 | hdlr->endDocument = xmlSAX2EndDocument; |
| 2688 | hdlr->reference = xmlSAX2Reference; |
| 2689 | hdlr->characters = xmlSAX2Characters; |
| 2690 | hdlr->cdataBlock = xmlSAX2CDataBlock; |
| 2691 | hdlr->ignorableWhitespace = xmlSAX2Characters; |
| 2692 | hdlr->processingInstruction = xmlSAX2ProcessingInstruction; |
| 2693 | hdlr->comment = xmlSAX2Comment; |
| 2694 | hdlr->warning = xmlParserWarning; |
| 2695 | hdlr->error = xmlParserError; |
| 2696 | hdlr->fatalError = xmlParserError; |
| 2697 | |
| 2698 | return(0); |
| 2699 | } |
| 2700 | |
| 2701 | /** |
| 2702 | * xmlSAX2InitDefaultSAXHandler: |
no outgoing calls