mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-31 06:50:06 +03:00
SAX2: Don't merge CDATA sections
The Document Object Model (DOM) Level 3 Core Specification says: > Adjacent CDATASection nodes are not merged by use of the normalize > method of the Node interface. Fixes #412.
This commit is contained in:
parent
dde62ae5d5
commit
8ae06d5223
2
SAX2.c
2
SAX2.c
@ -2471,7 +2471,7 @@ xmlSAX2Text(xmlParserCtxtPtr ctxt, const xmlChar *ch, int len,
|
||||
} else {
|
||||
int coalesceText = (lastChild != NULL) &&
|
||||
(lastChild->type == type) &&
|
||||
((type != XML_TEXT_NODE) ||
|
||||
(((ctxt->html) && (type != XML_TEXT_NODE)) ||
|
||||
(lastChild->name == xmlStringText));
|
||||
if ((coalesceText) && (ctxt->nodemem != 0)) {
|
||||
int maxLength = (ctxt->options & XML_PARSE_HUGE) ?
|
||||
|
2
result/adjacent-cdata.xml
Normal file
2
result/adjacent-cdata.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc><![CDATA[abc]]><![CDATA[def]]><![CDATA[ghi]]></doc>
|
5
result/adjacent-cdata.xml.rde
Normal file
5
result/adjacent-cdata.xml.rde
Normal file
@ -0,0 +1,5 @@
|
||||
0 1 doc 0 0
|
||||
1 4 #cdata-section 0 1 abc
|
||||
1 4 #cdata-section 0 1 def
|
||||
1 4 #cdata-section 0 1 ghi
|
||||
0 15 doc 0 0
|
5
result/adjacent-cdata.xml.rdr
Normal file
5
result/adjacent-cdata.xml.rdr
Normal file
@ -0,0 +1,5 @@
|
||||
0 1 doc 0 0
|
||||
1 4 #cdata-section 0 1 abc
|
||||
1 4 #cdata-section 0 1 def
|
||||
1 4 #cdata-section 0 1 ghi
|
||||
0 15 doc 0 0
|
8
result/adjacent-cdata.xml.sax
Normal file
8
result/adjacent-cdata.xml.sax
Normal file
@ -0,0 +1,8 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.startElement(doc)
|
||||
SAX.pcdata(abc, 3)
|
||||
SAX.pcdata(def, 3)
|
||||
SAX.pcdata(ghi, 3)
|
||||
SAX.endElement(doc)
|
||||
SAX.endDocument()
|
8
result/adjacent-cdata.xml.sax2
Normal file
8
result/adjacent-cdata.xml.sax2
Normal file
@ -0,0 +1,8 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.startElementNs(doc, NULL, NULL, 0, 0, 0)
|
||||
SAX.pcdata(abc, 3)
|
||||
SAX.pcdata(def, 3)
|
||||
SAX.pcdata(ghi, 3)
|
||||
SAX.endElementNs(doc, NULL, NULL)
|
||||
SAX.endDocument()
|
2
result/noent/adjacent-cdata.xml
Normal file
2
result/noent/adjacent-cdata.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc><![CDATA[abc]]><![CDATA[def]]><![CDATA[ghi]]></doc>
|
8
result/noent/adjacent-cdata.xml.sax2
Normal file
8
result/noent/adjacent-cdata.xml.sax2
Normal file
@ -0,0 +1,8 @@
|
||||
SAX.setDocumentLocator()
|
||||
SAX.startDocument()
|
||||
SAX.startElementNs(doc, NULL, NULL, 0, 0, 0)
|
||||
SAX.pcdata(abc, 3)
|
||||
SAX.pcdata(def, 3)
|
||||
SAX.pcdata(ghi, 3)
|
||||
SAX.endElementNs(doc, NULL, NULL)
|
||||
SAX.endDocument()
|
1
test/adjacent-cdata.xml
Normal file
1
test/adjacent-cdata.xml
Normal file
@ -0,0 +1 @@
|
||||
<doc><![CDATA[abc]]><![CDATA[def]]><![CDATA[ghi]]></doc>
|
Loading…
x
Reference in New Issue
Block a user