Cleankod
Cleankod

Reputation: 2340

XQuery - Output flat file

XML on the input, flat file on the output - is that possible using XQuery?

Upvotes: 2

Views: 1781

Answers (2)

Oliver Hallam
Oliver Hallam

Reputation: 4262

If you have a 3.0 processor then you can set your serialization mode to text mode.

declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "text";

See http://www.w3.org/TR/xquery-30/#id-serialization for how to configure serialization.

In text mode all the elements and attributes are stripped from your output, and only text content is written out.

Upvotes: 2

grtjn
grtjn

Reputation: 20414

XQuery has no specific constraints on its output. Depending on your parser, and its context, proper serialization might require some additional attention, like when you are running your XQuery through HTTP on an XML database.

Upvotes: 3

Related Questions