Questions tagged [xmlexception]
34 questions
12
votes
6 answers
XmlException in WCF deserialization: "Name cannot begin with '<'" - in automatic property backing fields
I have started experiencing errors in WCF deserialization today - in code which has been unchanged and working for months.
The issue is that I am getting runtime XmlExceptions saying 'Name cannot begin with the '<' character'. I have debugged into…

RJ Lohan
- 6,497
- 3
- 34
- 54
9
votes
3 answers
using C#'s XmlReader on slightly malformed XML
I'm trying to use C#'s XmlReader on a large series of XML files, they are all properly formatted except for a few select ones (unfortunately I'm not in a position to have them changed, because it would break a lot of other code).
The errors only…

Roy T.
- 9,429
- 2
- 48
- 70
8
votes
2 answers
XmlDocument.Load fails, LoadXml works:
In answering this question, I came across a situation that I don't understand. The OP was trying to load XML from the following location: http://www.google.com/ig/api?weather=12414&hl=it
The obvious solution is:
string m_strFilePath =…

spender
- 117,338
- 33
- 229
- 351
7
votes
3 answers
XmlException while deserializing xml file in UTF-16 encoding format
Using C#'s XmlSerializer.
In process of deserializing all xml files in a given folder, I see XmlException
"There is an error in XML document (0, 0)". and InnerException is "There is no Unicode byte order mark. Cannot switch to Unicode".
All the…

keeda
- 2,605
- 5
- 28
- 27
6
votes
1 answer
XmlReader ReadStartElement causes XmlException
I'm writing a file reader using the XmlReader in a Silverlight project. However, I'm getting some errors (specifically around the XmlReader.ReadStartElement method) and it's causing me to believe that I've misunderstood how to use it somewhere along…

Samuel Slade
- 8,405
- 6
- 33
- 55
6
votes
2 answers
Exceptions with DateTime parsing in RSS feed in C#
I'm trying to parse Rss2, Atom feeds using SyndicationFeedFormatter and SyndicationFeed objects. But I'm getting XmlExceptions while parsing DateTime field like pubDate and/or lastBuildDate.
Wed, 24 Feb 2010 18:56:04 GMT+00:00 does not work
Wed,…

hIpPy
- 4,649
- 6
- 51
- 65
4
votes
3 answers
How to get an XElement with special characters in XML tag
I have an XML document I'm trying to traverse, which is SDMX-compliant. Here's a short sample:
107.92
However, when I…

jehuty
- 528
- 1
- 6
- 20
4
votes
2 answers
Where can I find a list of all possible messages that an XmlException can contain?
I'm writing an XML code editor and I want to display syntax errors in the user interface. Because my code editor is strongly constrained to a particular problem domain and audience, I want to rewrite certain XMLException messages to be more…

Rahul
- 12,181
- 5
- 43
- 64
3
votes
4 answers
Issue parsing XML string to xDocument
I am receiving an XML string from the controller of my web API that is constructed as shown:
private string CreateXDoc(IEnumerable passed)
{
XNamespace xmlns = "http://host.adp.com";
var doc = new…

user1352057
- 3,162
- 9
- 51
- 117
2
votes
2 answers
xmlbeans.xmlexception. illegal XML character 0x0
I create an xml document in C# by converting a string to bytes via System.Text.UTF8Encoding(). I then send this to my java program for xmlbeans to parse via a TCP connection. No matter what i try, i am getting this…

Jason
- 2,147
- 6
- 32
- 40
2
votes
1 answer
Why can't I catch this XML exception?
Context
I've written a class to handle settings for my ASP.NET MVC app. However after testing how it handles a malformed/ missing XML file the exception it seems to throw is uncatchable and it repeats endlessly without catching or moving on with…

Joshua Walker
- 21
- 3
2
votes
3 answers
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
When I start my application (it is a client which connect with WCF to a Service) I see in the Output-Window of Visual Studio many lines with
A first chance exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
I have turn on the…

BennoDual
- 5,865
- 15
- 67
- 153
2
votes
3 answers
If XmlException.SourceUri is read-only, what good is it?
I have a couple places in my code where it throwing a new System.Xml.XmlException seems appropriate. I could just do
throw new XmlException("Your XML sucks go fix it then try again.");
But I think it's better to take advantage whenever possible…

East of Nowhere
- 1,354
- 4
- 18
- 27
2
votes
2 answers
XmlException for the '/' character hex value 0x2F cannot be included in a name
How can I solve the exception generated?
public static string[] getKeywords(string filename)
{
var xmlFile = new XElement(filename);
string[] keywords = xmlFile.Elements("Keyword")
…

Mohit Deshpande
- 53,877
- 76
- 193
- 251
2
votes
1 answer
Why does XName.Get throw an ArgumentException instead of an XmlException for names starting with '{'?
I've been doing some testing of XML in .NET, and discovered that a lot of valid name characters are not allowed. In almost all cases, I get an XmlException on seemingly valid characters.
The XmlException is thrown from System.Xml.dll, with this…

yoozer8
- 7,361
- 7
- 58
- 93