List deserialization problem with dashed names in xml

85 views
Skip to first unread message

attilah

unread,
Dec 1, 2011, 4:09:20 AM12/1/11
to RestSharp
Hi!

I'm writing a wrapper for BaseCamp API and ran into an issue.

The xml I'm getting back has this structure:

<todo-lists>
<todo-list>
</todo-list>
</todo-lists>

The problem is in HandleListDerivative since it does not try the
lowercased, "undashed" version for element names.

What I don't know is that what is the idea behind on operating on
Descendants when deserializing a list and not operating on children
nodes only?

Adding this code fixes this problem:

if (!elements.Any())
{
var lowerName =
name.ToLower().AsNamespaced(Namespace);
elements = root.Descendants().Where(e =>
e.Name.LocalName.RemoveUnderscoresAndDashes() == lowerName);
}

Thanks,
Attila

John Sheehan

unread,
Dec 2, 2011, 4:32:33 PM12/2/11
to rest...@googlegroups.com
Submit this as a pull request with an associated test and we'll look
at merging it in.

Zidad

unread,
Dec 15, 2011, 2:36:10 AM12/15/11
to RestSharp
I had the same problem, thanks for the fix!

Zidad

unread,
Jan 20, 2012, 8:25:40 AM1/20/12
to RestSharp
Hi John,

I submitted a pull request for a fix (but never did anything with git,
so I'm not sure if I did it all correct)
https://github.com/restsharp/RestSharp/pull/206

If it's incorrect, any pointers to do it right?

Thanks!

-W

John Sheehan

unread,
Jan 22, 2012, 1:18:35 PM1/22/12
to rest...@googlegroups.com
Hey there, thanks for the pull request. Can you add a test to go along
with it? Just commit it to the same fork or branch and it will show up
in the existing pull req, or you can close and create a new one.

Thanks!
John

Reply all
Reply to author
Forward
0 new messages