mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +03:00
Bunch of new parser cleanup work:
- SAX.c tree.c debugXML.c: fixed bogus behaviour when an undeclared namespace prefix was used, added a warning. Cleaned up support w.r.t. entities, spilling out a warning and being pedantic on lookups. - test/warning/ent9 : added testcase for previous example. - TODO: updated - parserInternals.h parser.c: changed the way names are parsed now allow infinite size and decrease penalty for normal use - parser.c: Started a big cleanup/check of the parser code, fixed some of the most tortuous entity code, spotted code unused anymore - test/*: added tests for very long names and related nasty things. Daniel
This commit is contained in:
parent
f0cc7ccc7d
commit
e0854c3f83
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
||||
Sun Aug 27 22:14:01 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* SAX.c tree.c debugXML.c: fixed bogus behaviour when an
|
||||
undeclared namespace prefix was used, added a warning.
|
||||
Cleaned up support w.r.t. entities, spilling out a warning
|
||||
and being pedantic on lookups.
|
||||
* test/warning/ent9 : added testcase for previous example.
|
||||
* TODO: updated
|
||||
* parserInternals.h parser.c: changed the way names are parsed
|
||||
now allow infinite size and decrease penalty for normal use
|
||||
* parser.c: Started a big cleanup/check of the parser code,
|
||||
fixed some of the most tortuous entity code, spotted code
|
||||
unused anymore
|
||||
* test/*: added tests for very long names and related nasty
|
||||
things.
|
||||
|
||||
Sat Aug 26 23:31:04 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
|
||||
|
||||
* doc/encoding.html: added encoding aliases doc
|
||||
|
8
SAX.c
8
SAX.c
@ -955,6 +955,12 @@ startElement(void *ctx, const xmlChar *fullname, const xmlChar **atts)
|
||||
ns = xmlSearchNs(ctxt->myDoc, ret, prefix);
|
||||
if ((ns == NULL) && (parent != NULL))
|
||||
ns = xmlSearchNs(ctxt->myDoc, parent, prefix);
|
||||
if ((prefix != NULL) && (ns == NULL)) {
|
||||
ns = xmlNewNs(ret, NULL, prefix);
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
|
||||
ctxt->sax->warning(ctxt->userData,
|
||||
"Namespace prefix %s is not defined\n", prefix);
|
||||
}
|
||||
xmlSetNs(ret, ns);
|
||||
|
||||
/*
|
||||
@ -1121,7 +1127,7 @@ characters(void *ctx, const xmlChar *ch, int len)
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
if (xmlNodeIsText(lastChild)) {
|
||||
if ((xmlNodeIsText(lastChild)) && (ctxt->nodemem != 0)) {
|
||||
#ifndef XML_USE_BUFFER_CONTENT
|
||||
/*
|
||||
* The whole point of maintaining nodelen and nodemem,
|
||||
|
11
TODO
11
TODO
@ -6,9 +6,14 @@
|
||||
TODO:
|
||||
=====
|
||||
|
||||
- cleanup the mess with URI references when composing entities.
|
||||
- performances: there is still improvements needed when parsing Docbook DTD
|
||||
a single function to optimize/avoid.
|
||||
- Moving all deprecated functions to a different module, allow to compile
|
||||
it out.
|
||||
- DOM needs
|
||||
xmlAttrPtr xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value)
|
||||
int xmlPruneProp(xmlNodePtr node, xmlAtttrPtr attr);
|
||||
- listing all attributes in a node.
|
||||
- General checking of DTD validation in presence of namespaces ... hairy
|
||||
mostly done
|
||||
- Fix DTD + namespace validity problem
|
||||
@ -20,7 +25,7 @@ TODO:
|
||||
- Find way of representing PERefs in the Dtd so that %entity; can
|
||||
be saved back.
|
||||
- Go through erratas and do the cleanup.
|
||||
http://www.w3.org/XML/xml-19980210-errata ... bummmer
|
||||
http://www.w3.org/XML/xml-19980210-errata ... started ...
|
||||
- Handle undefined namespaces in entity contents better ... at least
|
||||
issue a warning
|
||||
- fix --disable-corba configure switch handling, and use XML_WITHOUT_CORBA
|
||||
@ -95,6 +100,8 @@ EXTENSIONS:
|
||||
Done:
|
||||
=====
|
||||
|
||||
- DOM needs
|
||||
xmlAttrPtr xmlNewDocProp(xmlDocPtr doc, const xmlChar *name, const xmlChar *value)
|
||||
- problem when parsing hrefs with & with the HTML parser (IRC ac)
|
||||
- If the internal encoding is not UTF8 saving to a given encoding doesn't
|
||||
work => fix to force UTF8 encoding ...
|
||||
|
23
debugXML.c
23
debugXML.c
@ -37,6 +37,10 @@
|
||||
|
||||
void xmlDebugDumpString(FILE *output, const xmlChar *str) {
|
||||
int i;
|
||||
if (str == NULL) {
|
||||
fprintf(output, "(NULL)");
|
||||
return;
|
||||
}
|
||||
for (i = 0;i < 40;i++)
|
||||
if (str[i] == 0) return;
|
||||
else if (IS_BLANK(str[i])) fputc(' ', output);
|
||||
@ -370,13 +374,20 @@ void xmlDebugDumpNamespace(FILE *output, xmlNsPtr ns, int depth) {
|
||||
fprintf(output, shift);
|
||||
if (ns->type == XML_GLOBAL_NAMESPACE)
|
||||
fprintf(output, "old ");
|
||||
if (ns->prefix != NULL)
|
||||
fprintf(output, "namespace %s href=", ns->prefix);
|
||||
else
|
||||
fprintf(output, "default namespace href=");
|
||||
if (ns->href == NULL) {
|
||||
if (ns->prefix != NULL)
|
||||
fprintf(output, "incomplete namespace %s href=NULL\n", ns->prefix);
|
||||
else
|
||||
fprintf(output, "incomplete default namespace href=NULL\n");
|
||||
} else {
|
||||
if (ns->prefix != NULL)
|
||||
fprintf(output, "namespace %s href=", ns->prefix);
|
||||
else
|
||||
fprintf(output, "default namespace href=");
|
||||
|
||||
xmlDebugDumpString(output, ns->href);
|
||||
fprintf(output, "\n");
|
||||
xmlDebugDumpString(output, ns->href);
|
||||
fprintf(output, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void xmlDebugDumpNamespaceList(FILE *output, xmlNsPtr ns, int depth) {
|
||||
|
@ -15,7 +15,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define XML_MAX_NAMELEN 1000
|
||||
#define XML_MAX_NAMELEN 100
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
|
@ -15,7 +15,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define XML_MAX_NAMELEN 1000
|
||||
#define XML_MAX_NAMELEN 100
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
|
6
result/bigentname.xml
Normal file
6
result/bigentname.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE doc [
|
||||
<!ENTITY very_big_entity_name01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_end_of_very_big_ent_name '"Yes"'>
|
||||
<!ENTITY WhatHeSaid "He said &very_big_entity_name01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_end_of_very_big_ent_name;">
|
||||
]>
|
||||
<doc>&WhatHeSaid;</doc>
|
2
result/bigname.xml
Normal file
2
result/bigname.xml
Normal file
File diff suppressed because one or more lines are too long
2
result/bigname2.xml
Normal file
2
result/bigname2.xml
Normal file
File diff suppressed because one or more lines are too long
6
result/noent/bigentname.xml
Normal file
6
result/noent/bigentname.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE doc [
|
||||
<!ENTITY very_big_entity_name01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_end_of_very_big_ent_name '"Yes"'>
|
||||
<!ENTITY WhatHeSaid "He said &very_big_entity_name01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_end_of_very_big_ent_name;">
|
||||
]>
|
||||
<doc>He said "Yes"</doc>
|
2
result/noent/bigname.xml
Normal file
2
result/noent/bigname.xml
Normal file
File diff suppressed because one or more lines are too long
2
result/noent/bigname2.xml
Normal file
2
result/noent/bigname2.xml
Normal file
File diff suppressed because one or more lines are too long
@ -3,4 +3,4 @@
|
||||
<!ENTITY YN '"Yes"'>
|
||||
<!ENTITY WhatHeSaid "He said &YN;">
|
||||
]>
|
||||
<doc>He said &YN;</doc>
|
||||
<doc>He said "Yes"</doc>
|
||||
|
2
result/noent/tstblanks.xml
Normal file
2
result/noent/tstblanks.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<a test="passed">content</a>
|
@ -7,5 +7,5 @@
|
||||
<test>
|
||||
<p>An ampersand (&) may be escaped
|
||||
numerically (&#38;) or with a general entity
|
||||
(&amp;amp;).</p>
|
||||
(&amp;).</p>
|
||||
</test>
|
||||
|
2
result/tstblanks.xml
Normal file
2
result/tstblanks.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<a test="passed">content</a>
|
5
test/bigentname.xml
Normal file
5
test/bigentname.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE doc [
|
||||
<!ENTITY very_big_entity_name01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_end_of_very_big_ent_name '"Yes"' >
|
||||
<!ENTITY WhatHeSaid "He said &very_big_entity_name01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_end_of_very_big_ent_name;" >
|
||||
]>
|
||||
<doc>&WhatHeSaid;</doc>
|
1
test/bigname.xml
Normal file
1
test/bigname.xml
Normal file
File diff suppressed because one or more lines are too long
1
test/bigname2.xml
Normal file
1
test/bigname2.xml
Normal file
File diff suppressed because one or more lines are too long
495
test/tstblanks.xml
Normal file
495
test/tstblanks.xml
Normal file
@ -0,0 +1,495 @@
|
||||
<?xml version="1.0"?>
|
||||
<a
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
test="passed">content</a>
|
7
test/warning/ent9
Normal file
7
test/warning/ent9
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE EXAMPLE SYSTEM "example.dtd" [
|
||||
<!ENTITY xml "<prefix:node>prefix is indeclared here</prefix:node>">
|
||||
]>
|
||||
<EXAMPLE xmlns:prefix="http://example.com">
|
||||
&xml;
|
||||
</EXAMPLE>
|
28
tree.c
28
tree.c
@ -129,19 +129,14 @@ xmlUpgradeOldNs(xmlDocPtr doc) {
|
||||
* Creation of a new Namespace. This function will refuse to create
|
||||
* a namespace with a similar prefix than an existing one present on this
|
||||
* node.
|
||||
* We use href==NULL in the case of an element creation where the namespace
|
||||
* was not defined.
|
||||
* Returns returns a new namespace pointer or NULL
|
||||
*/
|
||||
xmlNsPtr
|
||||
xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
|
||||
xmlNsPtr cur;
|
||||
|
||||
if (href == NULL) {
|
||||
#ifdef DEBUG_TREE
|
||||
fprintf(stderr, "xmlNewNs: href == NULL !\n");
|
||||
#endif
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a new Namespace and fill the fields.
|
||||
*/
|
||||
@ -1244,9 +1239,8 @@ xmlNewPI(const xmlChar *name, const xmlChar *content) {
|
||||
* @ns: namespace if any
|
||||
* @name: the node name
|
||||
*
|
||||
* Creation of a new node element. @ns and @content are optionnal (NULL).
|
||||
* If content is non NULL, a child list containing the TEXTs and
|
||||
* ENTITY_REFs node will be created.
|
||||
* Creation of a new node element. @ns is optionnal (NULL).
|
||||
*
|
||||
* Returns a pointer to the new node object.
|
||||
*/
|
||||
xmlNodePtr
|
||||
@ -3217,6 +3211,10 @@ xmlGetNsList(xmlDocPtr doc, xmlNodePtr node) {
|
||||
* recurse on the parents until it finds the defined namespace
|
||||
* or return NULL otherwise.
|
||||
* @nameSpace can be NULL, this is a search for the default namespace.
|
||||
* We don't allow to cross entities boundaries. If you don't declare
|
||||
* the namespace within those you will be in troubles !!! A warning
|
||||
* is generated to cover this case.
|
||||
*
|
||||
* Returns the namespace pointer or NULL.
|
||||
*/
|
||||
xmlNsPtr
|
||||
@ -3225,12 +3223,18 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
|
||||
|
||||
if (node == NULL) return(NULL);
|
||||
while (node != NULL) {
|
||||
if ((node->type == XML_ENTITY_REF_NODE) ||
|
||||
(node->type == XML_ENTITY_NODE) ||
|
||||
(node->type == XML_ENTITY_DECL))
|
||||
return(NULL);
|
||||
if (node->type == XML_ELEMENT_NODE) {
|
||||
cur = node->nsDef;
|
||||
while (cur != NULL) {
|
||||
if ((cur->prefix == NULL) && (nameSpace == NULL))
|
||||
if ((cur->prefix == NULL) && (nameSpace == NULL) &&
|
||||
(cur->href != NULL))
|
||||
return(cur);
|
||||
if ((cur->prefix != NULL) && (nameSpace != NULL) &&
|
||||
(cur->href != NULL) &&
|
||||
(!xmlStrcmp(cur->prefix, nameSpace)))
|
||||
return(cur);
|
||||
cur = cur->next;
|
||||
@ -4840,7 +4844,7 @@ xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) {
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (cur->type == XML_LOCAL_NAMESPACE) {
|
||||
if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) {
|
||||
/* Within the context of an element attributes */
|
||||
if (cur->prefix != NULL) {
|
||||
xmlOutputBufferWriteString(buf, " xmlns:");
|
||||
|
Loading…
x
Reference in New Issue
Block a user