Skip to content

Commit e10cd85

Browse files
committed
[bugfix] Add missing support for CData Sections to the DOM Serializer
1 parent 1dd3982 commit e10cd85

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

exist-core/pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@
10181018
<include>src/test/java/org/exist/util/io/OverflowToDiskStreamTest.java</include>
10191019
<include>src/test/java/org/exist/util/pool/NodePoolTest.java</include>
10201020
<include>src/main/java/org/exist/util/serializer/AttrList.java</include>
1021+
<include>src/main/java/org/exist/util/serializer/DOMSerializer.java</include>
10211022
<include>src/main/java/org/exist/util/serializer/DOMStreamer.java</include>
10221023
<include>src/main/java/org/exist/util/serializer/EXISerializer.java</include>
10231024
<include>src/test/java/org/exist/util/serializer/HTML5WriterTest.java</include>
@@ -1650,6 +1651,7 @@
16501651
<exclude>src/test/java/org/exist/util/io/OverflowToDiskStreamTest.java</exclude>
16511652
<exclude>src/test/java/org/exist/util/pool/NodePoolTest.java</exclude>
16521653
<exclude>src/main/java/org/exist/util/serializer/AttrList.java</exclude>
1654+
<exclude>src/main/java/org/exist/util/serializer/DOMSerializer.java</exclude>
16531655
<exclude>src/main/java/org/exist/util/serializer/DOMStreamer.java</exclude>
16541656
<exclude>src/main/java/org/exist/util/serializer/EXISerializer.java</exclude>
16551657
<exclude>src/test/java/org/exist/util/serializer/HTML5WriterTest.java</exclude>

exist-core/src/main/java/org/exist/util/serializer/DOMSerializer.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
/*
2+
* Elemental
3+
* Copyright (C) 2024, Evolved Binary Ltd
4+
*
5+
6+
* https://www.evolvedbinary.com | https://www.elemental.xyz
7+
*
8+
* This library is free software; you can redistribute it and/or
9+
* modify it under the terms of the GNU Lesser General Public
10+
* License as published by the Free Software Foundation; version 2.1.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
* NOTE: Parts of this file contain code from 'The eXist-db Authors'.
22+
* The original license header is included below.
23+
*
24+
* =====================================================================
25+
*
226
* eXist-db Open Source Native XML Database
327
* Copyright (C) 2001 The eXist-db Authors
428
*
@@ -152,9 +176,12 @@ protected void startNode(Node node) throws TransformerException {
152176
}
153177
break;
154178
case Node.TEXT_NODE :
155-
case Node.CDATA_SECTION_NODE :
156179
receiver.characters(((CharacterData) node).getData());
157180
break;
181+
case Node.CDATA_SECTION_NODE :
182+
final char[] cdata = ((CharacterData) node).getData().toCharArray();
183+
receiver.cdataSection(cdata, 0, cdata.length);
184+
break;
158185
case Node.ATTRIBUTE_NODE :
159186
break;
160187
case Node.PROCESSING_INSTRUCTION_NODE :

0 commit comments

Comments
 (0)