title: How to decode a string from xml in android?
body: <p>In my xml, i have <code>&lt;ns5:Name&gt;mil &amp;amp; carbon&lt;/ns5:Name&gt;</code>
  From my java code i am retrieving that value by </p>
  
  <pre><code>public class MasterdataParser extends MasterdataBaseParser {
  
      protected MasterdataParser(InputStream response) {
          super(response);
      }
  
      public MasterData parse() {
  
          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setNamespaceAware(true);
          MasterData masterData;
  
          try {
  
              DocumentBuilder builder = factory.newDocumentBuilder();
              Document dom = builder.parse(this.getInputStream());
              Element root = dom.getDocumentElement();
  
              masterData = new MasterData();
  
              NodeList list;
              Element element;
              NodeList childNodeList;
              Node node;
              String nodeName; 
  
  
  list = root.getElementsByTagName(PREFIX+CATEGORY);
  
              for (int i=0;i&lt;list.getLength();i++){
  
                  element = (Element) list.item(i);
                  childNodeList = element.getChildNodes();
                  Category category = new Category();
  
                  for (int j = 0; j &lt; childNodeList.getLength(); j++) {
  
                      node = childNodeList.item(j);
                      nodeName = node.getNodeName();
  
                      if (nodeName.equalsIgnoreCase(PREFIX+CATEGORY_ID)) {
                          try{
                              category.setId(node.getFirstChild().getNodeValue());
                          } catch (NullPointerException ex) {
                              category.setId(null);
                          }
                      } 
       if (nodeName.equalsIgnoreCase(PREFIX+CATEGORY_NAME)) {
                              try{
      //                          System.out.println("Masterdataparser category name html "+Html.fromHtml(node.getFirstChild().getNodeValue()));   // Not worked
                                  System.out.println("URL Decoder "+URLDecoder.decode(node.getFirstChild().getNodeValue(), "UTF-8"));  // Not worked
                                  category.setName(node.getFirstChild().getNodeValue());
                              } catch (NullPointerException ex) {
                                  category.setName(null);
                              }
                          }
  }
  
  public abstract class MasterdataBaseParser implements MasterdataParserInterface {
              static final String CATEGORY = "Category";
          static final String CATEGORY_ID = "Id";
          static final String CATEGORY_NAME = "Name";
      final InputStream response;
  
          protected MasterdataBaseParser(InputStream response){
                  this.response = response;
          }
  
          protected InputStream getInputStream() {
              return response;
          }
      }
  </code></pre>
  
  <p>But it displays only <code>"mil"</code> and it is not taking <code>"&amp;amp;"</code> as <code>"&amp;"</code>. But i want to display <code>"mil &amp; carbon"</code>. How to do this one? Advance thanks for any help</p>