fix xmlEncode and concat sed command

1. fix '
Otherwise, you get
```xml
<?xml version="1.0"?>
<items>
  <item uid="uid'" arg="arg'" valid="valid" autocomplete="autocomplete">
    <title>title'</title>
    <subtitle>subtitle'</subtitle>
    <icon>icon.png'</icon>
  </item>
</items>
```

extra ' is added to each item

2. should add /g for sed 

3. faster to concatenate sed commands