I have address data in Netsuite that looks like the following, note that in contains a "<" and ">" then sign along with other characters that need to be escaped to be valid characters in an XML document.
12 ENTERPRISE RD UNIT 3 & 4 < 5 > "6" '7'

In javascript (netsuites version of javascript) I have tried the following "FOR" loop, the data ends up with the < and > converted into & lt ; and & gt ; (as seen below without the spaces)
12 ENTERPRISE RD UNIT 3 & 4 & lt ; 5 & gt ; "6" '7'

```
var EscapedField = '';
for (var pos = 0; pos < FieldToEscape.length; pos++) 
    {             
        switch (FieldToEscape.charAt(pos)) 
        {
        // escape "less than"   
        case "<":
            EscapedField = EscapedField + '&lt;'
            break;
        // escape "greater than" 
        case ">":
            EscapedField = EscapedField + '&gt;' 
            break;
        default:
            EscapedField = EscapedField + FieldToEscape.charAt(pos)
            break;
       }
    } 

```

---

Per a suggestion by egrubaugh360 I tried the following in "Netsuite" / Javascript , 

1) I have a result set that contains a address that contains ( & , < , > , " , ') , (i.e ampersand, Less Than, Greater Than, Double Quote, Single Quote )

2) when you look at the values in the debugger they are valid 

3) After executing the NS function nlapiEscapeXML on the dataset the "<" and ">" are converted to & lt ; and & gt ; the actual escaped characters 

var ADDRLINE1 = nlapiEscapeXML(results[i].getValue('shipaddress1'));

$ results[i].getValue('shipaddress1')

> 
> 12 ENTERPRISE RD UNIT 3 & 4 < 5 > "6" '7'
> 
> 
> 

$ ADDRLINE1

> 
> 12 ENTERPRISE RD UNIT 3 & 4 & lt; 5 & gt; "6" '7'
> 
> 
> 

4) In NetSuite / javascript I have tried many permutations of escaping “<” and “>” but they all end up being converted to < and > 

I am going to try a string substitution for < and &gt within the ETL tool (Jitterbit) that is processing the file, that should work, but its hooky. 

5) thanks for the help