Reading xml from variable

I am using nav 2009 R2 US version

I have taken one text variable containing xml data

Strng := ‘Itm1’+'BLABLU ’ ;

I want to get ERPItemCode , So for that below code is used

IF ISCLEAR(xmldomDoc) THEN

CREATE(xmldomDoc);

xmldomDoc.loadXML(Xmltext);

strngg := ‘ERPItemCode’;

Strngvaraint := ‘ERPItemVariantCode’ ;

xmlNodeList1 := xmldomDoc.getElementsByTagName(strngg);

ii:=xmlNodeList1.length();

//MESSAGE(’%1’,xmlNodeList1.length());

FOR i:=0 TO xmlNodeList1.length()-1 DO BEGIN

xmldomElem1:= xmlNodeList1.item(i);

ItmNo[i+1] := xmldomElem1.text();

END;

MESSAGE(’%1’,ItmNo[i+1]);

Problem is that it is working fine when

Strng := ‘Itm1’ ;

but it is not working if

Strng := ‘Itm1’+'BLABLU ’ ;

i.e when something is prepend or appended to that variable