Facebook.Utility.Utilities.DeserializeXML regex issue

Nov 30, 2009 at 5:39 AM
Edited Nov 30, 2009 at 5:39 AM

 

 

Utilities.cs 
Facebook.Utility.Utilities
public static T DeserializeXML<T>(string xmlInput)
This method has the following:
   // Without adding the xsi:nil="true" attribute, XmlSerializer is unable to deserialize an element like <notes_count/> into a System.Nullable<int>.
   // For example, significant_other_id in users.getInfo will cause this problem if the user has no significant other.
   xmlInput = Regex.Replace(xmlInput, @"(?<!xsi:nil=\""true\"")/\>", " xsi:nil=\"true\"/>");
This regex turns:
<proxied_email xsi:nil="true" xmlns="http://api.facebook.com/1.0/" />
into:
<proxied_email xsi:nil="true" xmlns="http://api.facebook.com/1.0/"  xsi:nil="true"/>
with the xsi:nil attribute now duplicated.
I'm not familiar with negative lookbehind regexs so I don't have an immediate alternative but wanted to point out the fact that what's there seems inadequate.
I'm working to get my Facebook Starter Kit updated and this prevents my simple example from working "out of the gate".
-Steve