To read text element (whose name is not fix) from document

Hi I want to read the text element from document, but the element which I want to read is not fixed. The document contains only single element which is string,is there any way I can access the first element of the document.

where Field can have different name.

Thanks in advance.

Hi Amit,

Did you try to create a flat file schema with recordWithNoID as the name for record definition?


How is your document/Field name is dynamically changing?Basically you should atleast know the field name then you can map it accordingly to a temp variable if it exits.May be you can try with queryXMLNode service and do XQL query for the document field index 0 ?


No .
I want to extract text element of the document , whose name is not fixed.
is there any way I can access like %doc/0th element% as I do have only 1 element in my document.


I believe you should know the %doc/fieldname% then map works (not with 0th element or undefined name),have you tried with queryXMLNode if you have node in the pipe?


You might want to use queryXMLNode with doc.?[0].text as the query(WQL).


Hi rmg,
Thanks for immediate reply.
Regarding %doc/fieldname% - here the fieldname is varying whose value comes against var1, so I can’t write the substitution like
%doc/%var1%% . Plz correct me if I am wrong.

I am trying to use the query XMLNode but not able to specify the query. I have mapped the document to nsDecls.After that I am not able to proceed. What will be the XQL query.
I tried with doc[0].text . Can you correct me & add points if I am missing.


Can you post the document data? As I mentioned earlier you could use “?” if you do not know the filed name.


query=/rootnode/source() XQL should work with type XQL.Also see service documentation for more info.

Make sure you have selected WQL not XQL.



You could use a Java service. Retrieve the ‘document’ IData from the pipeline, create an IDataCursor for it, call the method first() on the cursor to move it to the first element, then retrieve the value at that position.

This should do what you want.

  • Percio

Thanks RMG

Thanks a lot RMG , Pauly and Percio. I solved the problem.
Thanks guys for immediate respnse & providing different options.


your welcome,Glad to know it is working…