Note that there are some explanatory texts on larger screens.

plurals
  1. POJDOM Throwing Parse Exceptions with bad ascii characters
    text
    copied!<p>I'm using JDOM with my Android project, and every time I get a certain set of characters in my server response, I end up with these error messages:</p> <p>05-04 10:08:46.277: E/PARSE: org.jdom.input.JDOMParseException: Error on line 95 of document UTF-8: At line 95, column 5263: unclosed token</p> <p>05-04 10:08:46.277: E/Error Handler: Handler failed: org.jdom.input.JDOMParseException: Error on line 1: At line 1, column 0: syntax error</p> <p>When I make the same query through google chrome, I can see that all of the XML came through fine, and that there are in fact no areas where a token is not closed. I have run into this problem several times throughout the development of the application, and the solution has always been to remove odd ascii characters (copyright logos, or trademark characters, etc. that got copied/pasted into those data fields). How can I get it to either a remove those characters, or b strip them and continue the function. Here's an example of one of my parse functions.</p> <pre><code>public static boolean parseUserData(BufferedReader br) { SAXBuilder builder = new SAXBuilder(); Document document = null; try { document = builder.build(br); /* XML Output to Logcat */ if (document != null) { XMLOutputter outputter = new XMLOutputter( Format.getPrettyFormat()); String xmlString = outputter.outputString(document); Log.e("XML", xmlString); } Element rootNode = document.getRootElement(); if (!rootNode.getChildren().isEmpty()) { // Do stuff return true; } } catch (Exception e) { GlobalsUtil.errorUtil .setErrorMessage("Error Parsing XML: User Data"); Log.e(DEBUG_TAG, e.toString()); return false; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload