Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.io.IOException: ... is an in valid chunk size
    text
    copied!<p>I am using Restlet framework and create a web service to return XML using DomRepresentation. Here is the code:</p> <pre><code>public Representation toXml(Hashtale theHashtable) { try { DomRepresentation aDomRepresentation = new DomRepresentation( MediaType.APPLICATION_XML ); Document aDocument = aDomRepresentation.getDocument(); Element aElementRoot = aDocument.createElement("root"); aDocument.appendChild(aElementRoot); Element aElementProperties = aDocument.createElement("properties"); aElementRoot.appendChild(aElementProperties); // Add nodes to the element aDocument.normalizeDocument(); return aDomRepresentation; } catch (Exception aException) { return null; } } </code></pre> <p>I have also tried the TEXT_XML, APPLICATION_W3C_SCHEMA MediaType.</p> <p>On the client side of Restlet, I use the following piece of code to retrieve and parse the xml:</p> <pre><code> InputSource aInputSource = new InputSource(getResponseEntity().getStream()); XMLReader aXmlReader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); HtHandler ahtHandler = new HtHandler(); aXmlReader.setContentHandler(ahtHandler); aXmlReader.parse(aInputSource); return ahtHandler.getResult(); </code></pre> <p>HtHandler is a class that extends DefaultHandler.</p> <p>Each time, I got this error message:</p> <pre><code>java.io.IOException: &lt;encoding="UTF-8" standalone="no"?&gt;&lt;root&gt;&lt;properties&gt;&lt;workflow_id&gt;0&lt;/workflow_id&gt;&lt;name&gt;name&lt;/name&gt;&lt;id&gt;1&lt;/id&gt;&lt;/properties&gt;&lt;/root&gt;&gt; is an invalid chunk size at org.restlet.engine.http.io.ChunkedInputStream.readChunkSize(ChunkedInputStream.java:232) at org.restlet.engine.http.io.ChunkedInputStream.initializeChunk(ChunkedInputStream.java:161) at org.restlet.engine.http.io.ChunkedInputStream.canRead(ChunkedInputStream.java:97) at org.restlet.engine.http.io.ChunkedInputStream.read(ChunkedInputStream.java:182) </code></pre> <p>I have checked, most of the XMLs are parsed correctly. I don't know why, there is always one XML that is not parsed correctly, this XML has one more ">" at the end.</p> <p>Any ideas would be very helpful!</p> <p>Thanks in advance! Ikeforward</p>
 

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