mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-28 00:21:53 +03:00
one more IsEmptyElement crazyness, that time in external parsed entities
* parser.c: one more IsEmptyElement crazyness, that time in external parsed entities if substitution is asked. * python/tests/reader3.py: added a specific test. Daniel
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
Fri Jan 10 00:16:49 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* parser.c: one more IsEmptyElement crazyness, that time in
|
||||
external parsed entities if substitution is asked.
|
||||
* python/tests/reader3.py: added a specific test.
|
||||
|
||||
Thu Jan 9 22:35:31 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* python/drv_libxml2.py: update from St<53>phane Bidoul: python 2.1
|
||||
|
3
parser.c
3
parser.c
@ -5599,10 +5599,13 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
|
||||
cur = ent->children;
|
||||
while (cur != NULL) {
|
||||
new = xmlCopyNode(cur, 1);
|
||||
if (new != NULL) {
|
||||
new->_private = cur->_private;
|
||||
if (firstChild == NULL){
|
||||
firstChild = new;
|
||||
}
|
||||
xmlAddChild(ctxt->node, new);
|
||||
}
|
||||
if (cur == ent->last)
|
||||
break;
|
||||
cur = cur->next;
|
||||
|
@ -104,6 +104,41 @@ if ret != 0:
|
||||
print "test_noent: Error detecting the end"
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# third test, crazy stuff about empty element in external parsed entities
|
||||
#
|
||||
s = """<!DOCTYPE struct [
|
||||
<!ENTITY simplestruct2.ent SYSTEM "simplestruct2.ent">
|
||||
]>
|
||||
<struct>&simplestruct2.ent;</struct>
|
||||
"""
|
||||
expect="""10 struct 0 0
|
||||
1 struct 0 0
|
||||
1 descr 1 1
|
||||
15 struct 0 0
|
||||
"""
|
||||
res=""
|
||||
simplestruct2_ent="""<descr/>"""
|
||||
|
||||
def myResolver(URL, ID, ctxt):
|
||||
if URL == "simplestruct2.ent":
|
||||
return(StringIO.StringIO(simplestruct2_ent))
|
||||
return None
|
||||
|
||||
libxml2.setEntityLoader(myResolver)
|
||||
|
||||
input = libxml2.inputBuffer(StringIO.StringIO(s))
|
||||
reader = input.newTextReader("test3")
|
||||
reader.SetParserProp(libxml2.PARSER_SUBST_ENTITIES,1)
|
||||
while reader.Read() == 1:
|
||||
res = res + "%s %s %d %d\n" % (reader.NodeType(),reader.Name(),
|
||||
reader.Depth(),reader.IsEmptyElement())
|
||||
|
||||
if res != expect:
|
||||
print "test3 failed: unexpected output"
|
||||
print res
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
|
Reference in New Issue
Block a user