Hi,
I have xml structure as following;which I am manipulating for field validation before sending it further;
<Header>
<UserID/>
<Password/>
<CarrierID/>
<Poster/>
<ServiceType/>
<PostingDate/>
<ForecastFlag/>
</Header>
<Detail>
<FcastDate/>
<ForecastType/>
<SSC/>
<Format/>
<Sortation/>
<Machinability/>
<Quantity/>
<BagsTrays/>
<Cages/>
</Detail>
<Trailer>
<FTotal/>
<Rcount/>
</Trailer>
for each line item in the SSC field I am checking if it has any leading space or 0 (zero) so I created a user defined function.
My TrimZero function is as follows;
//write your code here
// String str = "00 15";
int len = ssc[0].length();
int i = 0;
for(;i<len;i++)
{
if(ssc[0].charAt(i) != '0' && ssc[0].charAt(i) != ' ')
break;
}
result.addValue(ssc[0].substring(i,len));
This function only works for 1st line item and does not work for rest of the detail lines. Eventually it end up without creating any tag(in this case SSC tag) in the target which fails further operations.
Also, if I remove this user def. func from the mapping source and target are mapped fine. I know the code is working because it works for the first line, but not for the rest of the line.
When I mapped the fields I made sure that their Parents are also mapped. Detail is also 0...Unbounded.
Can anyone please suggest what could be the issue.
-Sid