Read an xml having URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veenna
    New Member
    • Dec 2007
    • 65

    #1

    Read an xml having URL

    hi,

    How to parse an xml which is having and Url which contains '&' sign?
    I tried replacing it with & still has the same error.

    my code is
    Code:
              var msgs = from g in xDoc.Descendants().Descendants("msgs")
                               select new
                               {
                                   messageNum = g.Element("msg_number").Value,
                                   message = g.Element("message").Value,
                                   URL = g.Element("URL").Value,
                               };
                    foreach (var msg in msgs)
                    {
                        msgList.Add(new MsgClass(msg.messageNum, msg.message, msg.URL));
                    }

    Reagards
    Veena
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    if the URL is hardcoded in the XML, chances are the XML is invalid (unknown entity error). if you want to write an URL into the XML, make sure the & is masked as &

    Comment

    Working...