0

I try to get the data from the XML and import into CSV

I am using Eclipse

I want to get the element in my <editor> and <author>

for example

<author>Jochen D&ouml;rre</author>  

was return as örre in my csv

What is wrong? I already try to use String strEscapeHTML = StringEscapeUtils.escapeHtml4(temp);

OutputStreamWriter oswAuthor =
 new OutputStreamWriter(fosAuthor,Charset.forName("ISO-8859-1"));

Below is the code I use for endElement, it get character only after the HTML string

what is wrong? How should I change it?

public void endElement(String nameSpaceURI, String localName, String qName) {
    System.out.println("</" + qName + ">");
    /*
    if(qName.equals("author") || qName.equals("editor")) {
        //fosAuthor.println(authorID + "," + );
    }*/
    if(eName.equals("author") || eName.equals("editor")) {
        //byte[] b = temp.getBytes(Charset.forName("UTF-8"));
        String strEscapeHTML = StringEscapeUtils.escapeHtml4(temp);
        String strUnEscapeHTML = StringEscapeUtils.unescapeHtml4(strEscapeHTML);

        pwAuthor.println(authorID + "," + strUnEscapeHTML);

        //fosAuthor.write(authorID + "," + temp + "\n");
        authorID++;
    }
}
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
user2399158
  • 561
  • 3
  • 10
  • 26
  • 1
    It's not clear if you want the output to be `örre` or `örre`, so: What is your input, your expected output, your actual output? – Philipp Reichart Oct 08 '16 at 07:40
  • Please read [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – vanje Oct 08 '16 at 15:17

0 Answers0