[xquery-talk] How can I optimize time in query
Kunal Chauhan
mail4ck at gmail.com
Wed Apr 6 18:07:06 PDT 2011
Hi All,
I wrote one XQuery it's work but taking time I want to optimize time taken
by that XQuery.
Here I explaine a brief scenario.
There are two diff xml files. I need to check first xml file's tag's
attributes value and check it into second file
If this value is same than I need to go forward for more process.
I used for loop for it but it takes time so how can I optimize time in this
case.
here is example
*First XML file*
<?xml version="1.0" encoding="US-ASCII"?>
<doc1>
<info id="1">
<fname>Kunal</fname>
<lname>chauhan</lname>
</info>
<info id="2">
<fname>Bhavik</fname>
<lname>Solanki</lname>
</info>
<info id="3">
<fname>Geet</fname>
<lname>Gangwar</lname>
</info>
</doc1>
*Second XML file*
<?xml version="1.0" encoding="US-ASCII"?>
<Doc2>
<empinfo id="1">
<name>Kunal</name>
<dept>tech</dept>
<roll>prog</roll>
</empinfo>
<empinfo id="2">
<name>Bhavik</name>
<dept>tech</dept>
<roll>prog</roll>
</empinfo>
<empinfo id="3">
<name>Geet</name>
<dept>tech</dept>
<roll>tl</roll>
</empinfo>
</Doc2>
*XQuery*
let $d1 := doc("D:/xbrl/NewDoc1.xml")
let $d2 := doc("D:/xbrl/NewDoc2.xml")
for $x in $d1,$y in $d2
check ($x/doc1/info/@id = $y/Doc2/empinfo/attribute::id) // check ids of
each node and if they are same than process forward
...
...
..
return $y/Doc2/empinfo/name
in this example I just return name but actualyy if ids are same than I need
to go forward and do some more process and after that return final result.
so is there any other way, other than for loop
Thanks & Regards,
*Kunal Chauhan*
mail4ck at gmail.com
[+918655517141]
[+919904983614]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20110406/5646f734/attachment.htm
More information about the talk
mailing list