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 @@ -1389,12 +1389,19 @@ public Text createTextNode(final String data) {
1389
1389
*/
1390
1390
@ Override
1391
1391
public Element getDocumentElement () {
1392
- final NodeList cl = getChildNodes ();
1393
- for (int i = 0 ; i < cl .getLength (); i ++) {
1394
- if (cl .item (i ).getNodeType () == Node .ELEMENT_NODE ) {
1395
- return (Element ) cl .item (i );
1392
+ try (final DBBroker broker = pool .getBroker ()) {
1393
+ final NodeProxy childNodeProxy = new NodeProxy (getExpression (), this , NodeId .DOCUMENT_NODE );
1394
+ for (int i = 0 ; i < children ; i ++) {
1395
+ childNodeProxy .setInternalAddress (childAddress [i ]);
1396
+ final Node child = broker .objectWith (childNodeProxy );
1397
+ if (child .getNodeType () == Node .ELEMENT_NODE ) {
1398
+ return (Element ) child ;
1399
+ }
1396
1400
}
1401
+ } catch (final EXistException e ) {
1402
+ LOG .warn ("Exception while retrieving document element: {}" , e .getMessage (), e );
1397
1403
}
1404
+
1398
1405
return null ;
1399
1406
}
1400
1407
You can’t perform that action at this time.
0 commit comments