Re: Response for a 405 can't be parsed by SAX
Thanks for the replies guys. I definitely don't need to parse it as XML, I'm using XMLUnit in my integration testing to compare the responses (my service returns XML entities). Also, our QA tell prefers to compare XML. So I wasn't pointing it out as a shortcoming by any means, just raising the discussion. - Original Message From: Stephan Koops stephan.ko...@web.de To: discuss@restlet.tigris.org Sent: Sunday, June 14, 2009 7:51:45 AM Subject: Re: Response for a 405 can't be parsed by SAX Hi Rhett, SAX can't parse it because it's HTML, not XML. (br alone is valid HTML.) You should be able to determine whether it is HTML or XML in your client by examining the content type header. Is restlet not setting that header correctly? If you want to provide XML-formatted error responses, I believe you'll have to implement them yourself. But it is a problem, if Restlet would return br/ instead od br ? Than it is also correct XML (and XHTML?) I wouldn't have a problem with that. At the same time, though, I don't see why you'd need to parse it as XML. The message is basically just translating from the error code into English. Since the error code is already part of the response, doesn't it make more sense to skip parsing the body if there's an error and the service you're talking to doesn't define special error bodies? After all, if the representation being requested were JSON (or PNG, or PDF, etc.), you'd get this same response body back with the error (by default). It's not Restlet's job to provide error bodies that are parseable as the same content type as a success would be. Rhett You are right. But XML parser will than have no problem with the content, also if it is not intended to be used by them. And it's very easy to implement. But we could leave it as it is. best regards Stephan -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361955 -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2362178
Re: Response for a 405 can't be parsed by SAX
Hi Rhett, SAX can't parse it because it's HTML, not XML. (br alone is valid HTML.) You should be able to determine whether it is HTML or XML in your client by examining the content type header. Is restlet not setting that header correctly? If you want to provide XML-formatted error responses, I believe you'll have to implement them yourself. But it is a problem, if Restlet would return br/ instead od br ? Than it is also correct XML (and XHTML?) I wouldn't have a problem with that. At the same time, though, I don't see why you'd need to parse it as XML. The message is basically just translating from the error code into English. Since the error code is already part of the response, doesn't it make more sense to skip parsing the body if there's an error and the service you're talking to doesn't define special error bodies? After all, if the representation being requested were JSON (or PNG, or PDF, etc.), you'd get this same response body back with the error (by default). It's not Restlet's job to provide error bodies that are parseable as the same content type as a success would be. Rhett You are right. But XML parser will than have no problem with the content, also if it is not intended to be used by them. And it's very easy to implement. But we could leave it as it is. best regards Stephan -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361955
Re: Response for a 405 can't be parsed by SAX
Hi Stephan, On Jun 13, 2009, at 3:45 PM, Stephan Koops wrote: Hi Rhett, Hello Everyone, I had a question about the 405 response message returned by Restlet 1.1.1. When I try a parse the XML response, I get the following: [Fatal Error] :8:3: The element type br must be terminated by the matching end-tag /br. The entire response: html head titleStatus page/title /head body h3The method specified in the request is not allowed for the resource identified by the request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6 here/a.br Please continue your visit at our a href=/home page/a. /p /body /html I'm sure I can edit the response before it gets out of my service, but I thought this might be something useful to bring up. Thanks for any insight. SAX can't parse it because it's HTML, not XML. (br alone is valid HTML.) You should be able to determine whether it is HTML or XML in your client by examining the content type header. Is restlet not setting that header correctly? If you want to provide XML-formatted error responses, I believe you'll have to implement them yourself. But it is a problem, if Restlet would return br/ instead od br ? Than it is also correct XML (and XHTML?) I wouldn't have a problem with that. At the same time, though, I don't see why you'd need to parse it as XML. The message is basically just translating from the error code into English. Since the error code is already part of the response, doesn't it make more sense to skip parsing the body if there's an error and the service you're talking to doesn't define special error bodies? After all, if the representation being requested were JSON (or PNG, or PDF, etc.), you'd get this same response body back with the error (by default). It's not Restlet's job to provide error bodies that are parseable as the same content type as a success would be. Rhett -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361892
Response for a 405 can't be parsed by SAX
Hello Everyone, I had a question about the 405 response message returned by Restlet 1.1.1. When I try a parse the XML response, I get the following: [Fatal Error] :8:3: The element type br must be terminated by the matching end-tag /br. The entire response: html head titleStatus page/title /head body h3The method specified in the request is not allowed for the resource identified by the request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6;here/a.br Please continue your visit at our a href=/home page/a. /p /body /html I'm sure I can edit the response before it gets out of my service, but I thought this might be something useful to bring up. Thanks for any insight. -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361642
Re: Response for a 405 can't be parsed by SAX
Hi John, On Jun 12, 2009, at 10:10 AM, John Prystash wrote: Hello Everyone, I had a question about the 405 response message returned by Restlet 1.1.1. When I try a parse the XML response, I get the following: [Fatal Error] :8:3: The element type br must be terminated by the matching end-tag /br. The entire response: html head titleStatus page/title /head body h3The method specified in the request is not allowed for the resource identified by the request URI/h3pYou can get technical details a href=http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.6 here/a.br Please continue your visit at our a href=/home page/a. /p /body /html I'm sure I can edit the response before it gets out of my service, but I thought this might be something useful to bring up. Thanks for any insight. SAX can't parse it because it's HTML, not XML. (br alone is valid HTML.) You should be able to determine whether it is HTML or XML in your client by examining the content type header. Is restlet not setting that header correctly? If you want to provide XML-formatted error responses, I believe you'll have to implement them yourself. Rhett -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2361683