Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] fn:parse-xml, xmldb:store fail to parse string starting with BOM #5610

Open
line-o opened this issue Jan 16, 2025 · 0 comments
Open

[BUG] fn:parse-xml, xmldb:store fail to parse string starting with BOM #5610

line-o opened this issue Jan 16, 2025 · 0 comments
Labels
bug issue confirmed as bug needs XQSuite test XQSuite test required to reproduce xquery issue is related to xquery implementation

Comments

@line-o
Copy link
Member

line-o commented Jan 16, 2025

Describe the bug

Evaluating one of the below main modules will raise error FODC0006.

[...] not a well-formed XML document.: Document is not valid. Fatal (1,1) : Content is not allowed in prolog. [...]

Queries:

parse-xml("&#xFEFF;<root/>")
xmldb:store("/db", "test.xml", "&#xFEFF;<root/>")

Expected behavior

Both commands to work with or without BOM at the start of the string.
BaseX does ignore the BOM and this an issue was opened for Saxon too.

To Reproduce

xquery version "3.1";

module namespace t="http://exist-db.org/xquery/test";

declare namespace test="http://exist-db.org/xquery/xqsuite";

declare variable $t:string := "&#xFEFF;<root/>";

declare
    %test:tearDown
function t:tearDown() {
    xmldb:remove("/db/test.xml")
};

declare
    %test:assertTrue
function t:test-parse-bom() {
  exists(parse-xml($t:string))
};

declare
    %test:assertTrue
function t:test-store-bom() {
  exists(xmldb:store("/db", "test.xml", $t:string))
};

Context (please always complete the following information)

  • Build: eXist-6.3.0
  • Java: 1.8.0_352
  • OS: Mac OS X 15.2

Additional context

  • How is eXist-db installed? built from source
  • Any custom changes in e.g. conf.xml? none
@line-o line-o added needs XQSuite test XQSuite test required to reproduce xquery issue is related to xquery implementation bug issue confirmed as bug labels Jan 16, 2025
@line-o line-o changed the title [BUG] fn:parse-xml, xmldb:store choke on BOM header [BUG] fn:parse-xml, xmldb:store fail to parse string starting with BOM Jan 16, 2025
@line-o line-o added this to v7.0.0 Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug needs XQSuite test XQSuite test required to reproduce xquery issue is related to xquery implementation
Projects
Status: No status
Development

No branches or pull requests

1 participant