IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Output-method text missing returns Options · View
msto1
Posted: Thursday, December 22, 2016 9:11:04 AM
Rank: Newbie

Joined: 12/22/2016
Posts: 3
Location: Netherlands
I'm currently evaluating replacing several open source options with Altova RaptorXML. The primary use case is performing huge XML transformations with specifically formed CSV as output.
The form of CSV is dictated by using "flat" XML elements - which is the output of my xquery. I expect this XML:

Code:
<lines>
<line>
<field1>A</field1>
<field2>B</field2>
<field3>C</field3>
</line>
<line>
<field1>D</field1>
<field2>E</field2>
<field3>F</field3>
</line>
</lines>


to be saved as CSV in this format:
Code:
A;B;C
D;E;F


It's currently being exported to CSV as:
Code:
ABCDEF


I'm currently using this commandline
Code:

RaptorXML
xquery
--input=file.xml
--output=out.csv
--output-method=text
--output-encoding=windows-1252
--omit-xml-declaration=true
--output-indent=false
query.xq


How do I set the separator and return types (CrLF)?




K101
Posted: Thursday, December 22, 2016 9:53:32 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 558
RaptorXML Server doesn't offer command-line arguments for settings CSV field or record separators. Your XQuery will do that manually using the string-join function (for the field separator) and concatenation with the codepoints-to-string function (for the record separator).

If you're having trouble with this, please contact Altova Support directly during your evaluation period with your example files and XQuery in a zip archive.

(Your RaptorXML command appears to be missing the 'xquery' command, and it's puzzling why you'd want --omit-xml-declaration=false for plain-text output.)
msto1
Posted: Thursday, December 22, 2016 10:19:53 AM
Rank: Newbie

Joined: 12/22/2016
Posts: 3
Location: Netherlands
Thanks K101.

The missing xquery command was due to lack of copy paste, and the omit-xml-declaration does indeed turn out to be useless and should be true. For future reference, I've modified the OP with the correct command.

I'm struggling a little bit with what the best approach would be. Previously I've used a solution where xquery was used to flatten/restructure the XML and XSLT was used to convert to CSV.
However, the largest file I need to process now is about 2.4GB, and every second in performance helps.

Oddly enough, both Zorba 3.0 and BaseX supported a form of CSV serialization, so I assumed RaptorXML had a similar feature set. Unfortunately, both BaseX and Zorba also have other issues when processing these large files.

I will investigate manually forming CSV in xquery versus adding an additional output step with xslt. Both seem feasible if not less than ideal.
K101
Posted: Thursday, December 22, 2016 11:51:33 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 558
For the size of data you're processing, you might be better off looking at our MapForce & MapForce Server products. MapForce will let you graphically map from your XML file to CSV output, and MapForce Server will execute the compiled mapping. That way, you don't need to bother with XQuery at all. See the attached example mapping file.

File Attachment(s):
2016-12-22, Output-method text missing returns.zip (3kb) downloaded 941 time(s).


msto1
Posted: Thursday, December 22, 2016 2:33:52 PM
Rank: Newbie

Joined: 12/22/2016
Posts: 3
Location: Netherlands
Thanks again K101, this is very helpful. I am hesitant to move to mapforce entirely, because it's a whole new philosophy, and we currently have a working xquery file, which is quite complex. Migrating an xquery file from zorba / basex to raptorxml is relatively simle. The syntax is only mildly different.

It's worth it to evaluate how easy/difficult it is to migrate from an xquery system to mapforce though, I will try this.
K101
Posted: Friday, December 23, 2016 9:14:58 AM
Rank: Advanced Member

Joined: 2/27/2009
Posts: 558
msto1 wrote:
It's worth it to evaluate how easy/difficult it is to migrate from an xquery system to mapforce though, I will try this.


It's also worthwhile to evaluate it from a performance perspective. In any event, good luck!
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.