version 1.49, 2000/02/21 09:33:35
|
version 1.50, 2000/02/21 18:49:25
|
Line 184 externalSubset(void *ctx, const xmlChar
|
Line 184 externalSubset(void *ctx, const xmlChar
|
int oldinputNr; |
int oldinputNr; |
int oldinputMax; |
int oldinputMax; |
xmlParserInputPtr *oldinputTab; |
xmlParserInputPtr *oldinputTab; |
|
int oldwellFormed; |
xmlParserInputPtr input = NULL; |
xmlParserInputPtr input = NULL; |
xmlCharEncoding enc; |
xmlCharEncoding enc; |
|
|
Line 197 externalSubset(void *ctx, const xmlChar
|
Line 198 externalSubset(void *ctx, const xmlChar
|
return; |
return; |
} |
} |
|
|
|
xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID); |
|
|
/* |
/* |
* make sure we won't destroy the main document context |
* make sure we won't destroy the main document context |
*/ |
*/ |
Line 204 externalSubset(void *ctx, const xmlChar
|
Line 207 externalSubset(void *ctx, const xmlChar
|
oldinputNr = ctxt->inputNr; |
oldinputNr = ctxt->inputNr; |
oldinputMax = ctxt->inputMax; |
oldinputMax = ctxt->inputMax; |
oldinputTab = ctxt->inputTab; |
oldinputTab = ctxt->inputTab; |
|
oldwellFormed = ctxt->wellFormed; |
|
|
ctxt->inputTab = (xmlParserInputPtr *) |
ctxt->inputTab = (xmlParserInputPtr *) |
xmlMalloc(5 * sizeof(xmlParserInputPtr)); |
xmlMalloc(5 * sizeof(xmlParserInputPtr)); |
Line 259 externalSubset(void *ctx, const xmlChar
|
Line 263 externalSubset(void *ctx, const xmlChar
|
ctxt->inputNr = oldinputNr; |
ctxt->inputNr = oldinputNr; |
ctxt->inputMax = oldinputMax; |
ctxt->inputMax = oldinputMax; |
ctxt->inputTab = oldinputTab; |
ctxt->inputTab = oldinputTab; |
|
ctxt->wellFormed = oldwellFormed; |
} |
} |
} |
} |
|
|
Line 357 entityDecl(void *ctx, const xmlChar *nam
|
Line 362 entityDecl(void *ctx, const xmlChar *nam
|
fprintf(stderr, "SAX.entityDecl(%s, %d, %s, %s, %s)\n", |
fprintf(stderr, "SAX.entityDecl(%s, %d, %s, %s, %s)\n", |
name, type, publicId, systemId, content); |
name, type, publicId, systemId, content); |
#endif |
#endif |
xmlAddDocEntity(ctxt->myDoc, name, type, publicId, systemId, content); |
if (ctxt->inSubset == 1) |
|
xmlAddDocEntity(ctxt->myDoc, name, type, publicId, systemId, content); |
|
else if (ctxt->inSubset == 2) |
|
xmlAddDtdEntity(ctxt->myDoc, name, type, publicId, systemId, content); |
|
else { |
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
|
ctxt->sax->error(ctxt, |
|
"SAX.entityDecl(%s) called while not in subset\n", name); |
|
} |
} |
} |
|
|
/** |
/** |
Line 385 attributeDecl(void *ctx, const xmlChar *
|
Line 398 attributeDecl(void *ctx, const xmlChar *
|
elem, fullname, type, def, defaultValue); |
elem, fullname, type, def, defaultValue); |
#endif |
#endif |
name = xmlSplitQName(ctxt, fullname, &prefix); |
name = xmlSplitQName(ctxt, fullname, &prefix); |
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem, |
if (ctxt->inSubset == 1) |
|
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem, |
name, prefix, type, def, defaultValue, tree); |
name, prefix, type, def, defaultValue, tree); |
|
else if (ctxt->inSubset == 2) |
|
attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem, |
|
name, prefix, type, def, defaultValue, tree); |
|
else { |
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
|
ctxt->sax->error(ctxt, |
|
"SAX.attributeDecl(%s) called while not in subset\n", name); |
|
return; |
|
} |
if (attr == 0) ctxt->valid = 0; |
if (attr == 0) ctxt->valid = 0; |
if (ctxt->validate && ctxt->wellFormed && |
if (ctxt->validate && ctxt->wellFormed && |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->myDoc && ctxt->myDoc->intSubset) |
Line 414 elementDecl(void *ctx, const xmlChar *na
|
Line 437 elementDecl(void *ctx, const xmlChar *na
|
xmlElementContentPtr content) |
xmlElementContentPtr content) |
{ |
{ |
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; |
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; |
xmlElementPtr elem; |
xmlElementPtr elem = NULL; |
|
|
#ifdef DEBUG_SAX |
#ifdef DEBUG_SAX |
fprintf(stderr, "SAX.elementDecl(%s, %d, ...)\n", |
fprintf(stderr, "SAX.elementDecl(%s, %d, ...)\n", |
fullname, type); |
fullname, type); |
#endif |
#endif |
|
|
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, |
if (ctxt->inSubset == 1) |
|
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, |
name, type, content); |
name, type, content); |
if (elem == 0) ctxt->valid = 0; |
else if (ctxt->inSubset == 2) |
|
elem = xmlAddElementDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, |
|
name, type, content); |
|
else { |
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
|
ctxt->sax->error(ctxt, |
|
"SAX.elementDecl(%s) called while not in subset\n", name); |
|
return; |
|
} |
|
if (elem == NULL) ctxt->valid = 0; |
if (ctxt->validate && ctxt->wellFormed && |
if (ctxt->validate && ctxt->wellFormed && |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->valid &= xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem); |
ctxt->valid &= xmlValidateElementDecl(&ctxt->vctxt, ctxt->myDoc, elem); |
Line 443 notationDecl(void *ctx, const xmlChar *n
|
Line 476 notationDecl(void *ctx, const xmlChar *n
|
const xmlChar *publicId, const xmlChar *systemId) |
const xmlChar *publicId, const xmlChar *systemId) |
{ |
{ |
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; |
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; |
xmlNotationPtr nota; |
xmlNotationPtr nota = NULL; |
|
|
#ifdef DEBUG_SAX |
#ifdef DEBUG_SAX |
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n", name, publicId, systemId); |
fprintf(stderr, "SAX.notationDecl(%s, %s, %s)\n", name, publicId, systemId); |
#endif |
#endif |
|
|
nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name, |
if (ctxt->inSubset == 1) |
|
nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name, |
|
publicId, systemId); |
|
else if (ctxt->inSubset == 2) |
|
nota = xmlAddNotationDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, name, |
publicId, systemId); |
publicId, systemId); |
if (nota == 0) ctxt->valid = 0; |
else { |
|
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) |
|
ctxt->sax->error(ctxt, |
|
"SAX.notationDecl(%s) called while not in subset\n", name); |
|
return; |
|
} |
|
if (nota == NULL) ctxt->valid = 0; |
if (ctxt->validate && ctxt->wellFormed && |
if (ctxt->validate && ctxt->wellFormed && |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc, |
ctxt->valid &= xmlValidateNotationDecl(&ctxt->vctxt, ctxt->myDoc, |
Line 628 attribute(void *ctx, const xmlChar *full
|
Line 671 attribute(void *ctx, const xmlChar *full
|
} |
} |
} |
} |
|
|
if (ctxt->validate && ctxt->wellFormed && |
if (!xmlStrcmp(fullname, BAD_CAST("xml:name"))) { |
|
/* !!! TODO xml:name validation */ |
|
} else if (!xmlStrcmp(fullname, BAD_CAST("xml:space"))) { |
|
/* !!! TODO xml:space validation */ |
|
} else if (ctxt->validate && ctxt->wellFormed && |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->myDoc && ctxt->myDoc->intSubset) |
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc, |
ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, ctxt->myDoc, |
ctxt->node, ret, value); |
ctxt->node, ret, value); |
Line 1127 comment(void *ctx, const xmlChar *value)
|
Line 1174 comment(void *ctx, const xmlChar *value)
|
ret = xmlNewDocComment(ctxt->myDoc, value); |
ret = xmlNewDocComment(ctxt->myDoc, value); |
if (ret == NULL) return; |
if (ret == NULL) return; |
|
|
if (ctxt->myDoc->children == NULL) { |
if (ctxt->inSubset == 1) |
|
parent = (xmlNodePtr) ctxt->myDoc->intSubset; |
|
else if (ctxt->inSubset == 2) |
|
parent = (xmlNodePtr) ctxt->myDoc->extSubset; |
|
else if (ctxt->myDoc->children == NULL) { |
#ifdef DEBUG_SAX_TREE |
#ifdef DEBUG_SAX_TREE |
fprintf(stderr, "Setting comment as root\n"); |
fprintf(stderr, "Setting comment as root\n"); |
#endif |
#endif |
Line 1136 comment(void *ctx, const xmlChar *value)
|
Line 1187 comment(void *ctx, const xmlChar *value)
|
parent = ctxt->myDoc->children; |
parent = ctxt->myDoc->children; |
} |
} |
if (parent != NULL) { |
if (parent != NULL) { |
if (parent->type == XML_ELEMENT_NODE) { |
if ((parent->type == XML_ELEMENT_NODE) || |
|
(parent->type == XML_DTD_NODE)) { |
#ifdef DEBUG_SAX_TREE |
#ifdef DEBUG_SAX_TREE |
fprintf(stderr, "adding comment child to %s\n", parent->name); |
fprintf(stderr, "adding comment child to %s\n", parent->name); |
#endif |
#endif |