Showing results for 
Search instead for 
Did you mean: 

Count lines of xml file

Former Member
0 Kudos


i have flat file -> idoc scenario and I want to use mapping/cr8 user-defined function to count ALL the lines of the xml file

I tried to use index function with remove context and split by value and it didnt help ( mayb i did it wrong )

if i use count function i have to use it on EACH line and add all

the flat file MT is



__________________H_Line (1)

__________________L_Line (unbounded)

__________________V_Line (unbounded)

any suggestions?



View Entire Topic
Former Member
0 Kudos


You can use user defined function. Handle the context. just return the length.



Former Member
0 Kudos

i didnt succced writing that function

can u try giving example ?

Active Contributor
0 Kudos

put the context to the parent node (maybe the MT itself), then use a UDF like

public void RecordCount(String[] a, .....)


tempCount = a.length;



for each node once you get the count pass them to a add function or create onto handle the add with the number of inputs (the count functions) and return the total number of count.