hongruiqi / happs

Automatically exported from code.google.com/p/happs
0 stars 0 forks source link

Can rigid parsing ignore whitespace? #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Can rigid parsing ignore whitespace?

Original issue reported on code.google.com by shae.eri...@gmail.com on 16 Oct 2007 at 1:39

GoogleCodeExporter commented 8 years ago
Or can flexible parsing return Either Error ReturnType -- alex

Original comment by shae.eri...@gmail.com on 16 Oct 2007 at 1:48

GoogleCodeExporter commented 8 years ago

Original comment by shae.eri...@gmail.com on 16 Oct 2007 at 11:23

GoogleCodeExporter commented 8 years ago
Can you give an example please? I'm not sure which whitespace you want to 
ignore; the
XML parsing is done by HaXml isn't it?

Original comment by ig...@earth.li on 17 Oct 2007 at 12:09

GoogleCodeExporter commented 8 years ago
I've just fixed a bug in rigid parsing where having version or type attributes 
would
make it fail; does that solve your problems?

Sat Oct 20 21:11:36 BST 2007  Ian Lynagh <igloo@earth.li>
  * Fix a rigid XML bug
  When looking for type and version attributes, we need to remove them when
  we find them or we will think we have left over elements and fail when
  being rigid.

Original comment by ig...@vo.com on 20 Oct 2007 at 8:44

GoogleCodeExporter commented 8 years ago
There are two other bugs.  Facebook API calls e.g. 
http://developers.facebook.com/documentation.php?v=1.0&method=friends.areFriends

Can return either XML for the return type or <error>2</error> where the body is 
some 
error code specific to the API call.  Is there a way of getting a parse for 
that 
using rigid?

Original comment by alexande...@gmail.com on 20 Oct 2007 at 10:29

GoogleCodeExporter commented 8 years ago
Here is an example of a facebook error response:

"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<error_response xmlns=\"http://
api.facebook.com/1.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" 
xsi:schemaLocation=\"http://api.facebook.com/1.0/ http://api.facebook.com/1.0/
facebook.xsd\">\n  <error_code>104</error_code>\n  <error_msg>Incorrect 
signature</
error_msg>\n  <request_args list=\"true\">\n    <arg>\n      <key>api_key</
key>\n      <value>bebf4410940beb2adacd1cc1403a0e4a</value>\n    </arg>\n    
<arg>\n      <key>email</key>\n      
<value>%3C!DOCTYPE%20html%20PUBLIC%20%22-//W3C//
DTD%20HTML%204.01%20Transitional//EN%22%20%22http://www.w3.org/TR/html4/
loose.dtd%22%3E%0A%3Chtml%20xmlns:html=%22http://www.w3.org/TR/REC-
html40%22%20xmlns:atom=%22http://purl.org/atom/ns#%22%20xmlns:fb=%22http://
facebook.com/blah%22%3E%0A%20%20uid%20=%20%3Ch1%20align=%22center%22%3E%3C/
h1%3E%0A%3Cfb:dashboard%3E%3Cfb:action%20href=%22side-nav%22%3EHome%3C/
fb:action%3E%3Cfb:action%20href=%22listings%22%3EMy%20Listings%3C/
fb:action%3E%3Cfb:action%20href=%22offers%22%3EMy%20Offers%3C/
fb:action%3E%3Cfb:action%20href=%22friends%22%3EFriends%3C/
fb:action%3E%3Cfb:action%20href=%22networks%22%3EFree%20Market%3C/
fb:action%3E%3Cfb:action%20href=%22invite%22%3EInvite%3C/
fb:action%3E%3Cfb:help%20href=%22help%22%3EHelp%3C/fb:help%3E%3C/
fb:dashboard%3Ehelpreq%3C/html%3E%0A</value>\n    </arg>\n    <arg>\n      
<key>method</key>\n      <value>facebook.notifications.send</value>\n    
</arg>\n    
<arg>\n      <key>notification</key>\n      
<value>%3C!DOCTYPE%20html%20PUBLIC%20%22-
//W3C//DTD%20HTML%204.01%20Transitional//EN%22%20%22http://www.w3.org/TR/html4/
loose.dtd%22%3E%0A%3Chtml%20xmlns:html=%22http://www.w3.org/TR/REC-
html40%22%20xmlns:atom=%22http://purl.org/atom/ns#%22%20xmlns:fb=%22http://
facebook.com/blah%22%3E%0A%20%20uid%20=%20%3Ch1%20align=%22center%22%3E%3C/
h1%3E%0A%3Cfb:dashboard%3E%3Cfb:action%20href=%22side-nav%22%3EHome%3C/
fb:action%3E%3Cfb:action%20href=%22listings%22%3EMy%20Listings%3C/
fb:action%3E%3Cfb:action%20href=%22offers%22%3EMy%20Offers%3C/
fb:action%3E%3Cfb:action%20href=%22friends%22%3EFriends%3C/
fb:action%3E%3Cfb:action%20href=%22networks%22%3EFree%20Market%3C/
fb:action%3E%3Cfb:action%20href=%22invite%22%3EInvite%3C/
fb:action%3E%3Cfb:help%20href=%22help%22%3EHelp%3C/fb:help%3E%3C/
fb:dashboard%3Ehelpreq%3C/html%3E%0A</value>\n    </arg>\n    <arg>\n      
<key>session_key</key>\n      
<value>84e3e8e631cd757d9037932f-813145181</value>\n    
</arg>\n    <arg>\n      <key>to_ids</key>\n      <value>813145181</value>\n    
</
arg>\n    <arg>\n      <key>v</key>\n      <value>1.0</value>\n    </arg>\n    
<arg>\n      <key>sig</key>\n      <value>11a17b3f899844fe070646ae1e3886ba</
value>\n    </arg>\n  </request_args>\n</error_response>\n"

Original comment by alexande...@gmail.com on 21 Oct 2007 at 12:14

GoogleCodeExporter commented 8 years ago
Ah, so errors only happen at the top level? I think the best thing to do is, 
rather
than trying to parse something of type "a", flexibly parse something of type
    FaceBookResult a
where
    data FaceBookResult a = Error Error | Success a
    $( transparentXml ''FaceBookResult )
    data Error = Error_response ...

Original comment by ig...@vo.com on 21 Oct 2007 at 12:34

GoogleCodeExporter commented 8 years ago

Original comment by alexande...@gmail.com on 14 Jan 2008 at 8:56

GoogleCodeExporter commented 8 years ago
We think this is now done.

Original comment by ig...@vo.com on 23 Feb 2008 at 12:58