ReactOS  0.4.14-dev-1256-g2125fec
SAX.c
Go to the documentation of this file.
1 /*
2  * SAX.c : Old SAX v1 handlers to build a tree.
3  * Deprecated except for compatibility
4  *
5  * See Copyright for the status of this software.
6  *
7  * Daniel Veillard <daniel@veillard.com>
8  */
9 
10 
11 #define IN_LIBXML
12 #include "libxml.h"
13 #include <stdlib.h>
14 #include <string.h>
15 #include <libxml/xmlmemory.h>
16 #include <libxml/tree.h>
17 #include <libxml/parser.h>
18 #include <libxml/parserInternals.h>
19 #include <libxml/valid.h>
20 #include <libxml/entities.h>
21 #include <libxml/xmlerror.h>
22 #include <libxml/debugXML.h>
23 #include <libxml/xmlIO.h>
24 #include <libxml/SAX.h>
25 #include <libxml/uri.h>
26 #include <libxml/valid.h>
27 #include <libxml/HTMLtree.h>
28 #include <libxml/globals.h>
29 #include <libxml/SAX2.h>
30 
31 #ifdef LIBXML_LEGACY_ENABLED
32 #ifdef LIBXML_SAX1_ENABLED
33 
41 void
42 initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
43 {
44 
45  if(hdlr->initialized == 1)
46  return;
47 
64  hdlr->startElement = xmlSAX2StartElement;
65  hdlr->endElement = xmlSAX2EndElement;
71  if (warning == 0)
72  hdlr->warning = NULL;
73  else
74  hdlr->warning = xmlParserWarning;
75  hdlr->error = xmlParserError;
76  hdlr->fatalError = xmlParserError;
77 
78  hdlr->initialized = 1;
79 }
80 
81 #ifdef LIBXML_HTML_ENABLED
82 
90 void
91 inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
92 {
93  if(hdlr->initialized == 1)
94  return;
95 
97  hdlr->externalSubset = NULL;
98  hdlr->isStandalone = NULL;
99  hdlr->hasInternalSubset = NULL;
100  hdlr->hasExternalSubset = NULL;
101  hdlr->resolveEntity = NULL;
102  hdlr->getEntity = xmlSAX2GetEntity;
103  hdlr->getParameterEntity = NULL;
104  hdlr->entityDecl = NULL;
105  hdlr->attributeDecl = NULL;
106  hdlr->elementDecl = NULL;
107  hdlr->notationDecl = NULL;
108  hdlr->unparsedEntityDecl = NULL;
112  hdlr->startElement = xmlSAX2StartElement;
113  hdlr->endElement = xmlSAX2EndElement;
114  hdlr->reference = NULL;
119  hdlr->comment = xmlSAX2Comment;
120  hdlr->warning = xmlParserWarning;
121  hdlr->error = xmlParserError;
122  hdlr->fatalError = xmlParserError;
123 
124  hdlr->initialized = 1;
125 }
126 
127 #endif /* LIBXML_HTML_ENABLED */
128 
129 #ifdef LIBXML_DOCB_ENABLED
130 
137 void
138 initdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
139 {
140  if(hdlr->initialized == 1)
141  return;
142 
144  hdlr->externalSubset = NULL;
149  hdlr->getEntity = xmlSAX2GetEntity;
150  hdlr->getParameterEntity = NULL;
152  hdlr->attributeDecl = NULL;
153  hdlr->elementDecl = NULL;
154  hdlr->notationDecl = NULL;
155  hdlr->unparsedEntityDecl = NULL;
159  hdlr->startElement = xmlSAX2StartElement;
160  hdlr->endElement = xmlSAX2EndElement;
161  hdlr->reference = xmlSAX2Reference;
163  hdlr->cdataBlock = NULL;
165  hdlr->processingInstruction = NULL;
166  hdlr->comment = xmlSAX2Comment;
167  hdlr->warning = xmlParserWarning;
168  hdlr->error = xmlParserError;
169  hdlr->fatalError = xmlParserError;
170 
171  hdlr->initialized = 1;
172 }
173 
174 #endif /* LIBXML_DOCB_ENABLED */
175 
176 #endif /* LIBXML_SAX1_ENABLED */
177 
178 #define bottom_SAX
179 #include "elfgcchack.h"
180 #endif /* LIBXML_LEGACY_ENABLED */
XMLPUBFUN void XMLCALL xmlSAX2Comment(void *ctx, const xmlChar *value)
Definition: SAX2.c:2742
XMLPUBFUN int XMLCALL xmlSAX2HasExternalSubset(void *ctx)
Definition: SAX2.c:337
XMLPUBFUN void XMLCALL xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, const xmlChar *data)
Definition: SAX2.c:2678
XMLPUBFUN void XMLCALL xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
Definition: SAX2.c:2532
errorSAXFunc error
Definition: parser.h:783
XMLPUBFUN void XMLCALL xmlSAX2StartDocument(void *ctx)
Definition: SAX2.c:983
attributeDeclSAXFunc attributeDecl
Definition: parser.h:769
XMLPUBFUN void XMLCALL xmlSAX2EndDocument(void *ctx)
Definition: SAX2.c:1048
fatalErrorSAXFunc fatalError
Definition: parser.h:784
hasInternalSubsetSAXFunc hasInternalSubset
Definition: parser.h:763
XMLPUBFUN void XMLCALL xmlSAX2ElementDecl(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)
Definition: SAX2.c:802
XMLPUBFUN void XMLCALL xmlSAX2NotationDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:848
elementDeclSAXFunc elementDecl
Definition: parser.h:770
XMLPUBFUN void XMLCALL xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
Definition: SAX2.c:664
externalSubsetSAXFunc externalSubset
Definition: parser.h:787
startElementSAXFunc startElement
Definition: parser.h:775
referenceSAXFunc reference
Definition: parser.h:777
XMLPUBFUN int XMLCALL xmlSAX2HasInternalSubset(void *ctx)
Definition: SAX2.c:321
XMLPUBFUN void XMLCALL xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:392
endElementSAXFunc endElement
Definition: parser.h:776
resolveEntitySAXFunc resolveEntity
Definition: parser.h:765
smooth NULL
Definition: ftsmooth.c:416
XMLPUBFUN void XMLCALL xmlSAX2SetDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
setDocumentLocatorSAXFunc setDocumentLocator
Definition: parser.h:772
XMLPUBFUN void XMLCALL xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
Definition: SAX2.c:734
XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace(void *ctx, const xmlChar *ch, int len)
getEntitySAXFunc getEntity
Definition: parser.h:766
unparsedEntityDeclSAXFunc unparsedEntityDecl
Definition: parser.h:771
XMLPUBFUN void XMLCDECL xmlParserError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
charactersSAXFunc characters
Definition: parser.h:778
getParameterEntitySAXFunc getParameterEntity
Definition: parser.h:785
XMLPUBFUN void XMLCALL xmlSAX2InternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:354
startDocumentSAXFunc startDocument
Definition: parser.h:773
ignorableWhitespaceSAXFunc ignorableWhitespace
Definition: parser.h:779
XMLPUBFUN void XMLCALL xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
Definition: SAX2.c:899
isStandaloneSAXFunc isStandalone
Definition: parser.h:762
processingInstructionSAXFunc processingInstruction
Definition: parser.h:780
internalSubsetSAXFunc internalSubset
Definition: parser.h:761
XMLPUBFUN void XMLCALL xmlSAX2Reference(void *ctx, const xmlChar *name)
Definition: SAX2.c:2500
hasExternalSubsetSAXFunc hasExternalSubset
Definition: parser.h:764
endDocumentSAXFunc endDocument
Definition: parser.h:774
XMLPUBFUN xmlParserInputPtr XMLCALL xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:519
XMLPUBFUN int XMLCALL xmlSAX2IsStandalone(void *ctx)
Definition: SAX2.c:305
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
entityDeclSAXFunc entityDecl
Definition: parser.h:767
cdataBlockSAXFunc cdataBlock
Definition: parser.h:786
warningSAXFunc warning
Definition: parser.h:782
XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:556
XMLPUBFUN void XMLCALL xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
Definition: SAX2.c:2804
XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:636
commentSAXFunc comment
Definition: parser.h:781
notationDeclSAXFunc notationDecl
Definition: parser.h:768
unsigned int initialized
Definition: parser.h:788
#define warning(s)
Definition: debug.h:71