title: Quotes Issue when Reading from XML File in JAVA
body: <p>I'm trying to read from XML and store the data in a text file.
  My code works very well in reading and storing the data, EXCEPT when the paragraph from the XML file contains double quotes.</p>
  
  <p>For example:</p>
  
  <pre><code>    &lt;Agent&gt; "The famous spy" James Bond &lt;/Agent&gt;
  </code></pre>
  
  <p>The output will ignore any data with quotes, and the result would be: James Bond</p>
  
  <p>I'm using SAX, and here is part of my code that might have the issue:</p>
  
  <pre><code> public void characters(char[] ch, int start, int length) throws SAXException 
    { 
          tempVal = new String(ch, start, length); 
    }
  </code></pre>
  
  <p>I think I should replace the Quotes before storing the string in my tempVal.</p>
  
  <p>Any ideas???</p>
  
  <p><strong>HERE is the complete code just in case:</strong></p>
  
  <blockquote>
    <p>public class Entailment {</p>
  
  <pre><code>  private String Text;
  
    private String Hypothesis;
  
    private String ID;
  
    private String Entailment;
  </code></pre>
    
    <p>}</p>
  </blockquote>
  
  <pre><code>//Event Handlers
  public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
      //reset
      tempVal = "";
      if(qName.equalsIgnoreCase("pair")) {
          //create a new instance of Entailment
          tempEntailment = new Entailment();
          tempEntailment.setID(attributes.getValue("id"));
          tempEntailment.setEntailment(attributes.getValue("entailment"));
      }
  }
  
  public void characters(char[] ch, int start, int length) throws SAXException {
      tempVal = new String(ch, start, length);
  }
  
  public void endElement(String uri, String localName, String qName) throws SAXException {
      if(qName.equalsIgnoreCase("pair")) {
          //add it to the list
          Entailments.add(tempEntailment);
      }else if (qName.equalsIgnoreCase("t")) {
          tempEntailment.setText(tempVal);
      }else if (qName.equalsIgnoreCase("h")) {
          tempEntailment.setHypothesis(tempVal);
      }
  }
  
  public static void main(String[] args){
      XMLtoTXT spe = new XMLtoTXT();
      spe.runExample();
  }
  </code></pre>