Proper namespace handling

This fix prevents truncation of XML if multiple namespaces are nested.

The bug boils down to this original XML:
```xml
<outerTag xmlns:first="first">
   <innerTag>something</innerTag>
   <innerTag xmlns:second="second">
      <deepTag first:foo="bar" second:foo="bar"/>
   </innerTag>
   <innerTag>something else</innerTag>
</outerTag>
```

being encoded to binary XML, and then back to broken XML by apk-parser:
```xml
<outerTag xmlns:first="first">
   <innerTag>something</innerTag>
   <innerTag xmlns:second="second">
      <deepTag first:foo="bar" second:foo="bar"/>
   </innerTag>
```

The end of a namespace is treated as the end of the whole XML, which is only true in some common cases such as `AndroidManifest.xml`, but breaks on various apps' layout XMLs etc.

This patch fixes this problem. In addition, it fixes a problem with string localization in attributes.