Page 1 of 1

xQUERY and CSV (text files)

Posted: Tue Mar 07, 2006 10:13 pm
by tCodex
I have searched and searched and tried Oxygen but to no avail.

I have not been able to just generate any text formats I want from an XML file: ie. CSV, txt, tabbed, etc...

? Is this possible to do with the parsers Oxygen supports

? if so why does the validating keep giving me errors regarding the lack of bracing tags?

? I don't want to waste anyones time - any pointers to tutorials for this kind of thing.

T.

Posted: Wed Mar 08, 2006 3:25 pm
by sorin_ristache
Hello,

It is possible with Saxon 8. The following query

Code: Select all

declare namespace saxon="http://saxon.sf.net/";
declare option saxon:output "method=text";

<persons>
{
for $person in /personnel/person
return ("&#10;", $person/name/family/text(), " , ", $person/name/given/text())
}
</persons>
applied to the file

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<personnel>
<person id="Big.Boss">
<name>
<family>Boss</family>
<given>Big</given>
</name>
<email>chief@oxygenxml.com</email>
<link subordinates="one.worker"/>
</person>
<person id="one.worker">
<name>
<family>Worker</family>
<given>One</given>
</name>
<email>one@oxygenxml.com</email>
<link manager="Big.Boss"/>
</person>
</personnel>
generates the output:

Code: Select all

<persons>
Boss , Big
Worker , One</persons>
The current version of <oXygen/> does not pass output options to the XQuery transformer yet. A future version will pass them. In this case the effect of

Code: Select all

declare option saxon:output "method=text"


should be that the tags <persons> and </persons> are not serialized in the output, so that the output should be:

Code: Select all


Boss ,  Big
Worker , One
Regards,
Sorin

Re: xQUERY and CSV (text files)

Posted: Fri Mar 10, 2006 6:27 pm
by sorin_ristache
Hello again,
tCodex wrote:? if so why does the validating keep giving me errors regarding the lack of bracing tags?
Probably the syntax of your XQuery document is not conformant to the XQuery specification. Can you post a small sample XQuery for which <oXygen/> reports validation errors and specify the XQuery validation engine set in the XQuery preferences (Saxon 8, eXist, Berkeley DB XML) ?

Regards,
Sorin