xQUERY and CSV (text files)

Questions about XML that are not covered by the other forums should go here.
tCodex
Posts: 2
Joined: Thu Jul 14, 2005 11:10 pm

xQUERY and CSV (text files)

Post 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.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post 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
Last edited by sorin_ristache on Mon Mar 13, 2006 11:42 am, edited 1 time in total.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: xQUERY and CSV (text files)

Post 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
Post Reply