logo
down
shadow

Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name


Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name

Content Index :

Error in Xml to List code. The ':' character, hexadecimal value 0x3A, cannot be included in a name
Tag : chash , By : user123585
Date : November 28 2020, 08:01 AM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

The ':' character, hexadecimal value 0x3A, cannot be included in a name


Tag : chash , By : Tetting
Date : March 29 2020, 07:55 AM
will be helpful for those in need I have an xml file that contains its element like , If you want to use namespaces, LINQ to XML makes that really easy:
XNamespace ab = "http://whatever-the-url-is";
XElement tempElement = doc.Descendants(ab + "test").FirstOrDefault();

The ':' character, hexadecimal value 0x3A, cannot be included in a Attribute name


Tag : development , By : pacorro2000
Date : March 29 2020, 07:55 AM
may help you . You should use provided support of namespaces in LINQ to XML. Look for XNamespace class.

The ':' character, hexadecimal value 0x3A, cannot be included in a name


Tag : development , By : Jµ.
Date : March 29 2020, 07:55 AM
This might help you I saw this question already, but I didnt see an answer.. , The following code
    static void Main(string[] args)
    {

            var XMLFeed = XDocument.Parse(
@"<rss>    
<channel>

....items....

<item>
<title>Pentagon confirms plan to create new spy agency</title>
<link>http://feeds.foxnews.com/~r/foxnews/most-popular/~3/lVUZwCdjVsc/</link>
<category>politics</category>
<dc:creator xmlns:dc='http://purl.org/dc/elements/1.1/' />
<pubDate>Tue, 24 Apr 2012 12:44:51 PDT</pubDate>
<guid isPermaLink='false'>http://www.foxnews.com/politics/2012/04/24/pentagon-confirms-plan-to-create-new-spy-agency/</guid>
<content:encoded xmlns:content='http://purl.org/rss/1.0/modules/content/'><![CDATA[|http://global.fncstatic.com/static/managed/img/Politics/panetta_hearing_030712.jpg<img src='http://feeds.feedburner.com/~r/foxnews/most-popular/~4/lVUZwCdjVsc' height='1' width='1'/>]]></content:encoded>
<description>The Pentagon confirmed Tuesday that it is carving out a brand new spy agency expected to include several hundred officers focused on intelligence gathering around the world.&amp;amp;#160;</description>
<dc:date xmlns:dc='http://purl.org/dc/elements/1.1/'>2012-04-4T19:44:51Z</dc:date>
<!-- <feedburner:origLink>http://www.foxnews.com/politics/2012/04/24/pentagon-confirms-plan-to-create-new-spy-agency/</feedburner:origLink> -->
</item>

....items....

</channel>
</rss>");
            XNamespace contentNs = "http://purl.org/rss/1.0/modules/content/";
            var feeds = from feed in XMLFeed.Descendants("item")
                        select new
                                   {
                                       Title = (string)feed.Element("title"),
                                       Link = (string)feed.Element("link"),
                                       pubDate = (string)feed.Element("pubDate"),
                                       Description = (string)feed.Element("description"),
                                       MediaContent = GetMediaContent((string)feed.Element(contentNs + "encoded"))
                                   };
            foreach(var item in feeds)
            {
                Console.WriteLine(item);
            }
        }

        private static string GetMediaContent(string content)
        {
            int imgStartPos = content.IndexOf("<img");
            if(imgStartPos > 0)
            {
                int startPos = content[0] == '|' ? 1 : 0;

                return content.Substring(startPos, imgStartPos - startPos);
            }

            return string.Empty;
        }
{ Title = Pentagon confirms plan to create new spy agency, Link = http://feeds.f
oxnews.com/~r/foxnews/most-popular/~3/lVUZwCdjVsc/, pubDate = Tue, 24 Apr 2012 1
2:44:51 PDT, Description = The Pentagon confirmed Tuesday that it is carving out
 a brand new spy agency expected to include several hundred officers focused on
intelligence gathering around the world.&#160;, MediaContent = http://global
.fncstatic.com/static/managed/img/Politics/panetta_hearing_030712.jpg }
Press any key to continue . . .
var mediaContentXml = XElement.Parse("<content>" + (string)item.MediaContent + "</content>");
Console.WriteLine((string)mediaContentXml.Element("img").Attribute("src"));    

XmlWriter The ':' character, hexadecimal value 0x3A, cannot be included in a name


Tag : chash , By : user185939
Date : March 29 2020, 07:55 AM
this will help You need to use the overload of WriteStartElement that takes two parameters:
writer.WriteStartElement("news", "http://www.google.com/schemas/sitemap-news/0.9");
//               Tag   ----^       ^--- Namespace

Error in RestSharp Request? , XML , The ':' character, hexadecimal value 0x3A, cannot be included in a name


Tag : chash , By : msg
Date : March 29 2020, 07:55 AM
Does that help Please try with this corrected XML and let me know if that works for you.
Couple of points to note:
string xmlBody = "<soap:Envelope" +
                 " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
                 " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
                 " xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\">" +
                 "<soap:Body> " +
                     "<MainField " +
                          "xmlns=\"http://www.w3.org/2003/05/soap-envelope\" > " +
                          "<Username>string</Username> " +
                          "<Password>string</Password> " +
                          "<FieldPlace> " +
                              "<Value1>string</Value1> " +
                              "<Value2>string</Value2> " +
                          "</FieldPlace> " +
                     "</MainField> " +
                 "</soap:Body> " +
              "</soap:Envelope>";
Related Posts Related QUESTIONS :
  • Is it better to create Model classes or stick with generic database utility class?
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • Queryfilter on ApplicationUser in OnModelCreating in ApplicationDbContext creates StackOverflowException
  • How to get record form a different table based on a value from first table with linq expression?
  • Show data in Grid from returned model
  • Using Attributes to Override Data Model Conventions
  • Basic OOP console calculator, result Error
  • Compositon and Repository pattern
  • Multiple using statements with if condition
  • How do i increase a number by 1 in every line that contain the number 1
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • C# GetProcessesByName: issue with colon
  • c# wpf | create complex object with user-defined name to Serialize into JSON
  • How can I get a instance of a generic list with reflection?
  • WPF XAML - Design time and visibility of textbox
  • EF Core and MySql query is too slow
  • Getting Registered App Display Name from an App Id
  • How to get all variables from a string
  • Delete entity with all childs connected
  • Azure Build agent cant´t find class library referance
  • Initialize Nested Dictionaries in c#
  • .Net Core Binding
  • Generic event test method, preventing code duplication
  • How do I keep the ellipses in the center when the screen is resized
  • How to require a property using JsonSchema.NET?
  • C# XDocument Element/Elements returns null
  • Autofac keyed service with IEnumerable relationship type
  • Installing EntityFramework via NuGet manager
  • Always Check if there is Internet Connection Xamarin forms
  • WCF OneWay service slows down when aspNetCompatibilityEnabled is set to false
  • Can we use JsonRequestBehavior.AllowGet with [HttpPost] attribute?
  • How to customize the Setup wizard with custom forms in Visual Studio setup project
  • C# ASP.NET - Use method from another class to create labels
  • C# List IList or IEnumerable as argument
  • Parsing File with C# And Replace method
  • Losing special unicode characters in encryption (C#)
  • Getting stored procedure returned value instead of row affected
  • How can I construct HTML using NameValuePair in android?
  • Loading a pop up page in ASP.net through a js file
  • How to pass alert or notification message from controller to View?
  • C# to pause, turn on ssas server, backup cube.... how to?
  • How to execute DataTable.Select() for a column of custom class type for a particular element in that C#
  • how to connect mysql8.0 with C#
  • Passing incorrect values into MultiValueConverter by MultiBinding
  • Can i use IEnumerator as Update func?
  • How to convert API Json response to C# Array?
  • Blazor Textfield Oninput User Typing Delay
  • Performing both layout and render transform results in wrong output
  • uwp beforetextchanged cursor moving in front of text
  • How to keep duplicates from a string[] exclude words from a List and print them out
  • .Net Core Strings.Asc/Mid/Chr/Len missing even after importing Microsoft.VisualBasic
  • How to return to previous search page without being asked to Confirm Form Re-submission and keeping the results on ASP.N
  • How set a identity scaffolding item/page how initial page in asp.net MVC core?
  • LINQ isn't calling Dispose on my IEnumerator when using Union and Select, expected behavior or bug?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com