|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] xQuery to generate multiple xml outputsDavid Lee dlee at calldei.comMon Feb 22 09:54:14 PST 2010
Another option is to pre-parse the document,
then pass it iteratively through to a query that produces one output each
pass passing in parameters. This does require an environment where its
efficient to reuse a parsed document.
An example in xmlsh would be like this
xread doc < file.xml
xquery -q customers.xquery -v Category A < {$doc} > CategoryA.xml
xquery -q customers.xquery -v Category B < {$doc} > CategoryB.xml
Java or .NET native examples should be fairly easy as well.
The key being the ability to prepares the document (if it is large) and
reuse it across multiple calls to Xquery. And if your really fancy,
pre-compile the xquery and reuse that.
----------------------------------------------------
David A. Lee
http://x-query.com/mailman/listinfo/talk
http://www.calldei.com
http://www.xmlsh.org
--------------------------------------------------
From: "Adam Retter" <http://x-query.com/mailman/listinfo/talk>
Sent: Monday, February 22, 2010 8:54 AM
To: "Julio de la Vega" <http://x-query.com/mailman/listinfo/talk>
Cc: <http://x-query.com/mailman/listinfo/talk>
Subject: Re: xQuery to generate multiple xml outputs
> Well using standard XQuery you could create one XML document as output
> that contains the two documents within, and later split them out.
>
> Otherwise depending on which XQuery engine you are using you could
> make use of platform provided XQuery extensions to write the documents
> out as nessecary. Which processor are you using?
>
> On 22 February 2010 13:39, Julio de la Vega
> <http://x-query.com/mailman/listinfo/talk> wrote:
>> Hi *,
>>
>>
>>
>>
>>
>> This is my first email, I am new ix xQuery so I would like to say “hi and
>> Thank you” to all the colleagues that are behind this email address:
>>
>>
>>
>> My first question is very simple:
>>
>>
>>
>> Imagine the next scenario:
>>
>>
>>
>> <Customer>
>>
>> <Category>A</Category>
>>
>> <Data>XXXX</Data>
>>
>> </Customer>
>>
>> <Customer>
>>
>> <Category>A</Category>
>>
>> <Data>XXXX</Data>
>>
>> </Customer>
>>
>> <Customer>
>>
>> <Category>B</Category>
>>
>> <Data>YYYYY/Data>
>>
>> </Customer>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> I need to create an xQuery that generates two different xml files. I am
>> reading an xml file and depending of the value of one specific node
>> (CATEGORY), I want to separate the information (CUSTOMERS) in multiple
>> xml
>> files.
>>
>> I need to generates the different outputs processing only one xQuery, I
>> do
>> not want to process several xQuerys because my input file is huge and
>> performance is important.
>>
>>
>>
>> Is there any option?
>>
>>
>>
>>
>>
>>
>>
>> Thank you
>>
>>
>>
>> Julio
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> http://x-query.com/mailman/listinfo/talk
>> http://x-query.com/mailman/listinfo/talk
>>
>
>
>
> --
> Adam Retter
>
> skype :adam.retter
> http://www.adamretter.org.uk
>
> _______________________________________________
> http://x-query.com/mailman/listinfo/talk
> http://x-query.com/mailman/listinfo/talk
>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








