File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
exist-core/src/main/java/org/exist/dom/persistent Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -1300,12 +1300,19 @@ public Text createTextNode(final String data) {
1300
1300
*/
1301
1301
@ Override
1302
1302
public Element getDocumentElement () {
1303
- final NodeList cl = getChildNodes ();
1304
- for (int i = 0 ; i < cl .getLength (); i ++) {
1305
- if (cl .item (i ).getNodeType () == Node .ELEMENT_NODE ) {
1306
- return (Element ) cl .item (i );
1303
+ try (final DBBroker broker = pool .getBroker ()) {
1304
+ final NodeProxy childNodeProxy = new NodeProxy (getExpression (), this , NodeId .DOCUMENT_NODE );
1305
+ for (int i = 0 ; i < children ; i ++) {
1306
+ childNodeProxy .setInternalAddress (childAddress [i ]);
1307
+ final Node child = broker .objectWith (childNodeProxy );
1308
+ if (child .getNodeType () == Node .ELEMENT_NODE ) {
1309
+ return (Element ) child ;
1310
+ }
1307
1311
}
1312
+ } catch (final EXistException e ) {
1313
+ LOG .warn ("Exception while retrieving document element: {}" , e .getMessage (), e );
1308
1314
}
1315
+
1309
1316
return null ;
1310
1317
}
1311
1318
You can’t perform that action at this time.
0 commit comments