Skip to content

Commit 5799a74

Browse files
committed
[bugfix] fn:parse-xml-fragment#1 should return a document-node() when there is an XML document that has a XML declaration
1 parent 863fe85 commit 5799a74

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exist-core/src/main/java/org/exist/xquery/functions/fn/ParsingFunctions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private Sequence parse(final String xmlContent, final Sequence[] args) throws XP
105105

106106
private ValidationReport validate(final String xmlContent, final SAXAdapter saxAdapter) throws XPathException {
107107
final String xml;
108-
if (isCalledAs("parse-xml-fragment")) {
108+
if (isCalledAs("parse-xml-fragment") && !xmlContent.toLowerCase().startsWith("<?xml ")) {
109109
xml = "<" + FRAGMENT_WRAPPER_NAME + ">" + xmlContent + "</" + FRAGMENT_WRAPPER_NAME + ">";
110110
} else {
111111
xml = xmlContent;

0 commit comments

Comments
 (0)