I'm parsing an XHTML response with DomRepresentation, and it generates an
exception:


Exception in thread "main" java.lang.RuntimeException: java.io.IOException:
Server returned HTTP response code: 503 for URL:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd
        at
org.restlet.ext.xml.XmlRepresentation.internalEval(XmlRepresentation.java:556)
        at
org.restlet.ext.xml.XmlRepresentation.getNodes(XmlRepresentation.java:437)
        at es.isigma.portasigma.client.ClientExample.main(ClientExample.java:32)


This is due to the fact that restlet's DomRepresentation is attempting DTD
validation even if I explicitly disable it in my client code (
doc.setValidatingDtd(false) ):


    public static void main(String[] args) throws Exception {
        ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;
        ChallengeResponse authentication = new ChallengeResponse(scheme,
"user", "user");
        ClientResource r = new ClientResource(allDocs);
        Representation representation = r.get(authentication,
"http://localhost:8182/v1/users/user/docs/2/";, MediaType.TEXT_HTML);
        DomRepresentation doc = new DomRepresentation(representation);
        doc.setValidatingDtd(false);
        NodeList nodes = doc.getNodes("//d...@class]");
        for(Node node: nodes) {
           
System.out.println(node.getAttributes().getNamedItem("class").getTextContent()
+ ": " + node.getTextContent());
        }
        Node nodeDesc = doc.getNode("//d...@class='description']");
        System.out.println("Description = " + nodeDesc.getTextContent());
    }


Am I missing something or is this a bug? 
-- 
View this message in context: 
http://restlet-discuss.1400322.n2.nabble.com/Disable-DTD-validation-doesn-t-seem-to-work-DomRepresentation-tp5230305p5230305.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2626833

Reply via email to