Lines Matching refs:ctxt
59 xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) { in xmlSAX2ErrMemory() argument
63 if (ctxt != NULL) { in xmlSAX2ErrMemory()
64 ctxt->errNo = XML_ERR_NO_MEMORY; in xmlSAX2ErrMemory()
65 if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) in xmlSAX2ErrMemory()
66 schannel = ctxt->sax->serror; in xmlSAX2ErrMemory()
68 ctxt->vctxt.error, ctxt->vctxt.userData, in xmlSAX2ErrMemory()
69 ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY, in xmlSAX2ErrMemory()
73 ctxt->errNo = XML_ERR_NO_MEMORY; in xmlSAX2ErrMemory()
74 ctxt->instate = XML_PARSER_EOF; in xmlSAX2ErrMemory()
75 ctxt->disableSAX = 1; in xmlSAX2ErrMemory()
79 ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY, in xmlSAX2ErrMemory()
97 xmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlErrValid() argument
102 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrValid()
103 (ctxt->instate == XML_PARSER_EOF)) in xmlErrValid()
105 if (ctxt != NULL) { in xmlErrValid()
106 ctxt->errNo = error; in xmlErrValid()
107 if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) in xmlErrValid()
108 schannel = ctxt->sax->serror; in xmlErrValid()
110 ctxt->vctxt.error, ctxt->vctxt.userData, in xmlErrValid()
111 ctxt, NULL, XML_FROM_DTD, error, in xmlErrValid()
115 ctxt->valid = 0; in xmlErrValid()
119 ctxt, NULL, XML_FROM_DTD, error, in xmlErrValid()
137 xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlFatalErrMsg() argument
140 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErrMsg()
141 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErrMsg()
143 if (ctxt != NULL) in xmlFatalErrMsg()
144 ctxt->errNo = error; in xmlFatalErrMsg()
145 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, in xmlFatalErrMsg()
149 if (ctxt != NULL) { in xmlFatalErrMsg()
150 ctxt->wellFormed = 0; in xmlFatalErrMsg()
151 ctxt->valid = 0; in xmlFatalErrMsg()
152 if (ctxt->recovery == 0) in xmlFatalErrMsg()
153 ctxt->disableSAX = 1; in xmlFatalErrMsg()
168 xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlWarnMsg() argument
171 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlWarnMsg()
172 (ctxt->instate == XML_PARSER_EOF)) in xmlWarnMsg()
174 if (ctxt != NULL) in xmlWarnMsg()
175 ctxt->errNo = error; in xmlWarnMsg()
176 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, in xmlWarnMsg()
193 xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlNsErrMsg() argument
196 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlNsErrMsg()
197 (ctxt->instate == XML_PARSER_EOF)) in xmlNsErrMsg()
199 if (ctxt != NULL) in xmlNsErrMsg()
200 ctxt->errNo = error; in xmlNsErrMsg()
201 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, in xmlNsErrMsg()
217 xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlNsWarnMsg() argument
220 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlNsWarnMsg()
221 (ctxt->instate == XML_PARSER_EOF)) in xmlNsWarnMsg()
223 if (ctxt != NULL) in xmlNsWarnMsg()
224 ctxt->errNo = error; in xmlNsWarnMsg()
225 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, in xmlNsWarnMsg()
258 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetSystemId() local
259 if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL); in xmlSAX2GetSystemId()
260 return((const xmlChar *) ctxt->input->filename); in xmlSAX2GetSystemId()
274 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetLineNumber() local
275 if ((ctx == NULL) || (ctxt->input == NULL)) return(0); in xmlSAX2GetLineNumber()
276 return(ctxt->input->line); in xmlSAX2GetLineNumber()
290 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetColumnNumber() local
291 if ((ctx == NULL) || (ctxt->input == NULL)) return(0); in xmlSAX2GetColumnNumber()
292 return(ctxt->input->col); in xmlSAX2GetColumnNumber()
306 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2IsStandalone() local
307 if ((ctx == NULL) || (ctxt->myDoc == NULL)) return(0); in xmlSAX2IsStandalone()
308 return(ctxt->myDoc->standalone == 1); in xmlSAX2IsStandalone()
322 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2HasInternalSubset() local
323 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); in xmlSAX2HasInternalSubset()
324 return(ctxt->myDoc->intSubset != NULL); in xmlSAX2HasInternalSubset()
338 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2HasExternalSubset() local
339 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); in xmlSAX2HasExternalSubset()
340 return(ctxt->myDoc->extSubset != NULL); in xmlSAX2HasExternalSubset()
356 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2InternalSubset() local
365 if (ctxt->myDoc == NULL) in xmlSAX2InternalSubset()
367 dtd = xmlGetIntSubset(ctxt->myDoc); in xmlSAX2InternalSubset()
369 if (ctxt->html) in xmlSAX2InternalSubset()
373 ctxt->myDoc->intSubset = NULL; in xmlSAX2InternalSubset()
375 ctxt->myDoc->intSubset = in xmlSAX2InternalSubset()
376 xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); in xmlSAX2InternalSubset()
377 if (ctxt->myDoc->intSubset == NULL) in xmlSAX2InternalSubset()
378 xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset"); in xmlSAX2InternalSubset()
394 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ExternalSubset() local
402 (((ctxt->validate) || (ctxt->loadsubset != 0)) && in xmlSAX2ExternalSubset()
403 (ctxt->wellFormed && ctxt->myDoc))) { in xmlSAX2ExternalSubset()
419 if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL)) in xmlSAX2ExternalSubset()
420 input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, in xmlSAX2ExternalSubset()
426 xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID); in xmlSAX2ExternalSubset()
431 oldinput = ctxt->input; in xmlSAX2ExternalSubset()
432 oldinputNr = ctxt->inputNr; in xmlSAX2ExternalSubset()
433 oldinputMax = ctxt->inputMax; in xmlSAX2ExternalSubset()
434 oldinputTab = ctxt->inputTab; in xmlSAX2ExternalSubset()
435 oldcharset = ctxt->charset; in xmlSAX2ExternalSubset()
436 oldencoding = ctxt->encoding; in xmlSAX2ExternalSubset()
437 ctxt->encoding = NULL; in xmlSAX2ExternalSubset()
439 ctxt->inputTab = (xmlParserInputPtr *) in xmlSAX2ExternalSubset()
441 if (ctxt->inputTab == NULL) { in xmlSAX2ExternalSubset()
442 xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset"); in xmlSAX2ExternalSubset()
443 ctxt->input = oldinput; in xmlSAX2ExternalSubset()
444 ctxt->inputNr = oldinputNr; in xmlSAX2ExternalSubset()
445 ctxt->inputMax = oldinputMax; in xmlSAX2ExternalSubset()
446 ctxt->inputTab = oldinputTab; in xmlSAX2ExternalSubset()
447 ctxt->charset = oldcharset; in xmlSAX2ExternalSubset()
448 ctxt->encoding = oldencoding; in xmlSAX2ExternalSubset()
451 ctxt->inputNr = 0; in xmlSAX2ExternalSubset()
452 ctxt->inputMax = 5; in xmlSAX2ExternalSubset()
453 ctxt->input = NULL; in xmlSAX2ExternalSubset()
454 xmlPushInput(ctxt, input); in xmlSAX2ExternalSubset()
459 if (ctxt->input->length >= 4) { in xmlSAX2ExternalSubset()
460 enc = xmlDetectCharEncoding(ctxt->input->cur, 4); in xmlSAX2ExternalSubset()
461 xmlSwitchEncoding(ctxt, enc); in xmlSAX2ExternalSubset()
468 input->base = ctxt->input->cur; in xmlSAX2ExternalSubset()
469 input->cur = ctxt->input->cur; in xmlSAX2ExternalSubset()
475 xmlParseExternalSubset(ctxt, ExternalID, SystemID); in xmlSAX2ExternalSubset()
481 while (ctxt->inputNr > 1) in xmlSAX2ExternalSubset()
482 xmlPopInput(ctxt); in xmlSAX2ExternalSubset()
483 xmlFreeInputStream(ctxt->input); in xmlSAX2ExternalSubset()
484 xmlFree(ctxt->inputTab); in xmlSAX2ExternalSubset()
489 ctxt->input = oldinput; in xmlSAX2ExternalSubset()
490 ctxt->inputNr = oldinputNr; in xmlSAX2ExternalSubset()
491 ctxt->inputMax = oldinputMax; in xmlSAX2ExternalSubset()
492 ctxt->inputTab = oldinputTab; in xmlSAX2ExternalSubset()
493 ctxt->charset = oldcharset; in xmlSAX2ExternalSubset()
494 if ((ctxt->encoding != NULL) && in xmlSAX2ExternalSubset()
495 ((ctxt->dict == NULL) || in xmlSAX2ExternalSubset()
496 (!xmlDictOwns(ctxt->dict, ctxt->encoding)))) in xmlSAX2ExternalSubset()
497 xmlFree((xmlChar *) ctxt->encoding); in xmlSAX2ExternalSubset()
498 ctxt->encoding = oldencoding; in xmlSAX2ExternalSubset()
520 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ResolveEntity() local
526 if (ctxt->input != NULL) in xmlSAX2ResolveEntity()
527 base = ctxt->input->filename; in xmlSAX2ResolveEntity()
529 base = ctxt->directory; in xmlSAX2ResolveEntity()
539 (const char *) publicId, ctxt); in xmlSAX2ResolveEntity()
557 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetEntity() local
566 if (ctxt->inSubset == 0) { in xmlSAX2GetEntity()
571 if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) { in xmlSAX2GetEntity()
572 if (ctxt->inSubset == 2) { in xmlSAX2GetEntity()
573 ctxt->myDoc->standalone = 0; in xmlSAX2GetEntity()
574 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
575 ctxt->myDoc->standalone = 1; in xmlSAX2GetEntity()
577 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
579 ctxt->myDoc->standalone = 0; in xmlSAX2GetEntity()
580 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
582 xmlFatalErrMsg(ctxt, XML_ERR_NOT_STANDALONE, in xmlSAX2GetEntity()
586 ctxt->myDoc->standalone = 1; in xmlSAX2GetEntity()
590 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
593 ((ctxt->validate) || (ctxt->replaceEntities)) && in xmlSAX2GetEntity()
603 unsigned long oldnbent = ctxt->nbentities; in xmlSAX2GetEntity()
605 val = xmlParseCtxtExternalEntity(ctxt, ret->URI, in xmlSAX2GetEntity()
610 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, in xmlSAX2GetEntity()
612 ctxt->validate = 0; in xmlSAX2GetEntity()
617 ret->checked = (ctxt->nbentities - oldnbent + 1) * 2; in xmlSAX2GetEntity()
637 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetParameterEntity() local
646 ret = xmlGetParameterEntity(ctxt->myDoc, name); in xmlSAX2GetParameterEntity()
667 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EntityDecl() local
675 if (ctxt->inSubset == 1) { in xmlSAX2EntityDecl()
676 ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId, in xmlSAX2EntityDecl()
678 if ((ent == NULL) && (ctxt->pedantic)) in xmlSAX2EntityDecl()
679 xmlWarnMsg(ctxt, XML_WAR_ENTITY_REDEFINED, in xmlSAX2EntityDecl()
686 if (ctxt->input != NULL) in xmlSAX2EntityDecl()
687 base = ctxt->input->filename; in xmlSAX2EntityDecl()
689 base = ctxt->directory; in xmlSAX2EntityDecl()
694 } else if (ctxt->inSubset == 2) { in xmlSAX2EntityDecl()
695 ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId, in xmlSAX2EntityDecl()
697 if ((ent == NULL) && (ctxt->pedantic) && in xmlSAX2EntityDecl()
698 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2EntityDecl()
699 ctxt->sax->warning(ctxt->userData, in xmlSAX2EntityDecl()
705 if (ctxt->input != NULL) in xmlSAX2EntityDecl()
706 base = ctxt->input->filename; in xmlSAX2EntityDecl()
708 base = ctxt->directory; in xmlSAX2EntityDecl()
714 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, in xmlSAX2EntityDecl()
737 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2AttributeDecl() local
741 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) in xmlSAX2AttributeDecl()
754 int tmp = ctxt->valid; in xmlSAX2AttributeDecl()
755 xmlErrValid(ctxt, XML_DTD_XMLID_TYPE, in xmlSAX2AttributeDecl()
757 ctxt->valid = tmp; in xmlSAX2AttributeDecl()
760 name = xmlSplitQName(ctxt, fullname, &prefix); in xmlSAX2AttributeDecl()
761 ctxt->vctxt.valid = 1; in xmlSAX2AttributeDecl()
762 if (ctxt->inSubset == 1) in xmlSAX2AttributeDecl()
763 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem, in xmlSAX2AttributeDecl()
766 else if (ctxt->inSubset == 2) in xmlSAX2AttributeDecl()
767 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem, in xmlSAX2AttributeDecl()
771 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlSAX2AttributeDecl()
778 if (ctxt->vctxt.valid == 0) in xmlSAX2AttributeDecl()
779 ctxt->valid = 0; in xmlSAX2AttributeDecl()
780 if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) && in xmlSAX2AttributeDecl()
781 (ctxt->myDoc->intSubset != NULL)) in xmlSAX2AttributeDecl()
782 ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeDecl()
804 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ElementDecl() local
807 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) in xmlSAX2ElementDecl()
815 if (ctxt->inSubset == 1) in xmlSAX2ElementDecl()
816 elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, in xmlSAX2ElementDecl()
818 else if (ctxt->inSubset == 2) in xmlSAX2ElementDecl()
819 elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, in xmlSAX2ElementDecl()
822 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlSAX2ElementDecl()
829 ctxt->valid = 0; in xmlSAX2ElementDecl()
830 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2ElementDecl()
831 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2ElementDecl()
832 ctxt->valid &= in xmlSAX2ElementDecl()
833 xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem); in xmlSAX2ElementDecl()
850 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2NotationDecl() local
853 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) in xmlSAX2NotationDecl()
862 xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, in xmlSAX2NotationDecl()
866 } else if (ctxt->inSubset == 1) in xmlSAX2NotationDecl()
867 nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name, in xmlSAX2NotationDecl()
869 else if (ctxt->inSubset == 2) in xmlSAX2NotationDecl()
870 nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, name, in xmlSAX2NotationDecl()
873 xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, in xmlSAX2NotationDecl()
879 if (nota == NULL) ctxt->valid = 0; in xmlSAX2NotationDecl()
880 if ((ctxt->validate) && (ctxt->wellFormed) && in xmlSAX2NotationDecl()
881 (ctxt->myDoc->intSubset != NULL)) in xmlSAX2NotationDecl()
882 ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2NotationDecl()
903 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2UnparsedEntityDecl() local
910 if (ctxt->inSubset == 1) { in xmlSAX2UnparsedEntityDecl()
911 ent = xmlAddDocEntity(ctxt->myDoc, name, in xmlSAX2UnparsedEntityDecl()
914 if ((ent == NULL) && (ctxt->pedantic) && in xmlSAX2UnparsedEntityDecl()
915 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2UnparsedEntityDecl()
916 ctxt->sax->warning(ctxt->userData, in xmlSAX2UnparsedEntityDecl()
922 if (ctxt->input != NULL) in xmlSAX2UnparsedEntityDecl()
923 base = ctxt->input->filename; in xmlSAX2UnparsedEntityDecl()
925 base = ctxt->directory; in xmlSAX2UnparsedEntityDecl()
930 } else if (ctxt->inSubset == 2) { in xmlSAX2UnparsedEntityDecl()
931 ent = xmlAddDtdEntity(ctxt->myDoc, name, in xmlSAX2UnparsedEntityDecl()
934 if ((ent == NULL) && (ctxt->pedantic) && in xmlSAX2UnparsedEntityDecl()
935 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2UnparsedEntityDecl()
936 ctxt->sax->warning(ctxt->userData, in xmlSAX2UnparsedEntityDecl()
942 if (ctxt->input != NULL) in xmlSAX2UnparsedEntityDecl()
943 base = ctxt->input->filename; in xmlSAX2UnparsedEntityDecl()
945 base = ctxt->directory; in xmlSAX2UnparsedEntityDecl()
951 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlSAX2UnparsedEntityDecl()
984 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2StartDocument() local
993 if (ctxt->html) { in xmlSAX2StartDocument()
995 if (ctxt->myDoc == NULL) in xmlSAX2StartDocument()
996 ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL); in xmlSAX2StartDocument()
997 if (ctxt->myDoc == NULL) { in xmlSAX2StartDocument()
998 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); in xmlSAX2StartDocument()
1001 ctxt->myDoc->properties = XML_DOC_HTML; in xmlSAX2StartDocument()
1002 ctxt->myDoc->parseFlags = ctxt->options; in xmlSAX2StartDocument()
1006 ctxt->errNo = XML_ERR_INTERNAL_ERROR; in xmlSAX2StartDocument()
1007 ctxt->instate = XML_PARSER_EOF; in xmlSAX2StartDocument()
1008 ctxt->disableSAX = 1; in xmlSAX2StartDocument()
1012 doc = ctxt->myDoc = xmlNewDoc(ctxt->version); in xmlSAX2StartDocument()
1015 if (ctxt->options & XML_PARSE_OLD10) in xmlSAX2StartDocument()
1017 doc->parseFlags = ctxt->options; in xmlSAX2StartDocument()
1018 if (ctxt->encoding != NULL) in xmlSAX2StartDocument()
1019 doc->encoding = xmlStrdup(ctxt->encoding); in xmlSAX2StartDocument()
1022 doc->standalone = ctxt->standalone; in xmlSAX2StartDocument()
1024 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); in xmlSAX2StartDocument()
1027 if ((ctxt->dictNames) && (doc != NULL)) { in xmlSAX2StartDocument()
1028 doc->dict = ctxt->dict; in xmlSAX2StartDocument()
1032 if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) && in xmlSAX2StartDocument()
1033 (ctxt->input != NULL) && (ctxt->input->filename != NULL)) { in xmlSAX2StartDocument()
1034 ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename); in xmlSAX2StartDocument()
1035 if (ctxt->myDoc->URL == NULL) in xmlSAX2StartDocument()
1036 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); in xmlSAX2StartDocument()
1049 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EndDocument() local
1056 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2EndDocument()
1057 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2EndDocument()
1058 ctxt->valid &= xmlValidateDocumentFinal(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2EndDocument()
1064 if ((ctxt->encoding != NULL) && (ctxt->myDoc != NULL) && in xmlSAX2EndDocument()
1065 (ctxt->myDoc->encoding == NULL)) { in xmlSAX2EndDocument()
1066 ctxt->myDoc->encoding = ctxt->encoding; in xmlSAX2EndDocument()
1067 ctxt->encoding = NULL; in xmlSAX2EndDocument()
1069 if ((ctxt->inputTab != NULL) && in xmlSAX2EndDocument()
1070 (ctxt->inputNr > 0) && (ctxt->inputTab[0] != NULL) && in xmlSAX2EndDocument()
1071 (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) && in xmlSAX2EndDocument()
1072 (ctxt->myDoc->encoding == NULL)) { in xmlSAX2EndDocument()
1073 ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding); in xmlSAX2EndDocument()
1075 if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) && in xmlSAX2EndDocument()
1076 (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) { in xmlSAX2EndDocument()
1077 ctxt->myDoc->charset = ctxt->charset; in xmlSAX2EndDocument()
1098 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2AttributeInternal() local
1105 if (ctxt->html) { in xmlSAX2AttributeInternal()
1113 name = xmlSplitQName(ctxt, fullname, &ns); in xmlSAX2AttributeInternal()
1116 xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR, in xmlSAX2AttributeInternal()
1120 xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN, in xmlSAX2AttributeInternal()
1132 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2AttributeInternal()
1139 if ((ctxt->html) && in xmlSAX2AttributeInternal()
1152 ctxt->vctxt.valid = 1; in xmlSAX2AttributeInternal()
1153 nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt, in xmlSAX2AttributeInternal()
1154 ctxt->myDoc, ctxt->node, in xmlSAX2AttributeInternal()
1156 if (ctxt->vctxt.valid != 1) { in xmlSAX2AttributeInternal()
1157 ctxt->valid = 0; in xmlSAX2AttributeInternal()
1169 if ((!ctxt->html) && (ns == NULL) && in xmlSAX2AttributeInternal()
1175 if (!ctxt->replaceEntities) { in xmlSAX2AttributeInternal()
1176 ctxt->depth++; in xmlSAX2AttributeInternal()
1177 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, in xmlSAX2AttributeInternal()
1179 ctxt->depth--; in xmlSAX2AttributeInternal()
1181 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2AttributeInternal()
1195 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2AttributeInternal()
1196 ctxt->sax->warning(ctxt->userData, in xmlSAX2AttributeInternal()
1200 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2AttributeInternal()
1201 ctxt->sax->warning(ctxt->userData, in xmlSAX2AttributeInternal()
1209 nsret = xmlNewNs(ctxt->node, val, NULL); in xmlSAX2AttributeInternal()
1216 if (nsret != NULL && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeInternal()
1217 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2AttributeInternal()
1218 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeInternal()
1219 ctxt->node, prefix, nsret, val); in xmlSAX2AttributeInternal()
1229 if ((!ctxt->html) && in xmlSAX2AttributeInternal()
1235 if (!ctxt->replaceEntities) { in xmlSAX2AttributeInternal()
1236 ctxt->depth++; in xmlSAX2AttributeInternal()
1237 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, in xmlSAX2AttributeInternal()
1239 ctxt->depth--; in xmlSAX2AttributeInternal()
1241 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2AttributeInternal()
1252 xmlNsErrMsg(ctxt, XML_NS_ERR_EMPTY, in xmlSAX2AttributeInternal()
1255 if ((ctxt->pedantic != 0) && (val[0] != 0)) { in xmlSAX2AttributeInternal()
1260 xmlNsWarnMsg(ctxt, XML_WAR_NS_URI, in xmlSAX2AttributeInternal()
1264 xmlNsWarnMsg(ctxt, XML_WAR_NS_URI_RELATIVE, in xmlSAX2AttributeInternal()
1272 nsret = xmlNewNs(ctxt->node, val, name); in xmlSAX2AttributeInternal()
1279 if (nsret != NULL && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeInternal()
1280 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2AttributeInternal()
1281 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeInternal()
1282 ctxt->node, prefix, nsret, value); in xmlSAX2AttributeInternal()
1294 namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns); in xmlSAX2AttributeInternal()
1297 xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2AttributeInternal()
1303 prop = ctxt->node->properties; in xmlSAX2AttributeInternal()
1309 xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, in xmlSAX2AttributeInternal()
1312 ctxt->wellFormed = 0; in xmlSAX2AttributeInternal()
1313 if (ctxt->recovery == 0) ctxt->disableSAX = 1; in xmlSAX2AttributeInternal()
1325 ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL); in xmlSAX2AttributeInternal()
1328 if ((ctxt->replaceEntities == 0) && (!ctxt->html)) { in xmlSAX2AttributeInternal()
1331 ret->children = xmlStringGetNodeList(ctxt->myDoc, value); in xmlSAX2AttributeInternal()
1340 ret->children = xmlNewDocText(ctxt->myDoc, value); in xmlSAX2AttributeInternal()
1348 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeInternal()
1349 ctxt->myDoc && ctxt->myDoc->intSubset) { in xmlSAX2AttributeInternal()
1355 if (!ctxt->replaceEntities) { in xmlSAX2AttributeInternal()
1358 ctxt->depth++; in xmlSAX2AttributeInternal()
1359 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, in xmlSAX2AttributeInternal()
1361 ctxt->depth--; in xmlSAX2AttributeInternal()
1364 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeInternal()
1365 ctxt->myDoc, ctxt->node, ret, value); in xmlSAX2AttributeInternal()
1374 nvalnorm = xmlValidNormalizeAttributeValue(ctxt->myDoc, in xmlSAX2AttributeInternal()
1375 ctxt->node, fullname, val); in xmlSAX2AttributeInternal()
1381 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeInternal()
1382 ctxt->myDoc, ctxt->node, ret, val); in xmlSAX2AttributeInternal()
1386 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeInternal()
1387 ctxt->node, ret, value); in xmlSAX2AttributeInternal()
1391 if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) && in xmlSAX2AttributeInternal()
1392 (((ctxt->replaceEntities == 0) && (ctxt->external != 2)) || in xmlSAX2AttributeInternal()
1393 ((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) { in xmlSAX2AttributeInternal()
1405 xmlErrValid(ctxt, XML_DTD_XMLID_VALUE, in xmlSAX2AttributeInternal()
1409 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret); in xmlSAX2AttributeInternal()
1410 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) in xmlSAX2AttributeInternal()
1411 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret); in xmlSAX2AttributeInternal()
1412 else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) in xmlSAX2AttributeInternal()
1413 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret); in xmlSAX2AttributeInternal()
1429 xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name, in xmlCheckDefaultedAttributes() argument
1436 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->intSubset, name, prefix); in xmlCheckDefaultedAttributes()
1438 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, name, prefix); in xmlCheckDefaultedAttributes()
1450 if ((ctxt->myDoc->standalone == 1) && in xmlCheckDefaultedAttributes()
1451 (ctxt->myDoc->extSubset != NULL) && in xmlCheckDefaultedAttributes()
1452 (ctxt->validate)) { in xmlCheckDefaultedAttributes()
1455 (xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset, in xmlCheckDefaultedAttributes()
1458 (xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, in xmlCheckDefaultedAttributes()
1471 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlCheckDefaultedAttributes()
1491 xmlErrValid(ctxt, XML_DTD_STANDALONE_DEFAULTED, in xmlCheckDefaultedAttributes()
1525 (ctxt->loadsubset & XML_COMPLETE_ATTRS)) { in xmlCheckDefaultedAttributes()
1528 tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, in xmlCheckDefaultedAttributes()
1537 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlCheckDefaultedAttributes()
1557 xmlSAX2AttributeInternal(ctxt, fulln, in xmlCheckDefaultedAttributes()
1568 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, in xmlCheckDefaultedAttributes()
1587 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2StartElement() local
1597 if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return; in xmlSAX2StartElement()
1598 parent = ctxt->node; in xmlSAX2StartElement()
1607 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && in xmlSAX2StartElement()
1608 ((ctxt->myDoc->intSubset == NULL) || in xmlSAX2StartElement()
1609 ((ctxt->myDoc->intSubset->notations == NULL) && in xmlSAX2StartElement()
1610 (ctxt->myDoc->intSubset->elements == NULL) && in xmlSAX2StartElement()
1611 (ctxt->myDoc->intSubset->attributes == NULL) && in xmlSAX2StartElement()
1612 (ctxt->myDoc->intSubset->entities == NULL)))) { in xmlSAX2StartElement()
1613 xmlErrValid(ctxt, XML_ERR_NO_DTD, in xmlSAX2StartElement()
1615 ctxt->validate = 0; in xmlSAX2StartElement()
1622 name = xmlSplitQName(ctxt, fullname, &prefix); in xmlSAX2StartElement()
1630 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, name, NULL); in xmlSAX2StartElement()
1634 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2StartElement()
1637 if (ctxt->myDoc->children == NULL) { in xmlSAX2StartElement()
1641 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2StartElement()
1643 parent = ctxt->myDoc->children; in xmlSAX2StartElement()
1645 ctxt->nodemem = -1; in xmlSAX2StartElement()
1646 if (ctxt->linenumbers) { in xmlSAX2StartElement()
1647 if (ctxt->input != NULL) { in xmlSAX2StartElement()
1648 if (ctxt->input->line < 65535) in xmlSAX2StartElement()
1649 ret->line = (short) ctxt->input->line; in xmlSAX2StartElement()
1661 nodePush(ctxt, ret); in xmlSAX2StartElement()
1686 if ((!ctxt->html) && in xmlSAX2StartElement()
1687 ((ctxt->myDoc->intSubset != NULL) || in xmlSAX2StartElement()
1688 (ctxt->myDoc->extSubset != NULL))) { in xmlSAX2StartElement()
1689 xmlCheckDefaultedAttributes(ctxt, name, prefix, atts); in xmlSAX2StartElement()
1699 if (!ctxt->html) { in xmlSAX2StartElement()
1703 xmlSAX2AttributeInternal(ctxt, att, value, prefix); in xmlSAX2StartElement()
1715 ns = xmlSearchNs(ctxt->myDoc, ret, prefix); in xmlSAX2StartElement()
1717 ns = xmlSearchNs(ctxt->myDoc, parent, prefix); in xmlSAX2StartElement()
1720 xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2StartElement()
1740 if (ctxt->html) { in xmlSAX2StartElement()
1742 xmlSAX2AttributeInternal(ctxt, att, value, NULL); in xmlSAX2StartElement()
1750 xmlSAX2AttributeInternal(ctxt, att, value, NULL); in xmlSAX2StartElement()
1766 if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { in xmlSAX2StartElement()
1769 chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElement()
1771 ctxt->valid = 0; in xmlSAX2StartElement()
1773 ctxt->wellFormed = 0; in xmlSAX2StartElement()
1774 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElement()
1775 ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1; in xmlSAX2StartElement()
1794 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EndElement() local
1798 cur = ctxt->node; in xmlSAX2EndElement()
1807 if (cur != NULL && ctxt->record_info) { in xmlSAX2EndElement()
1808 ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base; in xmlSAX2EndElement()
1809 ctxt->nodeInfo->end_line = ctxt->input->line; in xmlSAX2EndElement()
1810 ctxt->nodeInfo->node = cur; in xmlSAX2EndElement()
1811 xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo); in xmlSAX2EndElement()
1813 ctxt->nodemem = -1; in xmlSAX2EndElement()
1816 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2EndElement()
1817 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2EndElement()
1818 ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2EndElement()
1829 nodePop(ctxt); in xmlSAX2EndElement()
1844 xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { in xmlSAX2TextNode() argument
1851 if (ctxt->freeElems != NULL) { in xmlSAX2TextNode()
1852 ret = ctxt->freeElems; in xmlSAX2TextNode()
1853 ctxt->freeElems = ret->next; in xmlSAX2TextNode()
1854 ctxt->freeElemsNr--; in xmlSAX2TextNode()
1859 xmlErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2TextNode()
1867 if (ctxt->dictNames) { in xmlSAX2TextNode()
1871 (ctxt->options & XML_PARSE_COMPACT)) { in xmlSAX2TextNode()
1879 intern = xmlDictLookup(ctxt->dict, str, len); in xmlSAX2TextNode()
1887 intern = xmlDictLookup(ctxt->dict, str, len); in xmlSAX2TextNode()
1897 xmlSAX2ErrMemory(ctxt, "xmlSAX2TextNode"); in xmlSAX2TextNode()
1904 if (ctxt->linenumbers) { in xmlSAX2TextNode()
1905 if (ctxt->input != NULL) { in xmlSAX2TextNode()
1906 if (ctxt->input->line < 65535) in xmlSAX2TextNode()
1907 ret->line = (short) ctxt->input->line; in xmlSAX2TextNode()
1910 if (ctxt->options & XML_PARSE_BIG_LINES) in xmlSAX2TextNode()
1911 ret->psvi = (void *) (long) ctxt->input->line; in xmlSAX2TextNode()
1933 xmlSAX2DecodeAttrEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, in xmlSAX2DecodeAttrEntities() argument
1944 ctxt->depth++; in xmlSAX2DecodeAttrEntities()
1945 ret = xmlStringLenDecodeEntities(ctxt, str, end - str, in xmlSAX2DecodeAttrEntities()
1947 ctxt->depth--; in xmlSAX2DecodeAttrEntities()
1967 xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, in xmlSAX2AttributeNs() argument
1981 namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, prefix); in xmlSAX2AttributeNs()
1986 if (ctxt->freeAttrs != NULL) { in xmlSAX2AttributeNs()
1987 ret = ctxt->freeAttrs; in xmlSAX2AttributeNs()
1988 ctxt->freeAttrs = ret->next; in xmlSAX2AttributeNs()
1989 ctxt->freeAttrsNr--; in xmlSAX2AttributeNs()
1993 ret->parent = ctxt->node; in xmlSAX2AttributeNs()
1994 ret->doc = ctxt->myDoc; in xmlSAX2AttributeNs()
1997 if (ctxt->dictNames) in xmlSAX2AttributeNs()
2003 if (ctxt->node->properties == NULL) { in xmlSAX2AttributeNs()
2004 ctxt->node->properties = ret; in xmlSAX2AttributeNs()
2006 xmlAttrPtr prev = ctxt->node->properties; in xmlSAX2AttributeNs()
2016 if (ctxt->dictNames) in xmlSAX2AttributeNs()
2017 ret = xmlNewNsPropEatName(ctxt->node, namespace, in xmlSAX2AttributeNs()
2020 ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL); in xmlSAX2AttributeNs()
2022 xmlErrMemory(ctxt, "xmlSAX2AttributeNs"); in xmlSAX2AttributeNs()
2027 if ((ctxt->replaceEntities == 0) && (!ctxt->html)) { in xmlSAX2AttributeNs()
2036 tmp = xmlSAX2TextNode(ctxt, value, valueend - value); in xmlSAX2AttributeNs()
2044 ret->children = xmlStringLenGetNodeList(ctxt->myDoc, value, in xmlSAX2AttributeNs()
2058 tmp = xmlSAX2TextNode(ctxt, value, valueend - value); in xmlSAX2AttributeNs()
2068 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeNs()
2069 ctxt->myDoc && ctxt->myDoc->intSubset) { in xmlSAX2AttributeNs()
2074 if (!ctxt->replaceEntities) { in xmlSAX2AttributeNs()
2075 dup = xmlSAX2DecodeAttrEntities(ctxt, value, valueend); in xmlSAX2AttributeNs()
2078 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2079 ctxt->myDoc, ctxt->node, ret, value); in xmlSAX2AttributeNs()
2088 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2089 ctxt->myDoc, ctxt->node, ret, dup); in xmlSAX2AttributeNs()
2099 if (ctxt->attsSpecial != NULL) { in xmlSAX2AttributeNs()
2106 ctxt->vctxt.valid = 1; in xmlSAX2AttributeNs()
2108 &ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeNs()
2109 ctxt->node, fullname, dup); in xmlSAX2AttributeNs()
2110 if (ctxt->vctxt.valid != 1) in xmlSAX2AttributeNs()
2111 ctxt->valid = 0; in xmlSAX2AttributeNs()
2122 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2123 ctxt->myDoc, ctxt->node, ret, dup); in xmlSAX2AttributeNs()
2132 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2133 ctxt->myDoc, ctxt->node, ret, dup); in xmlSAX2AttributeNs()
2137 if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) && in xmlSAX2AttributeNs()
2138 (((ctxt->replaceEntities == 0) && (ctxt->external != 2)) || in xmlSAX2AttributeNs()
2139 ((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) { in xmlSAX2AttributeNs()
2144 if ((prefix == ctxt->str_xml) && in xmlSAX2AttributeNs()
2157 xmlErrValid(ctxt, XML_DTD_XMLID_VALUE, in xmlSAX2AttributeNs()
2163 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); in xmlSAX2AttributeNs()
2164 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) { in xmlSAX2AttributeNs()
2168 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); in xmlSAX2AttributeNs()
2169 } else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) { in xmlSAX2AttributeNs()
2172 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, dup, ret); in xmlSAX2AttributeNs()
2207 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2StartElementNs() local
2216 parent = ctxt->node; in xmlSAX2StartElementNs()
2220 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && in xmlSAX2StartElementNs()
2221 ((ctxt->myDoc->intSubset == NULL) || in xmlSAX2StartElementNs()
2222 ((ctxt->myDoc->intSubset->notations == NULL) && in xmlSAX2StartElementNs()
2223 (ctxt->myDoc->intSubset->elements == NULL) && in xmlSAX2StartElementNs()
2224 (ctxt->myDoc->intSubset->attributes == NULL) && in xmlSAX2StartElementNs()
2225 (ctxt->myDoc->intSubset->entities == NULL)))) { in xmlSAX2StartElementNs()
2226 xmlErrValid(ctxt, XML_DTD_NO_DTD, in xmlSAX2StartElementNs()
2228 ctxt->validate = 0; in xmlSAX2StartElementNs()
2235 if (ctxt->dictNames) { in xmlSAX2StartElementNs()
2238 fullname = xmlDictQLookup(ctxt->dict, prefix, localname); in xmlSAX2StartElementNs()
2248 if (ctxt->freeElems != NULL) { in xmlSAX2StartElementNs()
2249 ret = ctxt->freeElems; in xmlSAX2StartElementNs()
2250 ctxt->freeElems = ret->next; in xmlSAX2StartElementNs()
2251 ctxt->freeElemsNr--; in xmlSAX2StartElementNs()
2255 if (ctxt->dictNames) in xmlSAX2StartElementNs()
2263 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); in xmlSAX2StartElementNs()
2270 if (ctxt->dictNames) in xmlSAX2StartElementNs()
2271 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, in xmlSAX2StartElementNs()
2274 ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); in xmlSAX2StartElementNs()
2276 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, in xmlSAX2StartElementNs()
2279 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); in xmlSAX2StartElementNs()
2283 if (ctxt->linenumbers) { in xmlSAX2StartElementNs()
2284 if (ctxt->input != NULL) { in xmlSAX2StartElementNs()
2285 if (ctxt->input->line < 65535) in xmlSAX2StartElementNs()
2286 ret->line = (short) ctxt->input->line; in xmlSAX2StartElementNs()
2293 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2StartElementNs()
2320 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && in xmlSAX2StartElementNs()
2321 ctxt->myDoc && ctxt->myDoc->intSubset) { in xmlSAX2StartElementNs()
2322 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2StartElementNs()
2327 ctxt->nodemem = -1; in xmlSAX2StartElementNs()
2332 nodePush(ctxt, ret); in xmlSAX2StartElementNs()
2349 ((ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0)) in xmlSAX2StartElementNs()
2357 ret->ns = xmlSearchNs(ctxt->myDoc, parent, prefix); in xmlSAX2StartElementNs()
2359 ret->ns = xmlSearchNs(ctxt->myDoc, ret, prefix); in xmlSAX2StartElementNs()
2365 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); in xmlSAX2StartElementNs()
2369 xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2StartElementNs()
2373 xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2StartElementNs()
2388 if (ctxt->dictNames) { in xmlSAX2StartElementNs()
2391 fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], in xmlSAX2StartElementNs()
2394 xmlSAX2AttributeNs(ctxt, fullname, NULL, in xmlSAX2StartElementNs()
2402 xmlSAX2AttributeNs(ctxt, lname, NULL, in xmlSAX2StartElementNs()
2409 xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], in xmlSAX2StartElementNs()
2419 if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { in xmlSAX2StartElementNs()
2422 chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElementNs()
2424 ctxt->valid = 0; in xmlSAX2StartElementNs()
2426 ctxt->wellFormed = 0; in xmlSAX2StartElementNs()
2427 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElementNs()
2428 ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1; in xmlSAX2StartElementNs()
2449 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EndElementNs() local
2454 cur = ctxt->node; in xmlSAX2EndElementNs()
2456 if ((ctxt->record_info) && (cur != NULL)) { in xmlSAX2EndElementNs()
2457 node_info.end_pos = ctxt->input->cur - ctxt->input->base; in xmlSAX2EndElementNs()
2458 node_info.end_line = ctxt->input->line; in xmlSAX2EndElementNs()
2460 xmlParserAddNodeInfo(ctxt, &node_info); in xmlSAX2EndElementNs()
2462 ctxt->nodemem = -1; in xmlSAX2EndElementNs()
2465 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2EndElementNs()
2466 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2EndElementNs()
2467 ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, cur); in xmlSAX2EndElementNs()
2473 nodePop(ctxt); in xmlSAX2EndElementNs()
2486 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2Reference() local
2495 ret = xmlNewCharRef(ctxt->myDoc, name); in xmlSAX2Reference()
2497 ret = xmlNewReference(ctxt->myDoc, name); in xmlSAX2Reference()
2500 "add xmlSAX2Reference %s to %s \n", name, ctxt->node->name); in xmlSAX2Reference()
2502 if (xmlAddChild(ctxt->node, ret) == NULL) { in xmlSAX2Reference()
2518 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2Characters() local
2532 if (ctxt->node == NULL) { in xmlSAX2Characters()
2539 lastChild = ctxt->node->last; in xmlSAX2Characters()
2542 "add chars to %s \n", ctxt->node->name); in xmlSAX2Characters()
2550 lastChild = xmlSAX2TextNode(ctxt, ch, len); in xmlSAX2Characters()
2552 ctxt->node->children = lastChild; in xmlSAX2Characters()
2553 ctxt->node->last = lastChild; in xmlSAX2Characters()
2554 lastChild->parent = ctxt->node; in xmlSAX2Characters()
2555 lastChild->doc = ctxt->node->doc; in xmlSAX2Characters()
2556 ctxt->nodelen = len; in xmlSAX2Characters()
2557 ctxt->nodemem = len + 1; in xmlSAX2Characters()
2559 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2Characters()
2566 if ((coalesceText) && (ctxt->nodemem != 0)) { in xmlSAX2Characters()
2577 } else if ((ctxt->nodemem == ctxt->nodelen + 1) && in xmlSAX2Characters()
2578 (xmlDictOwns(ctxt->dict, lastChild->content))) { in xmlSAX2Characters()
2582 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: xmlStrdup returned NULL"); in xmlSAX2Characters()
2585 if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) && in xmlSAX2Characters()
2586 ((ctxt->options & XML_PARSE_HUGE) == 0)) { in xmlSAX2Characters()
2587 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node"); in xmlSAX2Characters()
2590 if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len || in xmlSAX2Characters()
2591 (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) { in xmlSAX2Characters()
2592 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented"); in xmlSAX2Characters()
2595 if (ctxt->nodelen + len >= ctxt->nodemem) { in xmlSAX2Characters()
2599 size = ctxt->nodemem + len; in xmlSAX2Characters()
2603 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2Characters()
2606 ctxt->nodemem = size; in xmlSAX2Characters()
2609 memcpy(&lastChild->content[ctxt->nodelen], ch, len); in xmlSAX2Characters()
2610 ctxt->nodelen += len; in xmlSAX2Characters()
2611 lastChild->content[ctxt->nodelen] = 0; in xmlSAX2Characters()
2614 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2Characters()
2616 if (ctxt->node->children != NULL) { in xmlSAX2Characters()
2617 ctxt->nodelen = xmlStrlen(lastChild->content); in xmlSAX2Characters()
2618 ctxt->nodemem = ctxt->nodelen + 1; in xmlSAX2Characters()
2622 lastChild = xmlSAX2TextNode(ctxt, ch, len); in xmlSAX2Characters()
2624 xmlAddChild(ctxt->node, lastChild); in xmlSAX2Characters()
2625 if (ctxt->node->children != NULL) { in xmlSAX2Characters()
2626 ctxt->nodelen = len; in xmlSAX2Characters()
2627 ctxt->nodemem = len + 1; in xmlSAX2Characters()
2665 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ProcessingInstruction() local
2670 parent = ctxt->node; in xmlSAX2ProcessingInstruction()
2676 ret = xmlNewDocPI(ctxt->myDoc, target, data); in xmlSAX2ProcessingInstruction()
2679 if (ctxt->linenumbers) { in xmlSAX2ProcessingInstruction()
2680 if (ctxt->input != NULL) { in xmlSAX2ProcessingInstruction()
2681 if (ctxt->input->line < 65535) in xmlSAX2ProcessingInstruction()
2682 ret->line = (short) ctxt->input->line; in xmlSAX2ProcessingInstruction()
2687 if (ctxt->inSubset == 1) { in xmlSAX2ProcessingInstruction()
2688 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); in xmlSAX2ProcessingInstruction()
2690 } else if (ctxt->inSubset == 2) { in xmlSAX2ProcessingInstruction()
2691 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); in xmlSAX2ProcessingInstruction()
2699 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2ProcessingInstruction()
2728 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2Comment() local
2733 parent = ctxt->node; in xmlSAX2Comment()
2737 ret = xmlNewDocComment(ctxt->myDoc, value); in xmlSAX2Comment()
2739 if (ctxt->linenumbers) { in xmlSAX2Comment()
2740 if (ctxt->input != NULL) { in xmlSAX2Comment()
2741 if (ctxt->input->line < 65535) in xmlSAX2Comment()
2742 ret->line = (short) ctxt->input->line; in xmlSAX2Comment()
2748 if (ctxt->inSubset == 1) { in xmlSAX2Comment()
2749 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); in xmlSAX2Comment()
2751 } else if (ctxt->inSubset == 2) { in xmlSAX2Comment()
2752 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); in xmlSAX2Comment()
2760 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2Comment()
2790 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2CDataBlock() local
2798 lastChild = xmlGetLastChild(ctxt->node); in xmlSAX2CDataBlock()
2801 "add chars to %s \n", ctxt->node->name); in xmlSAX2CDataBlock()
2807 ret = xmlNewCDataBlock(ctxt->myDoc, value, len); in xmlSAX2CDataBlock()
2808 xmlAddChild(ctxt->node, ret); in xmlSAX2CDataBlock()