473,748 Members | 6,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlException

I am using the XmlReader to look at some xml data fragments.

Many times the xml fragment is not readable by the XmlReader, since it isn't
valid.
For example, I may be looking at only the text </MyXmlNode>.
If I try to read this, I get an exception because it is a closing node with
no opening node.

My problem is that there is no way for me to know what the exception is.
The only exception that is thrown is "XmlExcepti on" which does not have a
public ErrorCode property, or anything else that I can look at.

There is a Message property, but that is pretty much useless to me.
I have other exceptions that are thrown, like Nodes that have invalid ( non
printable ) characters. Again, all I know is that there was a problem. No
information on what the problem might have been.

Is there another way to do this so that I can intelligently fix the problem
and try to re-read the Node?

Thanks
Jeff
Nov 16 '05 #1
1 1802
Obviously this is a bug.
Does anyone have any idea if this is going to be fixed in the future?

Jeff

"news.microsoft .com" <hi@hi.com> wrote in message
news:O$******** ******@TK2MSFTN GP09.phx.gbl...
I am using the XmlReader to look at some xml data fragments.

Many times the xml fragment is not readable by the XmlReader, since it isn't valid.
For example, I may be looking at only the text </MyXmlNode>.
If I try to read this, I get an exception because it is a closing node with no opening node.

My problem is that there is no way for me to know what the exception is.
The only exception that is thrown is "XmlExcepti on" which does not have a
public ErrorCode property, or anything else that I can look at.

There is a Message property, but that is pretty much useless to me.
I have other exceptions that are thrown, like Nodes that have invalid ( non printable ) characters. Again, all I know is that there was a problem. No information on what the problem might have been.

Is there another way to do this so that I can intelligently fix the problem and try to re-read the Node?

Thanks
Jeff

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1933
by: Koji Ishii | last post by:
I'm trying to read response from a web server using XmlTextReader. Here's a code snippet. WebResponse rs = this.WebRequest.GetResponse(); Stream stm = rs.GetResponseStream(); XmlTextReader reader = new XmlTextReader(stm); reader.XmlResolver = null; // no DTD/schema, high perf while (reader.Read()){ switch (reader.NodeType){ default:
0
1215
by: George CK | last post by:
Hello, I tried to send an xml string got from XmlTextReader from a web service proxy to a web service. The type of the web method is simply "string" It's fine when the string length was small enough (probably < 1024), but when I send a longer one, I got an XmlException Exception on my client side.
3
22367
by: Todd | last post by:
Our ASP.NET (C#) application accepts form entry and saves inputed data in XML. We are finding that users are sometimes cutting and pasting special characters (from MS Word) into these forms. The data is saved successfuly, but when the XML is later read the following error is encountered depending on the invalid character found: This is a sample:
1
2640
by: George W. | last post by:
When attempting to validate an XML file, If the file is valid, it validates correctly, and it will catch most ValidationEvents without problem. However, I keep getting the following Exception: System.Xml.XmlException: The 'RDaaaa' start tag on line '4' doesn't match the end tag of 'RD' in file 'file:///C:/Work/WIMAR XML/WI_M_1.xml'. Line 4, position 475. at System.Xml.XmlTextReader.ParseTag() at...
1
1848
by: edi | last post by:
Hi, I have MS .Net Framework v1.1.4322. I have this XML file: <?xml version="1.0" ?> <!--here there are two spaces at the beginning--> <aaa> <a id="1"> <Dept>Finance</Dept>
0
3292
by: Franck | last post by:
Hello, here is my basic dtd <!ELEMENT TREENODES (treenode*)> <!ELEMENT treenode (treenode*)> <!ATTLIST treenode Text (#PCDATA) #REQUIRED Level (#PCDATA) #REQUIRED NodeData (#PCDATA) #REQUIRED>
0
3342
by: Frederico Guimar?es via DotNetMonster.com | last post by:
Hi, I'm trying to use the Microsoft.Web.Services2.Messaging. ISoapFormatter but I receive this error: System.Xml.XmlException: The root element is missing. at System.Xml.XmlTextReader.Read() at Microsoft.Web.Services2.Xml.XmlSkipDTDReader.Read() at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
1
2161
by: BLUE | last post by:
In a property i do this: .... catch(XmlException e) { throw new XmlException("Error processing configuration file!",e); } Then I catch it in another class: catch(XmlException e) {
3
3535
by: =?Utf-8?B?RWQgS3JhbWVy?= | last post by:
I thought this might be useful for someone... I was doing a little work earlier using an Xmldocument class to create & maintain a minor store of data in Xml format. I'd gotten the whole thing up and going and I decided to start testing 'disaster' scenarios. For example, you start up but your file has been deleted, or you try to save and the file is read only. Or you lack write permissions. Or you try to load
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4602
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2782
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.