Skip to content

Commit 9c13df0

Browse files
committed
[bugfix] Reference nodes in the in-memory DOM (Memtree) should be transparent to the org.w3c.dom API
Closes eXist-db/exist#5682
1 parent cbe9911 commit 9c13df0

36 files changed

+2018
-518
lines changed

exist-core/pom.xml

Lines changed: 57 additions & 1 deletion
Large diffs are not rendered by default.

exist-core/src/main/java/org/exist/backup/SystemExport.java

Lines changed: 27 additions & 2 deletions
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
*
@@ -614,8 +638,9 @@ private void writeXML(final DocumentImpl doc, final Receiver receiver) {
614638
receiver.startPrefixMapping(reader.getNamespacePrefix(ni), reader.getNamespaceURI(ni));
615639
}
616640

617-
final AttrList attribs = new AttrList();
618-
for (int j = 0; j < reader.getAttributeCount(); j++) {
641+
final int attrCount = reader.getAttributeCount();
642+
final AttrList attribs = new AttrList(attrCount);
643+
for (int j = 0; j < attrCount; j++) {
619644
final QName qn = new QName(reader.getAttributeLocalName(j), reader.getAttributeNamespace(j), reader.getAttributePrefix(j));
620645
attribs.addAttribute(qn, reader.getAttributeValue(j));
621646
}

exist-core/src/main/java/org/exist/dom/memtree/DOMIndexer.java

Lines changed: 25 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
*
@@ -99,7 +123,7 @@ public DOMIndexer(final DBBroker broker, final Txn transaction, final DocumentIm
99123
*/
100124
public void scan() throws EXistException {
101125
//Creates a dummy DOCTYPE
102-
final DocumentTypeImpl dt = new DocumentTypeImpl((doc != null) ? doc.getExpression() : null, "temp", null, "");
126+
final org.exist.dom.persistent.DocumentTypeImpl dt = new org.exist.dom.persistent.DocumentTypeImpl((doc != null) ? doc.getExpression() : null, "temp", null, "");
103127
targetDoc.setDocumentType(dt);
104128
}
105129

0 commit comments

Comments
 (0)