Anurag Malani

Anurag Malani

  • NA
  • 80
  • 33.2k

The ':' character, hexadecimal value 0x3A, cannot be include

Dec 5 2013 2:31 AM
I have a problems after try execute: 1. System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name
Please some one help me

My code is:


    XDocument document = new XDocument(
            new XDeclaration("1.0", "utf-8", "yes"),
            new XElement("rss", new XAttribute(XNamespace.Xmlns + "media", "http://m.xyz.com/rss/"), new XAttribute("version", "2.0"),

                new XElement("channel",
                    new XAttribute("vendor", "ABC"),
                    new XAttribute("lastpublishdate", DateTime.Now.ToString("dd/MM/yyyy hh:mm"))),

                    new XElement("title", "Videos"),
                    new XElement("media:thumbnail", new XAttribute("width", x.width.ToString().Trim()), new XAttribute("height", x.height.ToString().Trim())),
        )
 );



My Expected O/P-

<rss xmlns:media="http://m.xyz.com/rss/" version="2.0">
<channel vendor="ABC" lastpublishdate="05/12/2013 01:02"/>
<title>Videos</title>
<media:thumbnail width="180" height="75" />
</rss>


Answers (1)