Good afternoon coders.
For the below I have this same XML Snippet
<E1EDP19 SEGMENT="1">
<QUALF>001</QUALF>
<IDTNR>101-CB-PI</IDTNR>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>101-CB-PI</IDTNR>
<KTEXT>OXY MED 0,47KG PI/J44.9/0201/97062</KTEXT>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>003</QUALF>
<IDTNR>6005919004334</IDTNR>
</E1EDP19>
<E1EDP19 SEGMENT="1">
<QUALF>006</QUALF>
<IDTNR>MEDLRG</IDTNR>
</E1EDP19>
For every instance of QUALF being 002 I need to take KTEXT and split it by the /
I did this.
for (int i = 0; i < QUALF.length; ++i){
if (QUALF[i].equals("002")){
text = KTEXT[i];
String segments[] = text.split("/");
finalResult = segments[1];
result.addValue(finalResult);
}
}
However I would like access the 2nd element (segments[1]) in the first use of this code, ie. J44.9
In the 2nd use of this code I would need to access the 3rd element, ie. 0201
I get an arrayoutofbounds[1] exception currently. unless i alter the sample by making the
<E1EDP19 SEGMENT="1">
<QUALF>002</QUALF>
<IDTNR>101-CB-PI</IDTNR>
<KTEXT>OXY MED 0,47KG PI/J44.9/0201/97062</KTEXT>
</E1EDP19>
The 1st Instance.
No comments:
Post a Comment