title: Reading XML document nodes containing special characters (&, -, etc) with Java
body: <p>My code does not retrieve the entirety of element nodes that contain special characters.
  For example, for this node:</p>
  
  <pre><code>&lt;theaterName&gt;P&amp;G Greenbelt&lt;/theaterName&gt;
  </code></pre>
  
  <p>It would only retrieve "P" due to the ampersand. I need to retrieve the entire string.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>public List&lt;String&gt; findTheaters() {
  
      //Clear theaters application global
      FilmhopperActivity.tData.clearTheaters();
  
      ArrayList&lt;String&gt; theaters = new ArrayList&lt;String&gt;();
  
      NodeList theaterNodes = doc.getElementsByTagName("theaterName");
  
      for (int i = 0; i &lt; theaterNodes.getLength(); i++) {
  
          Node node = theaterNodes.item(i);
          if (node.getNodeType() == Node.ELEMENT_NODE) {
  
              //Found theater, add to return array
              Element element = (Element) node;
              NodeList children = element.getChildNodes();
              String name = children.item(0).getNodeValue();
              theaters.add(name);
  
              //Logging
              android.util.Log.i("MoviefoneFetcher", "Theater found: " + name);
  
              //Add theater to application global
              Theater t = new Theater(name);
              FilmhopperActivity.tData.addTheater(t);
          }
      }
  
      return theaters;
  }
  </code></pre>
  
  <p>I tried adding code to extend the name string to concatenate additional children.items, but it didn't work. I'd only get "P&amp;".</p>
  
  <pre><code>...
  String name = children.item(0).getNodeValue();
  for (int j = 1; j &lt; children.getLength() - 1; j++) {
      name += children.item(j).getNodeValue();
  }
  </code></pre>
  
  <p>Thanks for your time.</p>
  
  <hr>
  
  <p>UPDATE:
  Found a function called normalize() that you can call on Nodes, that combines all text child nodes so doing a children.item(0) contains the text of all the children, including ampersands!</p>