ReactOS  0.4.15-dev-3303-g1ade494
SAX2.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/xlink.h>
Include dependency graph for SAX2.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

XMLPUBFUN const xmlChar *XMLCALL xmlSAX2GetPublicId (void *ctx)
 
XMLPUBFUN const xmlChar *XMLCALL xmlSAX2GetSystemId (void *ctx)
 
XMLPUBFUN void XMLCALL xmlSAX2SetDocumentLocator (void *ctx, xmlSAXLocatorPtr loc)
 
XMLPUBFUN int XMLCALL xmlSAX2GetLineNumber (void *ctx)
 
XMLPUBFUN int XMLCALL xmlSAX2GetColumnNumber (void *ctx)
 
XMLPUBFUN int XMLCALL xmlSAX2IsStandalone (void *ctx)
 
XMLPUBFUN int XMLCALL xmlSAX2HasInternalSubset (void *ctx)
 
XMLPUBFUN int XMLCALL xmlSAX2HasExternalSubset (void *ctx)
 
XMLPUBFUN void XMLCALL xmlSAX2InternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
 
XMLPUBFUN void XMLCALL xmlSAX2ExternalSubset (void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
 
XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetEntity (void *ctx, const xmlChar *name)
 
XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetParameterEntity (void *ctx, const xmlChar *name)
 
XMLPUBFUN xmlParserInputPtr XMLCALL xmlSAX2ResolveEntity (void *ctx, const xmlChar *publicId, const xmlChar *systemId)
 
XMLPUBFUN void XMLCALL xmlSAX2EntityDecl (void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
 
XMLPUBFUN void XMLCALL xmlSAX2AttributeDecl (void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
 
XMLPUBFUN void XMLCALL xmlSAX2ElementDecl (void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)
 
XMLPUBFUN void XMLCALL xmlSAX2NotationDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
 
XMLPUBFUN void XMLCALL xmlSAX2UnparsedEntityDecl (void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
 
XMLPUBFUN void XMLCALL xmlSAX2StartDocument (void *ctx)
 
XMLPUBFUN void XMLCALL xmlSAX2EndDocument (void *ctx)
 
XMLPUBFUN void XMLCALL xmlSAX2StartElementNs (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
 
XMLPUBFUN void XMLCALL xmlSAX2EndElementNs (void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
 
XMLPUBFUN void XMLCALL xmlSAX2Reference (void *ctx, const xmlChar *name)
 
XMLPUBFUN void XMLCALL xmlSAX2Characters (void *ctx, const xmlChar *ch, int len)
 
XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace (void *ctx, const xmlChar *ch, int len)
 
XMLPUBFUN void XMLCALL xmlSAX2ProcessingInstruction (void *ctx, const xmlChar *target, const xmlChar *data)
 
XMLPUBFUN void XMLCALL xmlSAX2Comment (void *ctx, const xmlChar *value)
 
XMLPUBFUN void XMLCALL xmlSAX2CDataBlock (void *ctx, const xmlChar *value, int len)
 
XMLPUBFUN int XMLCALL xmlSAXVersion (xmlSAXHandler *hdlr, int version)
 
XMLPUBFUN void XMLCALL xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr, int warning)
 
XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit (void)
 

Function Documentation

◆ xmlDefaultSAXHandlerInit()

XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit ( void  )

xmlDefaultSAXHandlerInit:

Initialize the default SAX2 handler

Definition at line 2913 of file SAX2.c.

2914 {
2915 #ifdef LIBXML_SAX1_ENABLED
2917 #endif /* LIBXML_SAX1_ENABLED */
2918 }
int xmlSAXVersion(xmlSAXHandler *hdlr, int version)
Definition: SAX2.c:2840
XMLPUBVAR xmlSAXHandlerV1 xmlDefaultSAXHandler
Definition: globals.h:321

Referenced by xmlInitParser(), xmlInitParserCtxt(), and xmlParseExtParsedEnt().

◆ xmlSAX2AttributeDecl()

XMLPUBFUN void XMLCALL xmlSAX2AttributeDecl ( void ctx,
const xmlChar elem,
const xmlChar fullname,
int  type,
int  def,
const xmlChar defaultValue,
xmlEnumerationPtr  tree 
)

Definition at line 704 of file SAX2.c.

707 {
710  xmlChar *name = NULL, *prefix = NULL;
711 
712  if ((ctxt == NULL) || (ctxt->myDoc == NULL))
713  return;
714 
715 #ifdef DEBUG_SAX
717  "SAX.xmlSAX2AttributeDecl(%s, %s, %d, %d, %s, ...)\n",
718  elem, fullname, type, def, defaultValue);
719 #endif
720  if ((xmlStrEqual(fullname, BAD_CAST "xml:id")) &&
721  (type != XML_ATTRIBUTE_ID)) {
722  /*
723  * Raise the error but keep the validity flag
724  */
725  int tmp = ctxt->valid;
726  xmlErrValid(ctxt, XML_DTD_XMLID_TYPE,
727  "xml:id : attribute type should be ID\n", NULL, NULL);
728  ctxt->valid = tmp;
729  }
730  /* TODO: optimize name/prefix allocation */
731  name = xmlSplitQName(ctxt, fullname, &prefix);
732  ctxt->vctxt.valid = 1;
733  if (ctxt->inSubset == 1)
734  attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
735  name, prefix, (xmlAttributeType) type,
736  (xmlAttributeDefault) def, defaultValue, tree);
737  else if (ctxt->inSubset == 2)
738  attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem,
739  name, prefix, (xmlAttributeType) type,
740  (xmlAttributeDefault) def, defaultValue, tree);
741  else {
742  xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
743  "SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n",
744  name, NULL);
746  return;
747  }
748 #ifdef LIBXML_VALID_ENABLED
749  if (ctxt->vctxt.valid == 0)
750  ctxt->valid = 0;
751  if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) &&
752  (ctxt->myDoc->intSubset != NULL))
753  ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
754  attr);
755 #endif /* LIBXML_VALID_ENABLED */
756  if (prefix != NULL)
757  xmlFree(prefix);
758  if (name != NULL)
759  xmlFree(name);
760 }
struct _xmlDtd * intSubset
Definition: tree.h:570
static size_t elem
Definition: string.c:68
XMLPUBFUN xmlChar *XMLCALL xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix)
Definition: parser.c:2949
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
#define BAD_CAST
Definition: xmlstring.h:35
int validate
Definition: parser.h:222
int wellFormed
Definition: parser.h:190
xmlAttributeDefault
Definition: tree.h:225
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
Definition: cookie.c:201
xmlDocPtr myDoc
Definition: parser.h:189
__u8 attr
Definition: mkdosfs.c:359
const char * fullname
Definition: shader.c:1766
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN xmlAttributePtr XMLCALL xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *elem, const xmlChar *name, const xmlChar *ns, xmlAttributeType type, xmlAttributeDefault def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
Definition: valid.c:1981
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:159
xmlValidCtxt vctxt
Definition: parser.h:223
int valid
Definition: valid.h:95
XMLPUBFUN void XMLCALL xmlFreeEnumeration(xmlEnumerationPtr cur)
Definition: valid.c:1831
xmlAttributeType
Definition: tree.h:206
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2CDataBlock()

XMLPUBFUN void XMLCALL xmlSAX2CDataBlock ( void ctx,
const xmlChar value,
int  len 
)

xmlSAX2CDataBlock: @ctx: the user data (XML parser context) @value: The pcdata content @len: the block length

called when a pcdata block has been parsed

Definition at line 2798 of file SAX2.c.

2799 {
2801 }
Definition: pdh_main.c:93
GLenum GLsizei len
Definition: glext.h:6722
static void xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len, xmlElementType type)
Definition: SAX2.c:2505

Referenced by xmlSAXVersion().

◆ xmlSAX2Characters()

XMLPUBFUN void XMLCALL xmlSAX2Characters ( void ctx,
const xmlChar ch,
int  len 
)

xmlSAX2Characters: @ctx: the user data (XML parser context) @ch: a xmlChar string @len: the number of xmlChar

receiving some chars from the parser.

Definition at line 2639 of file SAX2.c.

2640 {
2642 }
GLenum GLsizei len
Definition: glext.h:6722
static void xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len, xmlElementType type)
Definition: SAX2.c:2505

Referenced by xmlSAXVersion().

◆ xmlSAX2Comment()

XMLPUBFUN void XMLCALL xmlSAX2Comment ( void ctx,
const xmlChar value 
)

xmlSAX2Comment: @ctx: the user data (XML parser context) @value: the xmlSAX2Comment content

A xmlSAX2Comment has been parsed.

Definition at line 2736 of file SAX2.c.

2737 {
2739  xmlNodePtr ret;
2741 
2742  if (ctx == NULL) return;
2743  parent = ctxt->node;
2744 #ifdef DEBUG_SAX
2745  xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Comment(%s)\n", value);
2746 #endif
2747  ret = xmlNewDocComment(ctxt->myDoc, value);
2748  if (ret == NULL) return;
2749  if (ctxt->linenumbers) {
2750  if (ctxt->input != NULL) {
2751  if (ctxt->input->line < 65535)
2752  ret->line = (short) ctxt->input->line;
2753  else
2754  ret->line = 65535;
2755  }
2756  }
2757 
2758  if (ctxt->inSubset == 1) {
2760  return;
2761  } else if (ctxt->inSubset == 2) {
2763  return;
2764  }
2765  if (parent == NULL) {
2766 #ifdef DEBUG_SAX_TREE
2768  "Setting xmlSAX2Comment as root\n");
2769 #endif
2771  return;
2772  }
2773  if (parent->type == XML_ELEMENT_NODE) {
2774 #ifdef DEBUG_SAX_TREE
2776  "adding xmlSAX2Comment child to %s\n", parent->name);
2777 #endif
2779  } else {
2780 #ifdef DEBUG_SAX_TREE
2782  "adding xmlSAX2Comment sibling to ");
2783  xmlDebugDumpOneNode(stderr, parent, 0);
2784 #endif
2786  }
2787 }
Definition: pdh_main.c:93
struct _xmlDtd * intSubset
Definition: tree.h:570
XMLPUBFUN xmlNodePtr XMLCALL xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem)
xmlParserInputPtr input
Definition: parser.h:201
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
int linenumbers
Definition: parser.h:261
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
xmlNodePtr node
Definition: parser.h:207
r parent
Definition: btrfs.c:2944
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocComment(xmlDocPtr doc, const xmlChar *content)
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
struct _xmlDtd * extSubset
Definition: tree.h:571
FILE * stderr
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2ElementDecl()

XMLPUBFUN void XMLCALL xmlSAX2ElementDecl ( void ctx,
const xmlChar name,
int  type,
xmlElementContentPtr  content 
)

Definition at line 772 of file SAX2.c.

774 {
777 
778  if ((ctxt == NULL) || (ctxt->myDoc == NULL))
779  return;
780 
781 #ifdef DEBUG_SAX
783  "SAX.xmlSAX2ElementDecl(%s, %d, ...)\n", name, type);
784 #endif
785 
786  if (ctxt->inSubset == 1)
787  elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset,
789  else if (ctxt->inSubset == 2)
790  elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset,
792  else {
793  xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
794  "SAX.xmlSAX2ElementDecl(%s) called while not in subset\n",
795  name, NULL);
796  return;
797  }
798 #ifdef LIBXML_VALID_ENABLED
799  if (elem == NULL)
800  ctxt->valid = 0;
801  if (ctxt->validate && ctxt->wellFormed &&
802  ctxt->myDoc && ctxt->myDoc->intSubset)
803  ctxt->valid &=
804  xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem);
805 #endif /* LIBXML_VALID_ENABLED */
806 }
struct _xmlDtd * intSubset
Definition: tree.h:570
xmlElementTypeVal
Definition: tree.h:322
static size_t elem
Definition: string.c:68
content
Definition: atl_ax.c:993
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
int validate
Definition: parser.h:222
int wellFormed
Definition: parser.h:190
xmlDocPtr myDoc
Definition: parser.h:189
XMLPUBFUN xmlElementPtr XMLCALL xmlAddElementDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, xmlElementTypeVal type, xmlElementContentPtr content)
Definition: valid.c:1430
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
xmlValidCtxt vctxt
Definition: parser.h:223
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2EndDocument()

XMLPUBFUN void XMLCALL xmlSAX2EndDocument ( void ctx)

xmlSAX2EndDocument: @ctx: the user data (XML parser context)

called when the document end has been detected.

Definition at line 1018 of file SAX2.c.

1019 {
1021 #ifdef DEBUG_SAX
1023  "SAX.xmlSAX2EndDocument()\n");
1024 #endif
1025  if (ctx == NULL) return;
1026 #ifdef LIBXML_VALID_ENABLED
1027  if (ctxt->validate && ctxt->wellFormed &&
1028  ctxt->myDoc && ctxt->myDoc->intSubset)
1029  ctxt->valid &= xmlValidateDocumentFinal(&ctxt->vctxt, ctxt->myDoc);
1030 #endif /* LIBXML_VALID_ENABLED */
1031 
1032  /*
1033  * Grab the encoding if it was added on-the-fly
1034  */
1035  if ((ctxt->encoding != NULL) && (ctxt->myDoc != NULL) &&
1036  (ctxt->myDoc->encoding == NULL)) {
1037  ctxt->myDoc->encoding = ctxt->encoding;
1038  ctxt->encoding = NULL;
1039  }
1040  if ((ctxt->inputTab != NULL) &&
1041  (ctxt->inputNr > 0) && (ctxt->inputTab[0] != NULL) &&
1042  (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) &&
1043  (ctxt->myDoc->encoding == NULL)) {
1044  ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding);
1045  }
1046  if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) &&
1047  (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) {
1048  ctxt->myDoc->charset = ctxt->charset;
1049  }
1050 }
xmlParserInputPtr * inputTab
Definition: parser.h:204
struct _xmlDtd * intSubset
Definition: tree.h:570
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
int validate
Definition: parser.h:222
int wellFormed
Definition: parser.h:190
xmlDocPtr myDoc
Definition: parser.h:189
const xmlChar * encoding
Definition: parser.h:193
const xmlChar * encoding
Definition: tree.h:574
int charset
Definition: tree.h:578
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
const xmlChar * encoding
Definition: parser.h:73
xmlValidCtxt vctxt
Definition: parser.h:223
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2EndElementNs()

XMLPUBFUN void XMLCALL xmlSAX2EndElementNs ( void ctx,
const xmlChar localname,
const xmlChar prefix,
const xmlChar URI 
)

◆ xmlSAX2EntityDecl()

XMLPUBFUN void XMLCALL xmlSAX2EntityDecl ( void ctx,
const xmlChar name,
int  type,
const xmlChar publicId,
const xmlChar systemId,
xmlChar content 
)

Definition at line 634 of file SAX2.c.

636 {
637  xmlEntityPtr ent;
639 
640  if (ctx == NULL) return;
641 #ifdef DEBUG_SAX
643  "SAX.xmlSAX2EntityDecl(%s, %d, %s, %s, %s)\n",
644  name, type, publicId, systemId, content);
645 #endif
646  if (ctxt->inSubset == 1) {
647  ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId,
648  systemId, content);
649  if ((ent == NULL) && (ctxt->pedantic))
650  xmlWarnMsg(ctxt, XML_WAR_ENTITY_REDEFINED,
651  "Entity(%s) already defined in the internal subset\n",
652  name);
653  if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
654  xmlChar *URI;
655  const char *base = NULL;
656 
657  if (ctxt->input != NULL)
658  base = ctxt->input->filename;
659  if (base == NULL)
660  base = ctxt->directory;
661 
662  URI = xmlBuildURI(systemId, (const xmlChar *) base);
663  ent->URI = URI;
664  }
665  } else if (ctxt->inSubset == 2) {
666  ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId,
667  systemId, content);
668  if ((ent == NULL) && (ctxt->pedantic) &&
669  (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
670  ctxt->sax->warning(ctxt->userData,
671  "Entity(%s) already defined in the external subset\n", name);
672  if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
673  xmlChar *URI;
674  const char *base = NULL;
675 
676  if (ctxt->input != NULL)
677  base = ctxt->input->filename;
678  if (base == NULL)
679  base = ctxt->directory;
680 
681  URI = xmlBuildURI(systemId, (const xmlChar *) base);
682  ent->URI = URI;
683  }
684  } else {
685  xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING,
686  "SAX.xmlSAX2EntityDecl(%s) called while not in subset\n",
687  name, NULL);
688  }
689 }
int pedantic
Definition: parser.h:257
const xmlChar * URI
Definition: entities.h:57
xmlParserInputPtr input
Definition: parser.h:201
content
Definition: atl_ax.c:993
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlChar *XMLCALL xmlBuildURI(const xmlChar *URI, const xmlChar *base)
Definition: uri.c:1891
XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content)
xmlDocPtr myDoc
Definition: parser.h:189
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
const char * filename
Definition: parser.h:58
int inSubset
Definition: parser.h:240
XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content)
#define NULL
Definition: types.h:112
char * directory
Definition: parser.h:228
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
Definition: name.c:38
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
void * userData
Definition: parser.h:188
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlParseEntityDecl(), and xmlSAXVersion().

◆ xmlSAX2ExternalSubset()

XMLPUBFUN void XMLCALL xmlSAX2ExternalSubset ( void ctx,
const xmlChar name,
const xmlChar ExternalID,
const xmlChar SystemID 
)

Definition at line 392 of file SAX2.c.

394 {
396  if (ctx == NULL) return;
397 #ifdef DEBUG_SAX
399  "SAX.xmlSAX2ExternalSubset(%s, %s, %s)\n",
400  name, ExternalID, SystemID);
401 #endif
402  if (((ExternalID != NULL) || (SystemID != NULL)) &&
403  (((ctxt->validate) || (ctxt->loadsubset != 0)) &&
404  (ctxt->wellFormed && ctxt->myDoc))) {
405  /*
406  * Try to fetch and parse the external subset.
407  */
408  xmlParserInputPtr oldinput;
409  int oldinputNr;
410  int oldinputMax;
411  xmlParserInputPtr *oldinputTab;
413  xmlCharEncoding enc;
414  int oldcharset;
415  const xmlChar *oldencoding;
416 
417  /*
418  * Ask the Entity resolver to load the damn thing
419  */
420  if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
421  input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
422  SystemID);
423  if (input == NULL) {
424  return;
425  }
426 
427  xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID);
428 
429  /*
430  * make sure we won't destroy the main document context
431  */
432  oldinput = ctxt->input;
433  oldinputNr = ctxt->inputNr;
434  oldinputMax = ctxt->inputMax;
435  oldinputTab = ctxt->inputTab;
436  oldcharset = ctxt->charset;
437  oldencoding = ctxt->encoding;
438  ctxt->encoding = NULL;
439 
440  ctxt->inputTab = (xmlParserInputPtr *)
441  xmlMalloc(5 * sizeof(xmlParserInputPtr));
442  if (ctxt->inputTab == NULL) {
443  xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset");
444  ctxt->input = oldinput;
445  ctxt->inputNr = oldinputNr;
446  ctxt->inputMax = oldinputMax;
447  ctxt->inputTab = oldinputTab;
448  ctxt->charset = oldcharset;
449  ctxt->encoding = oldencoding;
450  return;
451  }
452  ctxt->inputNr = 0;
453  ctxt->inputMax = 5;
454  ctxt->input = NULL;
455  xmlPushInput(ctxt, input);
456 
457  /*
458  * On the fly encoding conversion if needed
459  */
460  if (ctxt->input->length >= 4) {
461  enc = xmlDetectCharEncoding(ctxt->input->cur, 4);
462  xmlSwitchEncoding(ctxt, enc);
463  }
464 
465  if (input->filename == NULL)
466  input->filename = (char *) xmlCanonicPath(SystemID);
467  input->line = 1;
468  input->col = 1;
469  input->base = ctxt->input->cur;
470  input->cur = ctxt->input->cur;
471  input->free = NULL;
472 
473  /*
474  * let's parse that entity knowing it's an external subset.
475  */
476  xmlParseExternalSubset(ctxt, ExternalID, SystemID);
477 
478  /*
479  * Free up the external entities
480  */
481 
482  while (ctxt->inputNr > 1)
483  xmlPopInput(ctxt);
484  xmlFreeInputStream(ctxt->input);
485  xmlFree(ctxt->inputTab);
486 
487  /*
488  * Restore the parsing context of the main entity
489  */
490  ctxt->input = oldinput;
491  ctxt->inputNr = oldinputNr;
492  ctxt->inputMax = oldinputMax;
493  ctxt->inputTab = oldinputTab;
494  ctxt->charset = oldcharset;
495  if ((ctxt->encoding != NULL) &&
496  ((ctxt->dict == NULL) ||
497  (!xmlDictOwns(ctxt->dict, ctxt->encoding))))
498  xmlFree((xmlChar *) ctxt->encoding);
499  ctxt->encoding = oldencoding;
500  /* ctxt->wellFormed = oldwellFormed; */
501  }
502 }
XMLPUBFUN xmlDtdPtr XMLCALL xmlNewDtd(xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
xmlParserInputPtr * inputTab
Definition: parser.h:204
XMLPUBFUN int XMLCALL xmlPushInput(xmlParserCtxtPtr ctxt, xmlParserInputPtr input)
Definition: parser.c:2293
const xmlChar * cur
Definition: parser.h:61
xmlCharEncoding
Definition: encoding.h:58
xmlParserInputPtr input
Definition: parser.h:201
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlChar *XMLCALL xmlCanonicPath(const xmlChar *path)
Definition: uri.c:2379
XMLPUBFUN void XMLCALL xmlFreeInputStream(xmlParserInputPtr input)
xmlDictPtr dict
Definition: parser.h:265
XMLPUBFUN xmlChar XMLCALL xmlPopInput(xmlParserCtxtPtr ctxt)
Definition: parser.c:2268
int validate
Definition: parser.h:222
int inputMax
Definition: parser.h:203
XMLPUBFUN void XMLCALL xmlParseExternalSubset(xmlParserCtxtPtr ctxt, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: parser.c:6992
int wellFormed
Definition: parser.h:190
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN xmlCharEncoding XMLCALL xmlDetectCharEncoding(const unsigned char *in, int len)
Definition: encoding.c:942
xmlDocPtr myDoc
Definition: parser.h:189
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
int loadsubset
Definition: parser.h:260
GLenum GLenum GLenum input
Definition: glext.h:9031
XMLPUBFUN int XMLCALL xmlDictOwns(xmlDictPtr dict, const xmlChar *str)
Definition: dict.c:1218
XMLPUBFUN int XMLCALL xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
#define NULL
Definition: types.h:112
XMLPUBVAR xmlMallocFunc xmlMalloc
Definition: globals.h:247
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
Definition: name.c:38
void * userData
Definition: parser.h:188
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2GetColumnNumber()

XMLPUBFUN int XMLCALL xmlSAX2GetColumnNumber ( void ctx)

xmlSAX2GetColumnNumber: @ctx: the user data (XML parser context)

Provide the column number of the current parsing point.

Returns an int

Definition at line 289 of file SAX2.c.

290 {
292  if ((ctx == NULL) || (ctxt->input == NULL)) return(0);
293  return(ctxt->input->col);
294 }
xmlParserInputPtr input
Definition: parser.h:201
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by xmlInitializeGlobalState().

◆ xmlSAX2GetEntity()

XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetEntity ( void ctx,
const xmlChar name 
)

Definition at line 556 of file SAX2.c.

557 {
560 
561  if (ctx == NULL) return(NULL);
562 #ifdef DEBUG_SAX
564  "SAX.xmlSAX2GetEntity(%s)\n", name);
565 #endif
566 
567  if (ctxt->inSubset == 0) {
569  if (ret != NULL)
570  return(ret);
571  }
572  if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) {
573  if (ctxt->inSubset == 2) {
574  ctxt->myDoc->standalone = 0;
575  ret = xmlGetDocEntity(ctxt->myDoc, name);
576  ctxt->myDoc->standalone = 1;
577  } else {
578  ret = xmlGetDocEntity(ctxt->myDoc, name);
579  if (ret == NULL) {
580  ctxt->myDoc->standalone = 0;
581  ret = xmlGetDocEntity(ctxt->myDoc, name);
582  if (ret != NULL) {
583  xmlFatalErrMsg(ctxt, XML_ERR_NOT_STANDALONE,
584  "Entity(%s) document marked standalone but requires external subset\n",
585  name, NULL);
586  }
587  ctxt->myDoc->standalone = 1;
588  }
589  }
590  } else {
591  ret = xmlGetDocEntity(ctxt->myDoc, name);
592  }
593  return(ret);
594 }
int standalone
Definition: tree.h:564
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlEntityPtr XMLCALL xmlGetPredefinedEntity(const xmlChar *name)
XMLPUBFUN xmlEntityPtr XMLCALL xmlGetDocEntity(const xmlDoc *doc, const xmlChar *name)
int ret
xmlDocPtr myDoc
Definition: parser.h:189
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
Definition: name.c:38
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlParseEntityDecl(), xmlParseEntityRef(), xmlParseStringEntityRef(), and xmlSAXVersion().

◆ xmlSAX2GetLineNumber()

XMLPUBFUN int XMLCALL xmlSAX2GetLineNumber ( void ctx)

xmlSAX2GetLineNumber: @ctx: the user data (XML parser context)

Provide the line number of the current parsing point.

Returns an int

Definition at line 273 of file SAX2.c.

274 {
276  if ((ctx == NULL) || (ctxt->input == NULL)) return(0);
277  return(ctxt->input->line);
278 }
xmlParserInputPtr input
Definition: parser.h:201
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by xmlInitializeGlobalState().

◆ xmlSAX2GetParameterEntity()

XMLPUBFUN xmlEntityPtr XMLCALL xmlSAX2GetParameterEntity ( void ctx,
const xmlChar name 
)

Definition at line 606 of file SAX2.c.

607 {
610 
611  if (ctx == NULL) return(NULL);
612 #ifdef DEBUG_SAX
614  "SAX.xmlSAX2GetParameterEntity(%s)\n", name);
615 #endif
616 
618  return(ret);
619 }
XMLPUBFUN xmlEntityPtr XMLCALL xmlGetParameterEntity(xmlDocPtr doc, const xmlChar *name)
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
int ret
xmlDocPtr myDoc
Definition: parser.h:189
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
Definition: name.c:38
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2GetPublicId()

XMLPUBFUN const xmlChar* XMLCALL xmlSAX2GetPublicId ( void ctx)

◆ xmlSAX2GetSystemId()

XMLPUBFUN const xmlChar* XMLCALL xmlSAX2GetSystemId ( void ctx)

xmlSAX2GetSystemId: @ctx: the user data (XML parser context)

Provides the system ID, basically URL or filename e.g. http://www.sgmlsource.com/dtds/memo.dtd

Returns a xmlChar *

Definition at line 257 of file SAX2.c.

258 {
260  if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL);
261  return((const xmlChar *) ctxt->input->filename);
262 }
xmlParserInputPtr input
Definition: parser.h:201
unsigned char xmlChar
Definition: xmlstring.h:28
const char * filename
Definition: parser.h:58
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by xmlInitializeGlobalState().

◆ xmlSAX2HasExternalSubset()

XMLPUBFUN int XMLCALL xmlSAX2HasExternalSubset ( void ctx)

xmlSAX2HasExternalSubset: @ctx: the user data (XML parser context)

Does this document has an external subset

Returns 1 if true

Definition at line 337 of file SAX2.c.

338 {
340  if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0);
341  return(ctxt->myDoc->extSubset != NULL);
342 }
xmlDocPtr myDoc
Definition: parser.h:189
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
struct _xmlDtd * extSubset
Definition: tree.h:571

Referenced by xmlSAXVersion().

◆ xmlSAX2HasInternalSubset()

XMLPUBFUN int XMLCALL xmlSAX2HasInternalSubset ( void ctx)

xmlSAX2HasInternalSubset: @ctx: the user data (XML parser context)

Does this document has an internal subset

Returns 1 if true

Definition at line 321 of file SAX2.c.

322 {
324  if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0);
325  return(ctxt->myDoc->intSubset != NULL);
326 }
struct _xmlDtd * intSubset
Definition: tree.h:570
xmlDocPtr myDoc
Definition: parser.h:189
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by xmlSAXVersion().

◆ xmlSAX2IgnorableWhitespace()

XMLPUBFUN void XMLCALL xmlSAX2IgnorableWhitespace ( void ctx,
const xmlChar ch,
int  len 
)

◆ xmlSAX2InitDefaultSAXHandler()

XMLPUBFUN void XMLCALL xmlSAX2InitDefaultSAXHandler ( xmlSAXHandler hdlr,
int  warning 
)

xmlSAX2InitDefaultSAXHandler: @hdlr: the SAX handler

Warning
: flag if non-zero sets the handler warning procedure

Initialize the default XML SAX2 handler

Definition at line 2895 of file SAX2.c.

2896 {
2897  if ((hdlr == NULL) || (hdlr->initialized != 0))
2898  return;
2899 
2901  if (warning == 0)
2902  hdlr->warning = NULL;
2903  else
2904  hdlr->warning = xmlParserWarning;
2905 }
int xmlSAXVersion(xmlSAXHandler *hdlr, int version)
Definition: SAX2.c:2840
warningSAXFunc warning
Definition: parser.h:743
unsigned int initialized
Definition: parser.h:749
static int xmlSAX2DefaultVersionValue
Definition: SAX2.c:2803
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
#define NULL
Definition: types.h:112
#define warning(s)
Definition: debug.h:83

◆ xmlSAX2InternalSubset()

XMLPUBFUN void XMLCALL xmlSAX2InternalSubset ( void ctx,
const xmlChar name,
const xmlChar ExternalID,
const xmlChar SystemID 
)

Definition at line 354 of file SAX2.c.

356 {
358  xmlDtdPtr dtd;
359  if (ctx == NULL) return;
360 #ifdef DEBUG_SAX
362  "SAX.xmlSAX2InternalSubset(%s, %s, %s)\n",
363  name, ExternalID, SystemID);
364 #endif
365 
366  if (ctxt->myDoc == NULL)
367  return;
368  dtd = xmlGetIntSubset(ctxt->myDoc);
369  if (dtd != NULL) {
370  if (ctxt->html)
371  return;
372  xmlUnlinkNode((xmlNodePtr) dtd);
373  xmlFreeDtd(dtd);
374  ctxt->myDoc->intSubset = NULL;
375  }
376  ctxt->myDoc->intSubset =
377  xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID);
378  if (ctxt->myDoc->intSubset == NULL)
379  xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset");
380 }
struct _xmlDtd * intSubset
Definition: tree.h:570
Definition: tree.h:406
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN void XMLCALL xmlFreeDtd(xmlDtdPtr cur)
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
Definition: tree.h:489
xmlDocPtr myDoc
Definition: parser.h:189
XMLPUBFUN xmlDtdPtr XMLCALL xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
XMLPUBFUN xmlDtdPtr XMLCALL xmlGetIntSubset(const xmlDoc *doc)
Definition: name.c:38
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2IsStandalone()

XMLPUBFUN int XMLCALL xmlSAX2IsStandalone ( void ctx)

xmlSAX2IsStandalone: @ctx: the user data (XML parser context)

Is this document tagged standalone ?

Returns 1 if true

Definition at line 305 of file SAX2.c.

306 {
308  if ((ctx == NULL) || (ctxt->myDoc == NULL)) return(0);
309  return(ctxt->myDoc->standalone == 1);
310 }
int standalone
Definition: tree.h:564
xmlDocPtr myDoc
Definition: parser.h:189
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39

Referenced by xmlSAXVersion().

◆ xmlSAX2NotationDecl()

XMLPUBFUN void XMLCALL xmlSAX2NotationDecl ( void ctx,
const xmlChar name,
const xmlChar publicId,
const xmlChar systemId 
)

Definition at line 818 of file SAX2.c.

820 {
822  xmlNotationPtr nota = NULL;
823 
824  if ((ctxt == NULL) || (ctxt->myDoc == NULL))
825  return;
826 
827 #ifdef DEBUG_SAX
829  "SAX.xmlSAX2NotationDecl(%s, %s, %s)\n", name, publicId, systemId);
830 #endif
831 
832  if ((publicId == NULL) && (systemId == NULL)) {
833  xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING,
834  "SAX.xmlSAX2NotationDecl(%s) externalID or PublicID missing\n",
835  name, NULL);
836  return;
837  } else if (ctxt->inSubset == 1)
838  nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name,
839  publicId, systemId);
840  else if (ctxt->inSubset == 2)
841  nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, name,
842  publicId, systemId);
843  else {
844  xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING,
845  "SAX.xmlSAX2NotationDecl(%s) called while not in subset\n",
846  name, NULL);
847  return;
848  }
849 #ifdef LIBXML_VALID_ENABLED
850  if (nota == NULL) ctxt->valid = 0;
851  if ((ctxt->validate) && (ctxt->wellFormed) &&
852  (ctxt->myDoc->intSubset != NULL))
853  ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc,
854  nota);
855 #endif /* LIBXML_VALID_ENABLED */
856 }
XMLPUBFUN xmlNotationPtr XMLCALL xmlAddNotationDecl(xmlValidCtxtPtr ctxt, xmlDtdPtr dtd, const xmlChar *name, const xmlChar *PublicID, const xmlChar *SystemID)
Definition: valid.c:2408
struct _xmlDtd * intSubset
Definition: tree.h:570
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
int validate
Definition: parser.h:222
int wellFormed
Definition: parser.h:190
xmlDocPtr myDoc
Definition: parser.h:189
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
struct _xmlDtd * extSubset
Definition: tree.h:571
Definition: name.c:38
xmlValidCtxt vctxt
Definition: parser.h:223
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2ProcessingInstruction()

XMLPUBFUN void XMLCALL xmlSAX2ProcessingInstruction ( void ctx,
const xmlChar target,
const xmlChar data 
)

xmlSAX2ProcessingInstruction: @ctx: the user data (XML parser context) @target: the target name @data: the PI data's

A processing instruction has been parsed.

Definition at line 2672 of file SAX2.c.

2674 {
2676  xmlNodePtr ret;
2678 
2679  if (ctx == NULL) return;
2680  parent = ctxt->node;
2681 #ifdef DEBUG_SAX
2683  "SAX.xmlSAX2ProcessingInstruction(%s, %s)\n", target, data);
2684 #endif
2685 
2686  ret = xmlNewDocPI(ctxt->myDoc, target, data);
2687  if (ret == NULL) return;
2688 
2689  if (ctxt->linenumbers) {
2690  if (ctxt->input != NULL) {
2691  if (ctxt->input->line < 65535)
2692  ret->line = (short) ctxt->input->line;
2693  else
2694  ret->line = 65535;
2695  }
2696  }
2697  if (ctxt->inSubset == 1) {
2699  return;
2700  } else if (ctxt->inSubset == 2) {
2702  return;
2703  }
2704  if (parent == NULL) {
2705 #ifdef DEBUG_SAX_TREE
2707  "Setting PI %s as root\n", target);
2708 #endif
2710  return;
2711  }
2712  if (parent->type == XML_ELEMENT_NODE) {
2713 #ifdef DEBUG_SAX_TREE
2715  "adding PI %s child to %s\n", target, parent->name);
2716 #endif
2718  } else {
2719 #ifdef DEBUG_SAX_TREE
2721  "adding PI %s sibling to ", target);
2722  xmlDebugDumpOneNode(stderr, parent, 0);
2723 #endif
2725  }
2726 }
struct _xmlDtd * intSubset
Definition: tree.h:570
XMLPUBFUN xmlNodePtr XMLCALL xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem)
xmlParserInputPtr input
Definition: parser.h:201
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
int linenumbers
Definition: parser.h:261
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
xmlNodePtr node
Definition: parser.h:207
r parent
Definition: btrfs.c:2944
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
int inSubset
Definition: parser.h:240
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
struct _xmlDtd * extSubset
Definition: tree.h:571
GLenum target
Definition: glext.h:7315
FILE * stderr
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2Reference()

XMLPUBFUN void XMLCALL xmlSAX2Reference ( void ctx,
const xmlChar name 
)

Definition at line 2472 of file SAX2.c.

2473 {
2475  xmlNodePtr ret;
2476 
2477  if (ctx == NULL) return;
2478 #ifdef DEBUG_SAX
2480  "SAX.xmlSAX2Reference(%s)\n", name);
2481 #endif
2482  if (name[0] == '#')
2483  ret = xmlNewCharRef(ctxt->myDoc, name);
2484  else
2485  ret = xmlNewReference(ctxt->myDoc, name);
2486 #ifdef DEBUG_SAX_TREE
2488  "add xmlSAX2Reference %s to %s \n", name, ctxt->node->name);
2489 #endif
2490  if (xmlAddChild(ctxt->node, ret) == NULL) {
2491  xmlFreeNode(ret);
2492  }
2493 }
const xmlChar * name
Definition: tree.h:492
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
xmlNodePtr node
Definition: parser.h:207
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
XMLPUBFUN xmlNodePtr XMLCALL xmlNewCharRef(xmlDocPtr doc, const xmlChar *name)
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
Definition: name.c:38
XMLPUBFUN xmlNodePtr XMLCALL xmlNewReference(const xmlDoc *doc, const xmlChar *name)
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2ResolveEntity()

XMLPUBFUN xmlParserInputPtr XMLCALL xmlSAX2ResolveEntity ( void ctx,
const xmlChar publicId,
const xmlChar systemId 
)

xmlSAX2ResolveEntity: @ctx: the user data (XML parser context) @publicId: The public ID of the entity @systemId: The system ID of the entity

The entity loader, to control the loading of external entities, the application can either:

Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.

Definition at line 519 of file SAX2.c.

520 {
523  xmlChar *URI;
524  const char *base = NULL;
525 
526  if (ctx == NULL) return(NULL);
527  if (ctxt->input != NULL)
528  base = ctxt->input->filename;
529  if (base == NULL)
530  base = ctxt->directory;
531 
532  URI = xmlBuildURI(systemId, (const xmlChar *) base);
533 
534 #ifdef DEBUG_SAX
536  "SAX.xmlSAX2ResolveEntity(%s, %s)\n", publicId, systemId);
537 #endif
538 
539  ret = xmlLoadExternalEntity((const char *) URI,
540  (const char *) publicId, ctxt);
541  if (URI != NULL)
542  xmlFree(URI);
543  return(ret);
544 }
xmlParserInputPtr input
Definition: parser.h:201
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlChar *XMLCALL xmlBuildURI(const xmlChar *URI, const xmlChar *base)
Definition: uri.c:1891
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
int ret
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN xmlParserInputPtr XMLCALL xmlLoadExternalEntity(const char *URL, const char *ID, xmlParserCtxtPtr ctxt)
const char * filename
Definition: parser.h:58
#define NULL
Definition: types.h:112
char * directory
Definition: parser.h:228
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2SetDocumentLocator()

XMLPUBFUN void XMLCALL xmlSAX2SetDocumentLocator ( void ctx,
xmlSAXLocatorPtr  loc 
)

◆ xmlSAX2StartDocument()

XMLPUBFUN void XMLCALL xmlSAX2StartDocument ( void ctx)

xmlSAX2StartDocument: @ctx: the user data (XML parser context)

called when the document start being processed.

Definition at line 953 of file SAX2.c.

954 {
956  xmlDocPtr doc;
957 
958  if (ctx == NULL) return;
959 
960 #ifdef DEBUG_SAX
962  "SAX.xmlSAX2StartDocument()\n");
963 #endif
964  if (ctxt->html) {
965 #ifdef LIBXML_HTML_ENABLED
966  if (ctxt->myDoc == NULL)
967  ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
968  if (ctxt->myDoc == NULL) {
969  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
970  return;
971  }
972  ctxt->myDoc->properties = XML_DOC_HTML;
973  ctxt->myDoc->parseFlags = ctxt->options;
974 #else
976  "libxml2 built without HTML support\n");
978  ctxt->instate = XML_PARSER_EOF;
979  ctxt->disableSAX = 1;
980  return;
981 #endif
982  } else {
983  doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
984  if (doc != NULL) {
985  doc->properties = 0;
986  if (ctxt->options & XML_PARSE_OLD10)
987  doc->properties |= XML_DOC_OLD10;
988  doc->parseFlags = ctxt->options;
989  if (ctxt->encoding != NULL)
990  doc->encoding = xmlStrdup(ctxt->encoding);
991  else
992  doc->encoding = NULL;
993  doc->standalone = ctxt->standalone;
994  } else {
995  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
996  return;
997  }
998  if ((ctxt->dictNames) && (doc != NULL)) {
999  doc->dict = ctxt->dict;
1000  xmlDictReference(doc->dict);
1001  }
1002  }
1003  if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) &&
1004  (ctxt->input != NULL) && (ctxt->input->filename != NULL)) {
1005  ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename);
1006  if (ctxt->myDoc->URL == NULL)
1007  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
1008  }
1009 }
XMLPUBFUN xmlChar *XMLCALL xmlPathToURI(const xmlChar *path)
Definition: uri.c:2520
XMLPUBFUN int XMLCALL xmlDictReference(xmlDictPtr dict)
Definition: dict.c:645
xmlParserInputState instate
Definition: parser.h:225
int properties
Definition: tree.h:584
const xmlChar * URL
Definition: tree.h:577
xmlParserInputPtr input
Definition: parser.h:201
int disableSAX
Definition: parser.h:239
int standalone
Definition: tree.h:564
int standalone
Definition: parser.h:194
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
xmlDictPtr dict
Definition: parser.h:265
xmlDocPtr myDoc
Definition: parser.h:189
const xmlChar * encoding
Definition: parser.h:193
unsigned char xmlChar
Definition: xmlstring.h:28
const xmlChar * version
Definition: parser.h:192
int dictNames
Definition: parser.h:294
const xmlChar * encoding
Definition: tree.h:574
const char * filename
Definition: parser.h:58
int parseFlags
Definition: tree.h:582
#define NULL
Definition: types.h:112
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
Definition: tree.h:551
XMLPUBFUN xmlDocPtr XMLCALL xmlNewDoc(const xmlChar *version)
struct _xmlDict * dict
Definition: tree.h:580
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAX2StartElementNs()

XMLPUBFUN void XMLCALL xmlSAX2StartElementNs ( void ctx,
const xmlChar localname,
const xmlChar prefix,
const xmlChar URI,
int  nb_namespaces,
const xmlChar **  namespaces,
int  nb_attributes,
int  nb_defaulted,
const xmlChar **  attributes 
)

xmlSAX2StartElementNs: @ctx: the user data (XML parser context) @localname: the local name of the element @prefix: the element namespace prefix if available @URI: the element namespace name if available @nb_namespaces: number of namespace definitions on that node @namespaces: pointer to the array of prefix/URI pairs namespace definitions @nb_attributes: the number of attributes on that node @nb_defaulted: the number of defaulted attributes. @attributes: pointer to the array of (localname/prefix/URI/value/end) attribute values.

SAX2 callback when an element start has been detected by the parser. It provides the namespace information for the element, as well as the new namespace declarations on the element.

Definition at line 2180 of file SAX2.c.

2189 {
2191  xmlNodePtr ret;
2193  xmlNsPtr last = NULL, ns;
2194  const xmlChar *uri, *pref;
2195  xmlChar *lname = NULL;
2196  int i, j;
2197 
2198  if (ctx == NULL) return;
2199  parent = ctxt->node;
2200  /*
2201  * First check on validity:
2202  */
2203  if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
2204  ((ctxt->myDoc->intSubset == NULL) ||
2205  ((ctxt->myDoc->intSubset->notations == NULL) &&
2206  (ctxt->myDoc->intSubset->elements == NULL) &&
2207  (ctxt->myDoc->intSubset->attributes == NULL) &&
2208  (ctxt->myDoc->intSubset->entities == NULL)))) {
2209  xmlErrValid(ctxt, XML_DTD_NO_DTD,
2210  "Validation failed: no DTD found !", NULL, NULL);
2211  ctxt->validate = 0;
2212  }
2213 
2214  /*
2215  * Take care of the rare case of an undefined namespace prefix
2216  */
2217  if ((prefix != NULL) && (URI == NULL)) {
2218  if (ctxt->dictNames) {
2219  const xmlChar *fullname;
2220 
2221  fullname = xmlDictQLookup(ctxt->dict, prefix, localname);
2222  if (fullname != NULL)
2223  localname = fullname;
2224  } else {
2225  lname = xmlBuildQName(localname, prefix, NULL, 0);
2226  }
2227  }
2228  /*
2229  * allocate the node
2230  */
2231  if (ctxt->freeElems != NULL) {
2232  ret = ctxt->freeElems;
2233  ctxt->freeElems = ret->next;
2234  ctxt->freeElemsNr--;
2235  memset(ret, 0, sizeof(xmlNode));
2236  ret->doc = ctxt->myDoc;
2237  ret->type = XML_ELEMENT_NODE;
2238 
2239  if (ctxt->dictNames)
2240  ret->name = localname;
2241  else {
2242  if (lname == NULL)
2243  ret->name = xmlStrdup(localname);
2244  else
2245  ret->name = lname;
2246  if (ret->name == NULL) {
2247  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
2248  return;
2249  }
2250  }
2253  } else {
2254  if (ctxt->dictNames)
2256  (xmlChar *) localname, NULL);
2257  else if (lname == NULL)
2258  ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
2259  else
2261  (xmlChar *) lname, NULL);
2262  if (ret == NULL) {
2263  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
2264  return;
2265  }
2266  }
2267  if (ctxt->linenumbers) {
2268  if (ctxt->input != NULL) {
2269  if (ctxt->input->line < 65535)
2270  ret->line = (short) ctxt->input->line;
2271  else
2272  ret->line = 65535;
2273  }
2274  }
2275 
2276  if (parent == NULL) {
2278  }
2279  /*
2280  * Build the namespace list
2281  */
2282  for (i = 0,j = 0;j < nb_namespaces;j++) {
2283  pref = namespaces[i++];
2284  uri = namespaces[i++];
2285  ns = xmlNewNs(NULL, uri, pref);
2286  if (ns != NULL) {
2287  if (last == NULL) {
2288  ret->nsDef = last = ns;
2289  } else {
2290  last->next = ns;
2291  last = ns;
2292  }
2293  if ((URI != NULL) && (prefix == pref))
2294  ret->ns = ns;
2295  } else {
2296  /*
2297  * any out of memory error would already have been raised
2298  * but we can't be guaranteed it's the actual error due to the
2299  * API, best is to skip in this case
2300  */
2301  continue;
2302  }
2303 #ifdef LIBXML_VALID_ENABLED
2304  if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
2305  ctxt->myDoc && ctxt->myDoc->intSubset) {
2306  ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
2307  ret, prefix, ns, uri);
2308  }
2309 #endif /* LIBXML_VALID_ENABLED */
2310  }
2311  ctxt->nodemem = -1;
2312 
2313  /*
2314  * We are parsing a new node.
2315  */
2316  if (nodePush(ctxt, ret) < 0) {
2317  xmlUnlinkNode(ret);
2318  xmlFreeNode(ret);
2319  return;
2320  }
2321 
2322  /*
2323  * Link the child element
2324  */
2325  if (parent != NULL) {
2326  if (parent->type == XML_ELEMENT_NODE) {
2328  } else {
2330  }
2331  }
2332 
2333  /*
2334  * Insert the defaulted attributes from the DTD only if requested:
2335  */
2336  if ((nb_defaulted != 0) &&
2337  ((ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0))
2338  nb_attributes -= nb_defaulted;
2339 
2340  /*
2341  * Search the namespace if it wasn't already found
2342  * Note that, if prefix is NULL, this searches for the default Ns
2343  */
2344  if ((URI != NULL) && (ret->ns == NULL)) {
2345  ret->ns = xmlSearchNs(ctxt->myDoc, parent, prefix);
2346  if ((ret->ns == NULL) && (xmlStrEqual(prefix, BAD_CAST "xml"))) {
2347  ret->ns = xmlSearchNs(ctxt->myDoc, ret, prefix);
2348  }
2349  if (ret->ns == NULL) {
2350  ns = xmlNewNs(ret, NULL, prefix);
2351  if (ns == NULL) {
2352 
2353  xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
2354  return;
2355  }
2356  if (prefix != NULL)
2357  xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
2358  "Namespace prefix %s was not found\n",
2359  prefix, NULL);
2360  else
2361  xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE,
2362  "Namespace default prefix was not found\n",
2363  NULL, NULL);
2364  }
2365  }
2366 
2367  /*
2368  * process all the other attributes
2369  */
2370  if (nb_attributes > 0) {
2371  for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
2372  /*
2373  * Handle the rare case of an undefined attribute prefix
2374  */
2375  if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
2376  if (ctxt->dictNames) {
2377  const xmlChar *fullname;
2378 
2379  fullname = xmlDictQLookup(ctxt->dict, attributes[j+1],
2380  attributes[j]);
2381  if (fullname != NULL) {
2383  attributes[j+3], attributes[j+4]);
2384  continue;
2385  }
2386  } else {
2387  lname = xmlBuildQName(attributes[j], attributes[j+1],
2388  NULL, 0);
2389  if (lname != NULL) {
2390  xmlSAX2AttributeNs(ctxt, lname, NULL,
2391  attributes[j+3], attributes[j+4]);
2392  xmlFree(lname);
2393  continue;
2394  }
2395  }
2396  }
2397  xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],
2398  attributes[j+3], attributes[j+4]);
2399  }
2400  }
2401 
2402 #ifdef LIBXML_VALID_ENABLED
2403  /*
2404  * If it's the Document root, finish the DTD validation and
2405  * check the document root element for validity
2406  */
2407  if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) {
2408  int chk;
2409 
2410  chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc);
2411  if (chk <= 0)
2412  ctxt->valid = 0;
2413  if (chk < 0)
2414  ctxt->wellFormed = 0;
2415  ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc);
2416  ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1;
2417  }
2418 #endif /* LIBXML_VALID_ENABLED */
2419 }
XMLPUBFUN xmlChar *XMLCALL xmlBuildQName(const xmlChar *ncname, const xmlChar *prefix, xmlChar *memory, int len)
struct _xmlDtd * intSubset
Definition: tree.h:570
unsigned int finishDtd
Definition: valid.h:93
POINT last
Definition: font.c:46
const char * uri
Definition: sec_mgr.c:1588
Definition: tree.h:389
static void xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, const xmlChar *localname, const xmlChar *prefix, const xmlChar *value, const xmlChar *valueend)
Definition: SAX2.c:1950
XMLPUBFUN xmlNodePtr XMLCALL xmlAddSibling(xmlNodePtr cur, xmlNodePtr elem)
XMLPUBVAR xmlRegisterNodeFunc xmlRegisterNodeDefaultValue
Definition: globals.h:476
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns, xmlChar *name, const xmlChar *content)
xmlParserInputPtr input
Definition: parser.h:201
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
int linenumbers
Definition: parser.h:261
XMLPUBFUN xmlNsPtr XMLCALL xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace)
int __xmlRegisterCallbacks
Definition: tree.c:53
#define BAD_CAST
Definition: xmlstring.h:35
xmlDictPtr dict
Definition: parser.h:265
int validate
Definition: parser.h:222
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
XMLPUBFUN xmlNodePtr XMLCALL xmlAddChild(xmlNodePtr parent, xmlNodePtr cur)
int wellFormed
Definition: parser.h:190
xmlNodePtr node
Definition: parser.h:207
r parent
Definition: btrfs.c:2944
int freeElemsNr
Definition: parser.h:295
XMLPUBFUN void XMLCALL xmlUnlinkNode(xmlNodePtr cur)
XMLPUBVAR xmlFreeFunc xmlFree
Definition: globals.h:250
XMLPUBFUN int XMLCALL nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value)
Definition: parser.c:1810
Definition: tree.h:489
int ret
xmlDocPtr myDoc
Definition: parser.h:189
const char * fullname
Definition: shader.c:1766
Definition: mxnamespace.c:44
unsigned char xmlChar
Definition: xmlstring.h:28
int loadsubset
Definition: parser.h:260
XMLPUBFUN const xmlChar *XMLCALL xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name)
Definition: dict.c:1113
int dictNames
Definition: parser.h:294
XMLPUBFUN xmlNsPtr XMLCALL xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define XML_COMPLETE_ATTRS
Definition: parser.h:148
#define NULL
Definition: types.h:112
XMLPUBFUN xmlNodePtr XMLCALL xmlNewDocNode(xmlDocPtr doc, xmlNsPtr ns, const xmlChar *name, const xmlChar *content)
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
XMLPUBFUN void XMLCALL xmlFreeNode(xmlNodePtr cur)
struct _xmlDtd * extSubset
Definition: tree.h:571
XMLPUBFUN int XMLCALL xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:159
xmlValidCtxt vctxt
Definition: parser.h:223
#define memset(x, y, z)
Definition: compat.h:39
XMLPUBFUN xmlChar *XMLCALL xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:66
xmlNodePtr freeElems
Definition: parser.h:296

Referenced by xmlSAXVersion().

◆ xmlSAX2UnparsedEntityDecl()

XMLPUBFUN void XMLCALL xmlSAX2UnparsedEntityDecl ( void ctx,
const xmlChar name,
const xmlChar publicId,
const xmlChar systemId,
const xmlChar notationName 
)

Definition at line 869 of file SAX2.c.

872 {
873  xmlEntityPtr ent;
875  if (ctx == NULL) return;
876 #ifdef DEBUG_SAX
878  "SAX.xmlSAX2UnparsedEntityDecl(%s, %s, %s, %s)\n",
879  name, publicId, systemId, notationName);
880 #endif
881  if (ctxt->inSubset == 1) {
882  ent = xmlAddDocEntity(ctxt->myDoc, name,
884  publicId, systemId, notationName);
885  if ((ent == NULL) && (ctxt->pedantic) &&
886  (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
887  ctxt->sax->warning(ctxt->userData,
888  "Entity(%s) already defined in the internal subset\n", name);
889  if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
890  xmlChar *URI;
891  const char *base = NULL;
892 
893  if (ctxt->input != NULL)
894  base = ctxt->input->filename;
895  if (base == NULL)
896  base = ctxt->directory;
897 
898  URI = xmlBuildURI(systemId, (const xmlChar *) base);
899  ent->URI = URI;
900  }
901  } else if (ctxt->inSubset == 2) {
902  ent = xmlAddDtdEntity(ctxt->myDoc, name,
904  publicId, systemId, notationName);
905  if ((ent == NULL) && (ctxt->pedantic) &&
906  (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
907  ctxt->sax->warning(ctxt->userData,
908  "Entity(%s) already defined in the external subset\n", name);
909  if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
910  xmlChar *URI;
911  const char *base = NULL;
912 
913  if (ctxt->input != NULL)
914  base = ctxt->input->filename;
915  if (base == NULL)
916  base = ctxt->directory;
917 
918  URI = xmlBuildURI(systemId, (const xmlChar *) base);
919  ent->URI = URI;
920  }
921  } else {
922  xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
923  "SAX.xmlSAX2UnparsedEntityDecl(%s) called while not in subset\n",
924  name, NULL);
925  }
926 }
int pedantic
Definition: parser.h:257
const xmlChar * URI
Definition: entities.h:57
xmlParserInputPtr input
Definition: parser.h:201
XMLPUBVAR xmlGenericErrorFunc xmlGenericError
Definition: globals.h:346
XMLPUBFUN xmlChar *XMLCALL xmlBuildURI(const xmlChar *URI, const xmlChar *base)
Definition: uri.c:1891
XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content)
xmlDocPtr myDoc
Definition: parser.h:189
unsigned char xmlChar
Definition: xmlstring.h:28
struct _xmlSAXHandler * sax
Definition: parser.h:187
const char * filename
Definition: parser.h:58
int inSubset
Definition: parser.h:240
XMLPUBFUN xmlEntityPtr XMLCALL xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, const xmlChar *ExternalID, const xmlChar *SystemID, const xmlChar *content)
#define NULL
Definition: types.h:112
char * directory
Definition: parser.h:228
xmlParserCtxt * xmlParserCtxtPtr
Definition: tree.h:39
Definition: name.c:38
void * userData
Definition: parser.h:188
XMLPUBVAR void * xmlGenericErrorContext
Definition: globals.h:362

Referenced by xmlSAXVersion().

◆ xmlSAXVersion()

XMLPUBFUN int XMLCALL xmlSAXVersion ( xmlSAXHandler hdlr,
int  version 
)

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.

Definition at line 2840 of file SAX2.c.

2841 {
2842  if (hdlr == NULL) return(-1);
2843  if (version == 2) {
2844  hdlr->startElement = NULL;
2845  hdlr->endElement = NULL;
2848  hdlr->serror = NULL;
2849  hdlr->initialized = XML_SAX2_MAGIC;
2850 #ifdef LIBXML_SAX1_ENABLED
2851  } else if (version == 1) {
2852  hdlr->startElement = xmlSAX2StartElement;
2853  hdlr->endElement = xmlSAX2EndElement;
2854  hdlr->initialized = 1;
2855 #endif /* LIBXML_SAX1_ENABLED */
2856  } else
2857  return(-1);
2864  hdlr->getEntity = xmlSAX2GetEntity;
2866  hdlr->entityDecl = xmlSAX2EntityDecl;
2874  hdlr->reference = xmlSAX2Reference;
2875  hdlr->characters = xmlSAX2Characters;
2876  hdlr->cdataBlock = xmlSAX2CDataBlock;
2879  hdlr->comment = xmlSAX2Comment;
2880  hdlr->warning = xmlParserWarning;
2881  hdlr->error = xmlParserError;
2882  hdlr->fatalError = xmlParserError;
2883 
2884  return(0);
2885 }
internalSubsetSAXFunc internalSubset
Definition: parser.h:722
processingInstructionSAXFunc processingInstruction
Definition: parser.h:741
endElementNsSAX2Func endElementNs
Definition: parser.h:753
xmlEntityPtr xmlSAX2GetEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:556
xmlParserInputPtr xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:519
void xmlSAX2EndElementNs(void *ctx, const xmlChar *localname ATTRIBUTE_UNUSED, const xmlChar *prefix ATTRIBUTE_UNUSED, const xmlChar *URI ATTRIBUTE_UNUSED)
Definition: SAX2.c:2432
endDocumentSAXFunc endDocument
Definition: parser.h:735
#define XML_SAX2_MAGIC
Definition: parser.h:673
setDocumentLocatorSAXFunc setDocumentLocator
Definition: parser.h:733
entityDeclSAXFunc entityDecl
Definition: parser.h:728
void xmlSAX2NotationDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:818
void xmlSAX2SetDocumentLocator(void *ctx ATTRIBUTE_UNUSED, xmlSAXLocatorPtr loc ATTRIBUTE_UNUSED)
Definition: SAX2.c:937
void xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
Definition: SAX2.c:2798
int xmlSAX2IsStandalone(void *ctx)
Definition: SAX2.c:305
warningSAXFunc warning
Definition: parser.h:743
resolveEntitySAXFunc resolveEntity
Definition: parser.h:726
unsigned int initialized
Definition: parser.h:749
isStandaloneSAXFunc isStandalone
Definition: parser.h:723
void xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
Definition: SAX2.c:704
void xmlSAX2ElementDecl(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)
Definition: SAX2.c:772
startElementSAXFunc startElement
Definition: parser.h:736
void xmlSAX2Comment(void *ctx, const xmlChar *value)
Definition: SAX2.c:2736
attributeDeclSAXFunc attributeDecl
Definition: parser.h:730
static const WCHAR version[]
Definition: asmname.c:66
void xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:392
cdataBlockSAXFunc cdataBlock
Definition: parser.h:747
endElementSAXFunc endElement
Definition: parser.h:737
void xmlSAX2Reference(void *ctx, const xmlChar *name)
Definition: SAX2.c:2472
ignorableWhitespaceSAXFunc ignorableWhitespace
Definition: parser.h:740
void xmlSAX2InternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:354
hasInternalSubsetSAXFunc hasInternalSubset
Definition: parser.h:724
XMLPUBFUN void XMLCDECL xmlParserError(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
unparsedEntityDeclSAXFunc unparsedEntityDecl
Definition: parser.h:732
void xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
Definition: SAX2.c:2639
void xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
Definition: SAX2.c:634
void xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, const xmlChar *data)
Definition: SAX2.c:2672
void xmlSAX2EndDocument(void *ctx)
Definition: SAX2.c:1018
void xmlSAX2StartElementNs(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
Definition: SAX2.c:2180
void xmlSAX2StartDocument(void *ctx)
Definition: SAX2.c:953
xmlEntityPtr xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:606
xmlStructuredErrorFunc serror
Definition: parser.h:754
fatalErrorSAXFunc fatalError
Definition: parser.h:745
errorSAXFunc error
Definition: parser.h:744
getEntitySAXFunc getEntity
Definition: parser.h:727
notationDeclSAXFunc notationDecl
Definition: parser.h:729
elementDeclSAXFunc elementDecl
Definition: parser.h:731
XMLPUBFUN void XMLCDECL XMLPUBFUN void XMLCDECL xmlParserWarning(void *ctx, const char *msg,...) LIBXML_ATTR_FORMAT(2
externalSubsetSAXFunc externalSubset
Definition: parser.h:748
#define NULL
Definition: types.h:112
startDocumentSAXFunc startDocument
Definition: parser.h:734
getParameterEntitySAXFunc getParameterEntity
Definition: parser.h:746
commentSAXFunc comment
Definition: parser.h:742
charactersSAXFunc characters
Definition: parser.h:739
int xmlSAX2HasInternalSubset(void *ctx)
Definition: SAX2.c:321
int xmlSAX2HasExternalSubset(void *ctx)
Definition: SAX2.c:337
hasExternalSubsetSAXFunc hasExternalSubset
Definition: parser.h:725
void xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
Definition: SAX2.c:869
referenceSAXFunc reference
Definition: parser.h:738
startElementNsSAX2Func startElementNs
Definition: parser.h:752

Referenced by xmlDefaultSAXHandlerInit(), xmlInitParserCtxt(), and xmlSAX2InitDefaultSAXHandler().