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] file:serialize does not respect serialization settings #5261

Open
enury opened this issue Mar 27, 2024 · 0 comments
Open

[BUG] file:serialize does not respect serialization settings #5261

enury opened this issue Mar 27, 2024 · 0 comments
Labels
bug issue confirmed as bug

Comments

@enury
Copy link

enury commented Mar 27, 2024

Using file:serialize with the option omit-xml-declaration=no does not output the XML declaration <?xml version="1.0" encoding="UTF-8"?> in the serialized files.

However, using the function file:sync does output the declaration.

Example

xquery version "3.1";

import module namespace functx="http://www.functx.com/";
import module namespace file="http://exist-db.org/xquery/file";
import module namespace util="http://exist-db.org/xquery/util";

declare namespace tei = "http://www.tei-c.org/ns/1.0";

(: data :)
let $collection := collection("/db/apps/idp-data-hgv")

(: find files modified since x days :)
let $date := xs:date("2024-03-26")
let $time := xs:time("09:00:00")

for $file in xmldb:find-last-modified-since($collection//tei:TEI, dateTime($date, $time))

(: uri :)
let $uri := base-uri($file)

(: document :)
let $doc := doc($uri)

(: filename :)
let $filename := util:document-name($uri)

(: target path :)
let $targetdir := "C:\Users\nury\Desktop\serialize\"
let $targetpath := concat($targetdir, $filename)

(: parameters :)
let $params := map{
        "omit-xml-declaration":"no",
        "method":"xml"
    }

return 
    file:serialize($doc, $targetpath, $params)

Context

  • eXist Version: [6.2.0]
  • Java Version: [17.0.7]
  • OS: [Windows 10 10.0 amd64]
@line-o line-o added the bug issue confirmed as bug label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue confirmed as bug
Projects
None yet
Development

No branches or pull requests

2 participants