Subject:How to change the node name in xQuery Author:Fairy Lee Date:29 Jul 2008 12:29 PM Originally Posted: 29 Jul 2008 11:52 AM
I am using xQuery to convert a flat file to xml:
declare variable $InputParaData as document-node(element(*, xs:untyped)) external;
declare variable $flatFileName := $InputParaData/root/csvFileName/text();
<ROOT>
{
for $PRIMARY_ACCOUNT in doc(concat("adapter:CSV:first=yes:row=PRIMARY_ACCOUNT?file:///",$flatFileName))/table/row
return
<POLICY>
{$PRIMARY_ACCOUNT}
</POLICY>
}
</ROOT>
Based on the schema, <row> should be replaced by <PRIMARY_ACCOUNT>. I don't want to map each elemement one by one because the fields' names of flat data file are exactly same as the element names of the schema and there are a huge number of elements. I want to make the xQuery looks simple.
Could you please give me some advices about how to put <PRIMARY_ACCOUNT> in there to replace <row>?