Saturday, March 24, 2012

Trouble using DataSet.ReadXml

I am trying to read this xml (which was retrieved from MS CRM through FetchXML)
<resultset>
<result>
<accountid>{06887906-F5C1-48D8-B48B-9FC28506F366}</accountid>
<name>Location Canada</name>
<address1_line1>123 Some Drive</address1_line1>
<address1_city>Labrador City</address1_city>
<address1_stateorprovince>NL</address1_stateorprovince>
<address1_postalcode>A2V 1K2</address1_postalcode>
<address1_country>CA</address1_country>
<telephone1>777-944-2647</telephone1>
<primarycontactid name =\"Smith, Bob\" dsc =\"0\">{C22CA08C-4C72-47DE-AA02-5A3042CDB362}</primarycontactid>
<CFSSHC05>123</CFSSHC05>
</result>
</resultset>
I can pull everything out of the dataset except <primarycontactid> .. it always comes up blank. So is it because of the tag attributes or whatever they are called ie "name = " or is it because of the "escape characters \ "
I just can't figure this one out. Here is the code I use to read the xml in

string strQueryResultXml = query.ExecuteQuery(userAuth, strQueryXML);

StringReader Matchrdr =new StringReader(strQueryResultXml);

MatchData.ReadXml(Matchrdr,XmlReadMode.Auto);

everything is fine except for that stupid tag with the extra info in it.
Please Help!!!
Thanks,
josh
I believe it is the tag. Can you strip out the backslashes and see what happens. This may be a bug with MS CRM.

0 comments:

Post a Comment