• Home
  • Raw
  • Download

Lines Matching refs:ctxt

59 xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) {  in xmlSAX2ErrMemory()  argument
60 if (ctxt != NULL) { in xmlSAX2ErrMemory()
61 if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) in xmlSAX2ErrMemory()
62 ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg); in xmlSAX2ErrMemory()
63 ctxt->errNo = XML_ERR_NO_MEMORY; in xmlSAX2ErrMemory()
64 ctxt->instate = XML_PARSER_EOF; in xmlSAX2ErrMemory()
65 ctxt->disableSAX = 1; in xmlSAX2ErrMemory()
80 xmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlErrValid() argument
85 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlErrValid()
86 (ctxt->instate == XML_PARSER_EOF)) in xmlErrValid()
88 if (ctxt != NULL) { in xmlErrValid()
89 ctxt->errNo = error; in xmlErrValid()
90 if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) in xmlErrValid()
91 schannel = ctxt->sax->serror; in xmlErrValid()
93 ctxt->vctxt.error, ctxt->vctxt.userData, in xmlErrValid()
94 ctxt, NULL, XML_FROM_DTD, error, in xmlErrValid()
98 ctxt->valid = 0; in xmlErrValid()
102 ctxt, NULL, XML_FROM_DTD, error, in xmlErrValid()
120 xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlFatalErrMsg() argument
123 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlFatalErrMsg()
124 (ctxt->instate == XML_PARSER_EOF)) in xmlFatalErrMsg()
126 if (ctxt != NULL) in xmlFatalErrMsg()
127 ctxt->errNo = error; in xmlFatalErrMsg()
128 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, in xmlFatalErrMsg()
132 if (ctxt != NULL) { in xmlFatalErrMsg()
133 ctxt->wellFormed = 0; in xmlFatalErrMsg()
134 ctxt->valid = 0; in xmlFatalErrMsg()
135 if (ctxt->recovery == 0) in xmlFatalErrMsg()
136 ctxt->disableSAX = 1; in xmlFatalErrMsg()
151 xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlWarnMsg() argument
154 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlWarnMsg()
155 (ctxt->instate == XML_PARSER_EOF)) in xmlWarnMsg()
157 if (ctxt != NULL) in xmlWarnMsg()
158 ctxt->errNo = error; in xmlWarnMsg()
159 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, in xmlWarnMsg()
176 xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlNsErrMsg() argument
179 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlNsErrMsg()
180 (ctxt->instate == XML_PARSER_EOF)) in xmlNsErrMsg()
182 if (ctxt != NULL) in xmlNsErrMsg()
183 ctxt->errNo = error; in xmlNsErrMsg()
184 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, in xmlNsErrMsg()
200 xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, in xmlNsWarnMsg() argument
203 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && in xmlNsWarnMsg()
204 (ctxt->instate == XML_PARSER_EOF)) in xmlNsWarnMsg()
206 if (ctxt != NULL) in xmlNsWarnMsg()
207 ctxt->errNo = error; in xmlNsWarnMsg()
208 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, in xmlNsWarnMsg()
241 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetSystemId() local
242 if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL); in xmlSAX2GetSystemId()
243 return((const xmlChar *) ctxt->input->filename); in xmlSAX2GetSystemId()
257 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetLineNumber() local
258 if ((ctx == NULL) || (ctxt->input == NULL)) return(0); in xmlSAX2GetLineNumber()
259 return(ctxt->input->line); in xmlSAX2GetLineNumber()
273 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetColumnNumber() local
274 if ((ctx == NULL) || (ctxt->input == NULL)) return(0); in xmlSAX2GetColumnNumber()
275 return(ctxt->input->col); in xmlSAX2GetColumnNumber()
289 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2IsStandalone() local
290 if ((ctx == NULL) || (ctxt->myDoc == NULL)) return(0); in xmlSAX2IsStandalone()
291 return(ctxt->myDoc->standalone == 1); in xmlSAX2IsStandalone()
305 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2HasInternalSubset() local
306 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); in xmlSAX2HasInternalSubset()
307 return(ctxt->myDoc->intSubset != NULL); in xmlSAX2HasInternalSubset()
321 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2HasExternalSubset() local
322 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); in xmlSAX2HasExternalSubset()
323 return(ctxt->myDoc->extSubset != NULL); in xmlSAX2HasExternalSubset()
339 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2InternalSubset() local
348 if (ctxt->myDoc == NULL) in xmlSAX2InternalSubset()
350 dtd = xmlGetIntSubset(ctxt->myDoc); in xmlSAX2InternalSubset()
352 if (ctxt->html) in xmlSAX2InternalSubset()
356 ctxt->myDoc->intSubset = NULL; in xmlSAX2InternalSubset()
358 ctxt->myDoc->intSubset = in xmlSAX2InternalSubset()
359 xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); in xmlSAX2InternalSubset()
360 if (ctxt->myDoc->intSubset == NULL) in xmlSAX2InternalSubset()
361 xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset"); in xmlSAX2InternalSubset()
377 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ExternalSubset() local
385 (((ctxt->validate) || (ctxt->loadsubset != 0)) && in xmlSAX2ExternalSubset()
386 (ctxt->wellFormed && ctxt->myDoc))) { in xmlSAX2ExternalSubset()
401 if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL)) in xmlSAX2ExternalSubset()
402 input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, in xmlSAX2ExternalSubset()
408 xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID); in xmlSAX2ExternalSubset()
413 oldinput = ctxt->input; in xmlSAX2ExternalSubset()
414 oldinputNr = ctxt->inputNr; in xmlSAX2ExternalSubset()
415 oldinputMax = ctxt->inputMax; in xmlSAX2ExternalSubset()
416 oldinputTab = ctxt->inputTab; in xmlSAX2ExternalSubset()
417 oldcharset = ctxt->charset; in xmlSAX2ExternalSubset()
419 ctxt->inputTab = (xmlParserInputPtr *) in xmlSAX2ExternalSubset()
421 if (ctxt->inputTab == NULL) { in xmlSAX2ExternalSubset()
422 xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset"); in xmlSAX2ExternalSubset()
423 ctxt->input = oldinput; in xmlSAX2ExternalSubset()
424 ctxt->inputNr = oldinputNr; in xmlSAX2ExternalSubset()
425 ctxt->inputMax = oldinputMax; in xmlSAX2ExternalSubset()
426 ctxt->inputTab = oldinputTab; in xmlSAX2ExternalSubset()
427 ctxt->charset = oldcharset; in xmlSAX2ExternalSubset()
430 ctxt->inputNr = 0; in xmlSAX2ExternalSubset()
431 ctxt->inputMax = 5; in xmlSAX2ExternalSubset()
432 ctxt->input = NULL; in xmlSAX2ExternalSubset()
433 xmlPushInput(ctxt, input); in xmlSAX2ExternalSubset()
438 if (ctxt->input->length >= 4) { in xmlSAX2ExternalSubset()
439 enc = xmlDetectCharEncoding(ctxt->input->cur, 4); in xmlSAX2ExternalSubset()
440 xmlSwitchEncoding(ctxt, enc); in xmlSAX2ExternalSubset()
447 input->base = ctxt->input->cur; in xmlSAX2ExternalSubset()
448 input->cur = ctxt->input->cur; in xmlSAX2ExternalSubset()
454 xmlParseExternalSubset(ctxt, ExternalID, SystemID); in xmlSAX2ExternalSubset()
460 while (ctxt->inputNr > 1) in xmlSAX2ExternalSubset()
461 xmlPopInput(ctxt); in xmlSAX2ExternalSubset()
462 xmlFreeInputStream(ctxt->input); in xmlSAX2ExternalSubset()
463 xmlFree(ctxt->inputTab); in xmlSAX2ExternalSubset()
468 ctxt->input = oldinput; in xmlSAX2ExternalSubset()
469 ctxt->inputNr = oldinputNr; in xmlSAX2ExternalSubset()
470 ctxt->inputMax = oldinputMax; in xmlSAX2ExternalSubset()
471 ctxt->inputTab = oldinputTab; in xmlSAX2ExternalSubset()
472 ctxt->charset = oldcharset; in xmlSAX2ExternalSubset()
494 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ResolveEntity() local
500 if (ctxt->input != NULL) in xmlSAX2ResolveEntity()
501 base = ctxt->input->filename; in xmlSAX2ResolveEntity()
503 base = ctxt->directory; in xmlSAX2ResolveEntity()
513 (const char *) publicId, ctxt); in xmlSAX2ResolveEntity()
531 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetEntity() local
540 if (ctxt->inSubset == 0) { in xmlSAX2GetEntity()
545 if ((ctxt->myDoc != NULL) && (ctxt->myDoc->standalone == 1)) { in xmlSAX2GetEntity()
546 if (ctxt->inSubset == 2) { in xmlSAX2GetEntity()
547 ctxt->myDoc->standalone = 0; in xmlSAX2GetEntity()
548 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
549 ctxt->myDoc->standalone = 1; in xmlSAX2GetEntity()
551 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
553 ctxt->myDoc->standalone = 0; in xmlSAX2GetEntity()
554 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
556 xmlFatalErrMsg(ctxt, XML_ERR_NOT_STANDALONE, in xmlSAX2GetEntity()
560 ctxt->myDoc->standalone = 1; in xmlSAX2GetEntity()
564 ret = xmlGetDocEntity(ctxt->myDoc, name); in xmlSAX2GetEntity()
567 ((ctxt->validate) || (ctxt->replaceEntities)) && in xmlSAX2GetEntity()
578 val = xmlParseCtxtExternalEntity(ctxt, ret->URI, in xmlSAX2GetEntity()
583 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, in xmlSAX2GetEntity()
585 ctxt->validate = 0; in xmlSAX2GetEntity()
607 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2GetParameterEntity() local
616 ret = xmlGetParameterEntity(ctxt->myDoc, name); in xmlSAX2GetParameterEntity()
637 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EntityDecl() local
645 if (ctxt->inSubset == 1) { in xmlSAX2EntityDecl()
646 ent = xmlAddDocEntity(ctxt->myDoc, name, type, publicId, in xmlSAX2EntityDecl()
648 if ((ent == NULL) && (ctxt->pedantic)) in xmlSAX2EntityDecl()
649 xmlWarnMsg(ctxt, XML_WAR_ENTITY_REDEFINED, in xmlSAX2EntityDecl()
656 if (ctxt->input != NULL) in xmlSAX2EntityDecl()
657 base = ctxt->input->filename; in xmlSAX2EntityDecl()
659 base = ctxt->directory; in xmlSAX2EntityDecl()
664 } else if (ctxt->inSubset == 2) { in xmlSAX2EntityDecl()
665 ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId, in xmlSAX2EntityDecl()
667 if ((ent == NULL) && (ctxt->pedantic) && in xmlSAX2EntityDecl()
668 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2EntityDecl()
669 ctxt->sax->warning(ctxt->userData, in xmlSAX2EntityDecl()
675 if (ctxt->input != NULL) in xmlSAX2EntityDecl()
676 base = ctxt->input->filename; in xmlSAX2EntityDecl()
678 base = ctxt->directory; in xmlSAX2EntityDecl()
684 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, in xmlSAX2EntityDecl()
707 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2AttributeDecl() local
711 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) in xmlSAX2AttributeDecl()
724 int tmp = ctxt->valid; in xmlSAX2AttributeDecl()
725 xmlErrValid(ctxt, XML_DTD_XMLID_TYPE, in xmlSAX2AttributeDecl()
727 ctxt->valid = tmp; in xmlSAX2AttributeDecl()
730 name = xmlSplitQName(ctxt, fullname, &prefix); in xmlSAX2AttributeDecl()
731 ctxt->vctxt.valid = 1; in xmlSAX2AttributeDecl()
732 if (ctxt->inSubset == 1) in xmlSAX2AttributeDecl()
733 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem, in xmlSAX2AttributeDecl()
736 else if (ctxt->inSubset == 2) in xmlSAX2AttributeDecl()
737 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem, in xmlSAX2AttributeDecl()
741 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlSAX2AttributeDecl()
748 if (ctxt->vctxt.valid == 0) in xmlSAX2AttributeDecl()
749 ctxt->valid = 0; in xmlSAX2AttributeDecl()
750 if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) && in xmlSAX2AttributeDecl()
751 (ctxt->myDoc->intSubset != NULL)) in xmlSAX2AttributeDecl()
752 ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeDecl()
774 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ElementDecl() local
777 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) in xmlSAX2ElementDecl()
785 if (ctxt->inSubset == 1) in xmlSAX2ElementDecl()
786 elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, in xmlSAX2ElementDecl()
788 else if (ctxt->inSubset == 2) in xmlSAX2ElementDecl()
789 elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, in xmlSAX2ElementDecl()
792 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlSAX2ElementDecl()
799 ctxt->valid = 0; in xmlSAX2ElementDecl()
800 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2ElementDecl()
801 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2ElementDecl()
802 ctxt->valid &= in xmlSAX2ElementDecl()
803 xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem); in xmlSAX2ElementDecl()
820 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2NotationDecl() local
823 if ((ctxt == NULL) || (ctxt->myDoc == NULL)) in xmlSAX2NotationDecl()
832 xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, in xmlSAX2NotationDecl()
836 } else if (ctxt->inSubset == 1) in xmlSAX2NotationDecl()
837 nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name, in xmlSAX2NotationDecl()
839 else if (ctxt->inSubset == 2) in xmlSAX2NotationDecl()
840 nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, name, in xmlSAX2NotationDecl()
843 xmlFatalErrMsg(ctxt, XML_ERR_NOTATION_PROCESSING, in xmlSAX2NotationDecl()
849 if (nota == NULL) ctxt->valid = 0; in xmlSAX2NotationDecl()
850 if ((ctxt->validate) && (ctxt->wellFormed) && in xmlSAX2NotationDecl()
851 (ctxt->myDoc->intSubset != NULL)) in xmlSAX2NotationDecl()
852 ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2NotationDecl()
873 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2UnparsedEntityDecl() local
880 if (ctxt->inSubset == 1) { in xmlSAX2UnparsedEntityDecl()
881 ent = xmlAddDocEntity(ctxt->myDoc, name, in xmlSAX2UnparsedEntityDecl()
884 if ((ent == NULL) && (ctxt->pedantic) && in xmlSAX2UnparsedEntityDecl()
885 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2UnparsedEntityDecl()
886 ctxt->sax->warning(ctxt->userData, in xmlSAX2UnparsedEntityDecl()
892 if (ctxt->input != NULL) in xmlSAX2UnparsedEntityDecl()
893 base = ctxt->input->filename; in xmlSAX2UnparsedEntityDecl()
895 base = ctxt->directory; in xmlSAX2UnparsedEntityDecl()
900 } else if (ctxt->inSubset == 2) { in xmlSAX2UnparsedEntityDecl()
901 ent = xmlAddDtdEntity(ctxt->myDoc, name, in xmlSAX2UnparsedEntityDecl()
904 if ((ent == NULL) && (ctxt->pedantic) && in xmlSAX2UnparsedEntityDecl()
905 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2UnparsedEntityDecl()
906 ctxt->sax->warning(ctxt->userData, in xmlSAX2UnparsedEntityDecl()
912 if (ctxt->input != NULL) in xmlSAX2UnparsedEntityDecl()
913 base = ctxt->input->filename; in xmlSAX2UnparsedEntityDecl()
915 base = ctxt->directory; in xmlSAX2UnparsedEntityDecl()
921 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, in xmlSAX2UnparsedEntityDecl()
954 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2StartDocument() local
963 if (ctxt->html) { in xmlSAX2StartDocument()
965 if (ctxt->myDoc == NULL) in xmlSAX2StartDocument()
966 ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL); in xmlSAX2StartDocument()
967 ctxt->myDoc->properties = XML_DOC_HTML; in xmlSAX2StartDocument()
968 ctxt->myDoc->parseFlags = ctxt->options; in xmlSAX2StartDocument()
969 if (ctxt->myDoc == NULL) { in xmlSAX2StartDocument()
970 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); in xmlSAX2StartDocument()
976 ctxt->errNo = XML_ERR_INTERNAL_ERROR; in xmlSAX2StartDocument()
977 ctxt->instate = XML_PARSER_EOF; in xmlSAX2StartDocument()
978 ctxt->disableSAX = 1; in xmlSAX2StartDocument()
982 doc = ctxt->myDoc = xmlNewDoc(ctxt->version); in xmlSAX2StartDocument()
985 if (ctxt->options & XML_PARSE_OLD10) in xmlSAX2StartDocument()
987 doc->parseFlags = ctxt->options; in xmlSAX2StartDocument()
988 if (ctxt->encoding != NULL) in xmlSAX2StartDocument()
989 doc->encoding = xmlStrdup(ctxt->encoding); in xmlSAX2StartDocument()
992 doc->standalone = ctxt->standalone; in xmlSAX2StartDocument()
994 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); in xmlSAX2StartDocument()
997 if ((ctxt->dictNames) && (doc != NULL)) { in xmlSAX2StartDocument()
998 doc->dict = ctxt->dict; in xmlSAX2StartDocument()
1002 if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) && in xmlSAX2StartDocument()
1003 (ctxt->input != NULL) && (ctxt->input->filename != NULL)) { in xmlSAX2StartDocument()
1004 ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename); in xmlSAX2StartDocument()
1005 if (ctxt->myDoc->URL == NULL) in xmlSAX2StartDocument()
1006 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); in xmlSAX2StartDocument()
1019 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EndDocument() local
1026 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2EndDocument()
1027 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2EndDocument()
1028 ctxt->valid &= xmlValidateDocumentFinal(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2EndDocument()
1034 if ((ctxt->encoding != NULL) && (ctxt->myDoc != NULL) && in xmlSAX2EndDocument()
1035 (ctxt->myDoc->encoding == NULL)) { in xmlSAX2EndDocument()
1036 ctxt->myDoc->encoding = ctxt->encoding; in xmlSAX2EndDocument()
1037 ctxt->encoding = NULL; in xmlSAX2EndDocument()
1039 if ((ctxt->inputTab != NULL) && in xmlSAX2EndDocument()
1040 (ctxt->inputNr > 0) && (ctxt->inputTab[0] != NULL) && in xmlSAX2EndDocument()
1041 (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) && in xmlSAX2EndDocument()
1042 (ctxt->myDoc->encoding == NULL)) { in xmlSAX2EndDocument()
1043 ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding); in xmlSAX2EndDocument()
1045 if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) && in xmlSAX2EndDocument()
1046 (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) { in xmlSAX2EndDocument()
1047 ctxt->myDoc->charset = ctxt->charset; in xmlSAX2EndDocument()
1068 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2AttributeInternal() local
1075 if (ctxt->html) { in xmlSAX2AttributeInternal()
1083 name = xmlSplitQName(ctxt, fullname, &ns); in xmlSAX2AttributeInternal()
1086 xmlNsErrMsg(ctxt, XML_ERR_NS_DECL_ERROR, in xmlSAX2AttributeInternal()
1090 xmlNsWarnMsg(ctxt, XML_WAR_NS_COLUMN, in xmlSAX2AttributeInternal()
1102 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2AttributeInternal()
1109 if ((ctxt->html) && in xmlSAX2AttributeInternal()
1122 ctxt->vctxt.valid = 1; in xmlSAX2AttributeInternal()
1123 nval = xmlValidCtxtNormalizeAttributeValue(&ctxt->vctxt, in xmlSAX2AttributeInternal()
1124 ctxt->myDoc, ctxt->node, in xmlSAX2AttributeInternal()
1126 if (ctxt->vctxt.valid != 1) { in xmlSAX2AttributeInternal()
1127 ctxt->valid = 0; in xmlSAX2AttributeInternal()
1139 if ((!ctxt->html) && (ns == NULL) && in xmlSAX2AttributeInternal()
1145 if (!ctxt->replaceEntities) { in xmlSAX2AttributeInternal()
1146 ctxt->depth++; in xmlSAX2AttributeInternal()
1147 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, in xmlSAX2AttributeInternal()
1149 ctxt->depth--; in xmlSAX2AttributeInternal()
1159 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2AttributeInternal()
1160 ctxt->sax->warning(ctxt->userData, in xmlSAX2AttributeInternal()
1164 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) in xmlSAX2AttributeInternal()
1165 ctxt->sax->warning(ctxt->userData, in xmlSAX2AttributeInternal()
1173 nsret = xmlNewNs(ctxt->node, val, NULL); in xmlSAX2AttributeInternal()
1180 if (nsret != NULL && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeInternal()
1181 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2AttributeInternal()
1182 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeInternal()
1183 ctxt->node, prefix, nsret, val); in xmlSAX2AttributeInternal()
1193 if ((!ctxt->html) && in xmlSAX2AttributeInternal()
1199 if (!ctxt->replaceEntities) { in xmlSAX2AttributeInternal()
1200 ctxt->depth++; in xmlSAX2AttributeInternal()
1201 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, in xmlSAX2AttributeInternal()
1203 ctxt->depth--; in xmlSAX2AttributeInternal()
1205 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2AttributeInternal()
1216 xmlNsErrMsg(ctxt, XML_NS_ERR_EMPTY, in xmlSAX2AttributeInternal()
1219 if ((ctxt->pedantic != 0) && (val[0] != 0)) { in xmlSAX2AttributeInternal()
1224 xmlNsWarnMsg(ctxt, XML_WAR_NS_URI, in xmlSAX2AttributeInternal()
1228 xmlNsWarnMsg(ctxt, XML_WAR_NS_URI_RELATIVE, in xmlSAX2AttributeInternal()
1236 nsret = xmlNewNs(ctxt->node, val, name); in xmlSAX2AttributeInternal()
1243 if (nsret != NULL && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeInternal()
1244 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2AttributeInternal()
1245 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeInternal()
1246 ctxt->node, prefix, nsret, value); in xmlSAX2AttributeInternal()
1258 namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns); in xmlSAX2AttributeInternal()
1261 xmlNsErrMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2AttributeInternal()
1267 prop = ctxt->node->properties; in xmlSAX2AttributeInternal()
1273 xmlNsErrMsg(ctxt, XML_ERR_ATTRIBUTE_REDEFINED, in xmlSAX2AttributeInternal()
1276 ctxt->wellFormed = 0; in xmlSAX2AttributeInternal()
1277 if (ctxt->recovery == 0) ctxt->disableSAX = 1; in xmlSAX2AttributeInternal()
1289 ret = xmlNewNsPropEatName(ctxt->node, namespace, name, NULL); in xmlSAX2AttributeInternal()
1292 if ((ctxt->replaceEntities == 0) && (!ctxt->html)) { in xmlSAX2AttributeInternal()
1295 ret->children = xmlStringGetNodeList(ctxt->myDoc, value); in xmlSAX2AttributeInternal()
1304 ret->children = xmlNewDocText(ctxt->myDoc, value); in xmlSAX2AttributeInternal()
1312 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeInternal()
1313 ctxt->myDoc && ctxt->myDoc->intSubset) { in xmlSAX2AttributeInternal()
1319 if (!ctxt->replaceEntities) { in xmlSAX2AttributeInternal()
1322 ctxt->depth++; in xmlSAX2AttributeInternal()
1323 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, in xmlSAX2AttributeInternal()
1325 ctxt->depth--; in xmlSAX2AttributeInternal()
1328 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeInternal()
1329 ctxt->myDoc, ctxt->node, ret, value); in xmlSAX2AttributeInternal()
1338 nvalnorm = xmlValidNormalizeAttributeValue(ctxt->myDoc, in xmlSAX2AttributeInternal()
1339 ctxt->node, fullname, val); in xmlSAX2AttributeInternal()
1345 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeInternal()
1346 ctxt->myDoc, ctxt->node, ret, val); in xmlSAX2AttributeInternal()
1350 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeInternal()
1351 ctxt->node, ret, value); in xmlSAX2AttributeInternal()
1355 if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) && in xmlSAX2AttributeInternal()
1356 (((ctxt->replaceEntities == 0) && (ctxt->external != 2)) || in xmlSAX2AttributeInternal()
1357 ((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) { in xmlSAX2AttributeInternal()
1369 xmlErrValid(ctxt, XML_DTD_XMLID_VALUE, in xmlSAX2AttributeInternal()
1373 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret); in xmlSAX2AttributeInternal()
1374 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) in xmlSAX2AttributeInternal()
1375 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret); in xmlSAX2AttributeInternal()
1376 else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) in xmlSAX2AttributeInternal()
1377 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret); in xmlSAX2AttributeInternal()
1393 xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name, in xmlCheckDefaultedAttributes() argument
1400 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->intSubset, name, prefix); in xmlCheckDefaultedAttributes()
1402 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, name, prefix); in xmlCheckDefaultedAttributes()
1414 if ((ctxt->myDoc->standalone == 1) && in xmlCheckDefaultedAttributes()
1415 (ctxt->myDoc->extSubset != NULL) && in xmlCheckDefaultedAttributes()
1416 (ctxt->validate)) { in xmlCheckDefaultedAttributes()
1419 (xmlGetDtdQAttrDesc(ctxt->myDoc->extSubset, in xmlCheckDefaultedAttributes()
1422 (xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, in xmlCheckDefaultedAttributes()
1435 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlCheckDefaultedAttributes()
1455 xmlErrValid(ctxt, XML_DTD_STANDALONE_DEFAULTED, in xmlCheckDefaultedAttributes()
1489 (ctxt->loadsubset & XML_COMPLETE_ATTRS)) { in xmlCheckDefaultedAttributes()
1492 tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, in xmlCheckDefaultedAttributes()
1501 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlCheckDefaultedAttributes()
1521 xmlSAX2AttributeInternal(ctxt, fulln, in xmlCheckDefaultedAttributes()
1532 elemDecl = xmlGetDtdQElementDesc(ctxt->myDoc->extSubset, in xmlCheckDefaultedAttributes()
1551 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2StartElement() local
1561 if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return; in xmlSAX2StartElement()
1562 parent = ctxt->node; in xmlSAX2StartElement()
1571 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && in xmlSAX2StartElement()
1572 ((ctxt->myDoc->intSubset == NULL) || in xmlSAX2StartElement()
1573 ((ctxt->myDoc->intSubset->notations == NULL) && in xmlSAX2StartElement()
1574 (ctxt->myDoc->intSubset->elements == NULL) && in xmlSAX2StartElement()
1575 (ctxt->myDoc->intSubset->attributes == NULL) && in xmlSAX2StartElement()
1576 (ctxt->myDoc->intSubset->entities == NULL)))) { in xmlSAX2StartElement()
1577 xmlErrValid(ctxt, XML_ERR_NO_DTD, in xmlSAX2StartElement()
1579 ctxt->validate = 0; in xmlSAX2StartElement()
1586 name = xmlSplitQName(ctxt, fullname, &prefix); in xmlSAX2StartElement()
1594 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, name, NULL); in xmlSAX2StartElement()
1598 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); in xmlSAX2StartElement()
1601 if (ctxt->myDoc->children == NULL) { in xmlSAX2StartElement()
1605 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2StartElement()
1607 parent = ctxt->myDoc->children; in xmlSAX2StartElement()
1609 ctxt->nodemem = -1; in xmlSAX2StartElement()
1610 if (ctxt->linenumbers) { in xmlSAX2StartElement()
1611 if (ctxt->input != NULL) { in xmlSAX2StartElement()
1612 if (ctxt->input->line < 65535) in xmlSAX2StartElement()
1613 ret->line = (short) ctxt->input->line; in xmlSAX2StartElement()
1625 nodePush(ctxt, ret); in xmlSAX2StartElement()
1650 if ((!ctxt->html) && in xmlSAX2StartElement()
1651 ((ctxt->myDoc->intSubset != NULL) || in xmlSAX2StartElement()
1652 (ctxt->myDoc->extSubset != NULL))) { in xmlSAX2StartElement()
1653 xmlCheckDefaultedAttributes(ctxt, name, prefix, atts); in xmlSAX2StartElement()
1663 if (!ctxt->html) { in xmlSAX2StartElement()
1667 xmlSAX2AttributeInternal(ctxt, att, value, prefix); in xmlSAX2StartElement()
1679 ns = xmlSearchNs(ctxt->myDoc, ret, prefix); in xmlSAX2StartElement()
1681 ns = xmlSearchNs(ctxt->myDoc, parent, prefix); in xmlSAX2StartElement()
1684 xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2StartElement()
1704 if (ctxt->html) { in xmlSAX2StartElement()
1706 xmlSAX2AttributeInternal(ctxt, att, value, NULL); in xmlSAX2StartElement()
1714 xmlSAX2AttributeInternal(ctxt, att, value, NULL); in xmlSAX2StartElement()
1730 if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { in xmlSAX2StartElement()
1733 chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElement()
1735 ctxt->valid = 0; in xmlSAX2StartElement()
1737 ctxt->wellFormed = 0; in xmlSAX2StartElement()
1738 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElement()
1739 ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1; in xmlSAX2StartElement()
1758 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EndElement() local
1763 cur = ctxt->node; in xmlSAX2EndElement()
1772 if (cur != NULL && ctxt->record_info) { in xmlSAX2EndElement()
1773 node_info.end_pos = ctxt->input->cur - ctxt->input->base; in xmlSAX2EndElement()
1774 node_info.end_line = ctxt->input->line; in xmlSAX2EndElement()
1776 xmlParserAddNodeInfo(ctxt, &node_info); in xmlSAX2EndElement()
1778 ctxt->nodemem = -1; in xmlSAX2EndElement()
1781 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2EndElement()
1782 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2EndElement()
1783 ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2EndElement()
1794 nodePop(ctxt); in xmlSAX2EndElement()
1809 xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { in xmlSAX2TextNode() argument
1816 if (ctxt->freeElems != NULL) { in xmlSAX2TextNode()
1817 ret = ctxt->freeElems; in xmlSAX2TextNode()
1818 ctxt->freeElems = ret->next; in xmlSAX2TextNode()
1819 ctxt->freeElemsNr--; in xmlSAX2TextNode()
1824 xmlErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2TextNode()
1832 if (ctxt->dictNames) { in xmlSAX2TextNode()
1836 (ctxt->options & XML_PARSE_COMPACT)) { in xmlSAX2TextNode()
1844 intern = xmlDictLookup(ctxt->dict, str, len); in xmlSAX2TextNode()
1852 intern = xmlDictLookup(ctxt->dict, str, len); in xmlSAX2TextNode()
1862 xmlSAX2ErrMemory(ctxt, "xmlSAX2TextNode"); in xmlSAX2TextNode()
1869 if (ctxt->input != NULL) in xmlSAX2TextNode()
1870 ret->line = ctxt->input->line; in xmlSAX2TextNode()
1889 xmlSAX2DecodeAttrEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, in xmlSAX2DecodeAttrEntities() argument
1900 ctxt->depth++; in xmlSAX2DecodeAttrEntities()
1901 ret = xmlStringLenDecodeEntities(ctxt, str, end - str, in xmlSAX2DecodeAttrEntities()
1903 ctxt->depth--; in xmlSAX2DecodeAttrEntities()
1923 xmlSAX2AttributeNs(xmlParserCtxtPtr ctxt, in xmlSAX2AttributeNs() argument
1937 namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, prefix); in xmlSAX2AttributeNs()
1942 if (ctxt->freeAttrs != NULL) { in xmlSAX2AttributeNs()
1943 ret = ctxt->freeAttrs; in xmlSAX2AttributeNs()
1944 ctxt->freeAttrs = ret->next; in xmlSAX2AttributeNs()
1945 ctxt->freeAttrsNr--; in xmlSAX2AttributeNs()
1949 ret->parent = ctxt->node; in xmlSAX2AttributeNs()
1950 ret->doc = ctxt->myDoc; in xmlSAX2AttributeNs()
1953 if (ctxt->dictNames) in xmlSAX2AttributeNs()
1959 if (ctxt->node->properties == NULL) { in xmlSAX2AttributeNs()
1960 ctxt->node->properties = ret; in xmlSAX2AttributeNs()
1962 xmlAttrPtr prev = ctxt->node->properties; in xmlSAX2AttributeNs()
1972 if (ctxt->dictNames) in xmlSAX2AttributeNs()
1973 ret = xmlNewNsPropEatName(ctxt->node, namespace, in xmlSAX2AttributeNs()
1976 ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL); in xmlSAX2AttributeNs()
1978 xmlErrMemory(ctxt, "xmlSAX2AttributeNs"); in xmlSAX2AttributeNs()
1983 if ((ctxt->replaceEntities == 0) && (!ctxt->html)) { in xmlSAX2AttributeNs()
1992 tmp = xmlSAX2TextNode(ctxt, value, valueend - value); in xmlSAX2AttributeNs()
2000 ret->children = xmlStringLenGetNodeList(ctxt->myDoc, value, in xmlSAX2AttributeNs()
2014 tmp = xmlSAX2TextNode(ctxt, value, valueend - value); in xmlSAX2AttributeNs()
2024 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && in xmlSAX2AttributeNs()
2025 ctxt->myDoc && ctxt->myDoc->intSubset) { in xmlSAX2AttributeNs()
2030 if (!ctxt->replaceEntities) { in xmlSAX2AttributeNs()
2031 dup = xmlSAX2DecodeAttrEntities(ctxt, value, valueend); in xmlSAX2AttributeNs()
2034 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2035 ctxt->myDoc, ctxt->node, ret, value); in xmlSAX2AttributeNs()
2044 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2045 ctxt->myDoc, ctxt->node, ret, dup); in xmlSAX2AttributeNs()
2055 if (ctxt->attsSpecial != NULL) { in xmlSAX2AttributeNs()
2062 ctxt->vctxt.valid = 1; in xmlSAX2AttributeNs()
2064 &ctxt->vctxt, ctxt->myDoc, in xmlSAX2AttributeNs()
2065 ctxt->node, fullname, dup); in xmlSAX2AttributeNs()
2066 if (ctxt->vctxt.valid != 1) in xmlSAX2AttributeNs()
2067 ctxt->valid = 0; in xmlSAX2AttributeNs()
2078 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2079 ctxt->myDoc, ctxt->node, ret, dup); in xmlSAX2AttributeNs()
2088 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, in xmlSAX2AttributeNs()
2089 ctxt->myDoc, ctxt->node, ret, dup); in xmlSAX2AttributeNs()
2093 if (((ctxt->loadsubset & XML_SKIP_IDS) == 0) && in xmlSAX2AttributeNs()
2094 (((ctxt->replaceEntities == 0) && (ctxt->external != 2)) || in xmlSAX2AttributeNs()
2095 ((ctxt->replaceEntities != 0) && (ctxt->inSubset == 0)))) { in xmlSAX2AttributeNs()
2100 if ((prefix == ctxt->str_xml) && in xmlSAX2AttributeNs()
2112 xmlErrValid(ctxt, XML_DTD_XMLID_VALUE, in xmlSAX2AttributeNs()
2117 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); in xmlSAX2AttributeNs()
2118 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) { in xmlSAX2AttributeNs()
2122 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); in xmlSAX2AttributeNs()
2123 } else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) { in xmlSAX2AttributeNs()
2126 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, dup, ret); in xmlSAX2AttributeNs()
2161 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2StartElementNs() local
2170 parent = ctxt->node; in xmlSAX2StartElementNs()
2174 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && in xmlSAX2StartElementNs()
2175 ((ctxt->myDoc->intSubset == NULL) || in xmlSAX2StartElementNs()
2176 ((ctxt->myDoc->intSubset->notations == NULL) && in xmlSAX2StartElementNs()
2177 (ctxt->myDoc->intSubset->elements == NULL) && in xmlSAX2StartElementNs()
2178 (ctxt->myDoc->intSubset->attributes == NULL) && in xmlSAX2StartElementNs()
2179 (ctxt->myDoc->intSubset->entities == NULL)))) { in xmlSAX2StartElementNs()
2180 xmlErrValid(ctxt, XML_ERR_NO_DTD, in xmlSAX2StartElementNs()
2182 ctxt->validate = 0; in xmlSAX2StartElementNs()
2189 if (ctxt->dictNames) { in xmlSAX2StartElementNs()
2192 fullname = xmlDictQLookup(ctxt->dict, prefix, localname); in xmlSAX2StartElementNs()
2202 if (ctxt->freeElems != NULL) { in xmlSAX2StartElementNs()
2203 ret = ctxt->freeElems; in xmlSAX2StartElementNs()
2204 ctxt->freeElems = ret->next; in xmlSAX2StartElementNs()
2205 ctxt->freeElemsNr--; in xmlSAX2StartElementNs()
2209 if (ctxt->dictNames) in xmlSAX2StartElementNs()
2217 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); in xmlSAX2StartElementNs()
2224 if (ctxt->dictNames) in xmlSAX2StartElementNs()
2225 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, in xmlSAX2StartElementNs()
2228 ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); in xmlSAX2StartElementNs()
2230 ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, in xmlSAX2StartElementNs()
2233 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); in xmlSAX2StartElementNs()
2237 if (ctxt->linenumbers) { in xmlSAX2StartElementNs()
2238 if (ctxt->input != NULL) { in xmlSAX2StartElementNs()
2239 if (ctxt->input->line < 65535) in xmlSAX2StartElementNs()
2240 ret->line = (short) ctxt->input->line; in xmlSAX2StartElementNs()
2246 if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { in xmlSAX2StartElementNs()
2247 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2StartElementNs()
2274 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && in xmlSAX2StartElementNs()
2275 ctxt->myDoc && ctxt->myDoc->intSubset) { in xmlSAX2StartElementNs()
2276 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, in xmlSAX2StartElementNs()
2281 ctxt->nodemem = -1; in xmlSAX2StartElementNs()
2286 nodePush(ctxt, ret); in xmlSAX2StartElementNs()
2303 ((ctxt->loadsubset & XML_COMPLETE_ATTRS) == 0)) in xmlSAX2StartElementNs()
2311 ret->ns = xmlSearchNs(ctxt->myDoc, parent, prefix); in xmlSAX2StartElementNs()
2313 ret->ns = xmlSearchNs(ctxt->myDoc, ret, prefix); in xmlSAX2StartElementNs()
2319 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); in xmlSAX2StartElementNs()
2323 xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2StartElementNs()
2327 xmlNsWarnMsg(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, in xmlSAX2StartElementNs()
2342 if (ctxt->dictNames) { in xmlSAX2StartElementNs()
2345 fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], in xmlSAX2StartElementNs()
2348 xmlSAX2AttributeNs(ctxt, fullname, NULL, in xmlSAX2StartElementNs()
2356 xmlSAX2AttributeNs(ctxt, lname, NULL, in xmlSAX2StartElementNs()
2363 xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], in xmlSAX2StartElementNs()
2373 if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { in xmlSAX2StartElementNs()
2376 chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElementNs()
2378 ctxt->valid = 0; in xmlSAX2StartElementNs()
2380 ctxt->wellFormed = 0; in xmlSAX2StartElementNs()
2381 ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); in xmlSAX2StartElementNs()
2382 ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1; in xmlSAX2StartElementNs()
2403 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2EndElementNs() local
2408 cur = ctxt->node; in xmlSAX2EndElementNs()
2410 if ((ctxt->record_info) && (cur != NULL)) { in xmlSAX2EndElementNs()
2411 node_info.end_pos = ctxt->input->cur - ctxt->input->base; in xmlSAX2EndElementNs()
2412 node_info.end_line = ctxt->input->line; in xmlSAX2EndElementNs()
2414 xmlParserAddNodeInfo(ctxt, &node_info); in xmlSAX2EndElementNs()
2416 ctxt->nodemem = -1; in xmlSAX2EndElementNs()
2419 if (ctxt->validate && ctxt->wellFormed && in xmlSAX2EndElementNs()
2420 ctxt->myDoc && ctxt->myDoc->intSubset) in xmlSAX2EndElementNs()
2421 ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, cur); in xmlSAX2EndElementNs()
2427 nodePop(ctxt); in xmlSAX2EndElementNs()
2440 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2Reference() local
2449 ret = xmlNewCharRef(ctxt->myDoc, name); in xmlSAX2Reference()
2451 ret = xmlNewReference(ctxt->myDoc, name); in xmlSAX2Reference()
2454 "add xmlSAX2Reference %s to %s \n", name, ctxt->node->name); in xmlSAX2Reference()
2456 if (xmlAddChild(ctxt->node, ret) == NULL) { in xmlSAX2Reference()
2472 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2Characters() local
2486 if (ctxt->node == NULL) { in xmlSAX2Characters()
2493 lastChild = ctxt->node->last; in xmlSAX2Characters()
2496 "add chars to %s \n", ctxt->node->name); in xmlSAX2Characters()
2504 lastChild = xmlSAX2TextNode(ctxt, ch, len); in xmlSAX2Characters()
2506 ctxt->node->children = lastChild; in xmlSAX2Characters()
2507 ctxt->node->last = lastChild; in xmlSAX2Characters()
2508 lastChild->parent = ctxt->node; in xmlSAX2Characters()
2509 lastChild->doc = ctxt->node->doc; in xmlSAX2Characters()
2510 ctxt->nodelen = len; in xmlSAX2Characters()
2511 ctxt->nodemem = len + 1; in xmlSAX2Characters()
2513 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2Characters()
2520 if ((coalesceText) && (ctxt->nodemem != 0)) { in xmlSAX2Characters()
2531 } else if ((ctxt->nodemem == ctxt->nodelen + 1) && in xmlSAX2Characters()
2532 (xmlDictOwns(ctxt->dict, lastChild->content))) { in xmlSAX2Characters()
2535 if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) && in xmlSAX2Characters()
2536 ((ctxt->options & XML_PARSE_HUGE) == 0)) { in xmlSAX2Characters()
2537 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node"); in xmlSAX2Characters()
2540 if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len || in xmlSAX2Characters()
2541 (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) { in xmlSAX2Characters()
2542 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented"); in xmlSAX2Characters()
2545 if (ctxt->nodelen + len >= ctxt->nodemem) { in xmlSAX2Characters()
2549 size = ctxt->nodemem + len; in xmlSAX2Characters()
2553 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2Characters()
2556 ctxt->nodemem = size; in xmlSAX2Characters()
2559 memcpy(&lastChild->content[ctxt->nodelen], ch, len); in xmlSAX2Characters()
2560 ctxt->nodelen += len; in xmlSAX2Characters()
2561 lastChild->content[ctxt->nodelen] = 0; in xmlSAX2Characters()
2564 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters"); in xmlSAX2Characters()
2566 if (ctxt->node->children != NULL) { in xmlSAX2Characters()
2567 ctxt->nodelen = xmlStrlen(lastChild->content); in xmlSAX2Characters()
2568 ctxt->nodemem = ctxt->nodelen + 1; in xmlSAX2Characters()
2572 lastChild = xmlSAX2TextNode(ctxt, ch, len); in xmlSAX2Characters()
2574 xmlAddChild(ctxt->node, lastChild); in xmlSAX2Characters()
2575 if (ctxt->node->children != NULL) { in xmlSAX2Characters()
2576 ctxt->nodelen = len; in xmlSAX2Characters()
2577 ctxt->nodemem = len + 1; in xmlSAX2Characters()
2615 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2ProcessingInstruction() local
2620 parent = ctxt->node; in xmlSAX2ProcessingInstruction()
2626 ret = xmlNewDocPI(ctxt->myDoc, target, data); in xmlSAX2ProcessingInstruction()
2629 if (ctxt->linenumbers) { in xmlSAX2ProcessingInstruction()
2630 if (ctxt->input != NULL) { in xmlSAX2ProcessingInstruction()
2631 if (ctxt->input->line < 65535) in xmlSAX2ProcessingInstruction()
2632 ret->line = (short) ctxt->input->line; in xmlSAX2ProcessingInstruction()
2637 if (ctxt->inSubset == 1) { in xmlSAX2ProcessingInstruction()
2638 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); in xmlSAX2ProcessingInstruction()
2640 } else if (ctxt->inSubset == 2) { in xmlSAX2ProcessingInstruction()
2641 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); in xmlSAX2ProcessingInstruction()
2644 if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { in xmlSAX2ProcessingInstruction()
2649 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2ProcessingInstruction()
2678 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2Comment() local
2683 parent = ctxt->node; in xmlSAX2Comment()
2687 ret = xmlNewDocComment(ctxt->myDoc, value); in xmlSAX2Comment()
2689 if (ctxt->linenumbers) { in xmlSAX2Comment()
2690 if (ctxt->input != NULL) { in xmlSAX2Comment()
2691 if (ctxt->input->line < 65535) in xmlSAX2Comment()
2692 ret->line = (short) ctxt->input->line; in xmlSAX2Comment()
2698 if (ctxt->inSubset == 1) { in xmlSAX2Comment()
2699 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); in xmlSAX2Comment()
2701 } else if (ctxt->inSubset == 2) { in xmlSAX2Comment()
2702 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); in xmlSAX2Comment()
2705 if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { in xmlSAX2Comment()
2710 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); in xmlSAX2Comment()
2740 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; in xmlSAX2CDataBlock() local
2748 lastChild = xmlGetLastChild(ctxt->node); in xmlSAX2CDataBlock()
2751 "add chars to %s \n", ctxt->node->name); in xmlSAX2CDataBlock()
2757 ret = xmlNewCDataBlock(ctxt->myDoc, value, len); in xmlSAX2CDataBlock()
2758 xmlAddChild(ctxt->node, ret); in xmlSAX2CDataBlock()