Hi,
I have a button that, when clicked, saves all the info entered. It worked
fine until suddenly it didn't, and I have no idea why. I get the error
An unhandled exception of type 'System.Xml.Xml Exception' occurred in
system.xml.dll
Additional information: System error.
I found that this sometimes happens when there's some unrecognized
character, so I even started with a new xml file, but it still won't work.
It yells at me when I try to say XmlNode Catalog = xml.DocumentEle ment. Any
ideas on why this would suddenly stop working?
Thanks,
Mel
Here's some code:
string cat = @"C:\Catalog4.x ml";
XmlDocument xml = new XmlDocument();
xml.Load(cat);
XmlNode Catalog = xml.DocumentEle ment; (green error arrow here)
XmlElement file = xml.CreateEleme nt("File");
file.InnerText = number.ToString ();
Catalog.AppendC hild(file);
XmlElement eCust = xml.CreateEleme nt("Cust");
eCust.InnerText = cust;
file.AppendChil d(eCust);
xml.Save(cat); 12 1730
melanieab wrote: I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
The Load method parses the XML and throws an exception if the markup is
not well formed:
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpref/html/frlrfSystemXmlX mlDocumentClass LoadTopic2.asp>
So catch the exception e.g.
try {
xml.Load(cat);
}
catch (XmlException e) {
// now check e.Message, e.LineNumber, e.LinePosition here to
// find out why the XML parser can't parse your markup e.g.
}
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Hi Melanieab,
can you include a copy of what is inside your Catalog4.xml file, that
might help explain more precisely what your problem is.
Mark R Dawson
"melanieab" wrote: Hi, I have a button that, when clicked, saves all the info entered. It worked fine until suddenly it didn't, and I have no idea why. I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
I found that this sometimes happens when there's some unrecognized character, so I even started with a new xml file, but it still won't work. It yells at me when I try to say XmlNode Catalog = xml.DocumentEle ment. Any ideas on why this would suddenly stop working? Thanks, Mel
Here's some code: string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
XmlNode Catalog = xml.DocumentEle ment; (green error arrow here)
XmlElement file = xml.CreateEleme nt("File"); file.InnerText = number.ToString (); Catalog.AppendC hild(file);
XmlElement eCust = xml.CreateEleme nt("Cust"); eCust.InnerText = cust; file.AppendChil d(eCust); xml.Save(cat);
Actually now, after playing around with other sections of the code, it seems
I can't use xml at all anymore. At the beginning, I declare a private
DataTable tCat, then later when I want to load the info into a datagrid, I
say tCat = new DataTable (which worked fine before), but now I get the same
error message as below. I have no idea what's going on.
"Martin Honnen" wrote:
melanieab wrote:
I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
The Load method parses the XML and throws an exception if the markup is not well formed: <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpref/html/frlrfSystemXmlX mlDocumentClass LoadTopic2.asp> So catch the exception e.g. try { xml.Load(cat); } catch (XmlException e) { // now check e.Message, e.LineNumber, e.LinePosition here to // find out why the XML parser can't parse your markup e.g. }
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
melanieab wrote: I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
The Load method parses the XML and throws an exception if the markup is
not well formed:
<http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpref/html/frlrfSystemXmlX mlDocumentClass LoadTopic2.asp>
So catch the exception e.g.
try {
xml.Load(cat);
}
catch (XmlException e) {
// now check e.Message, e.LineNumber, e.LinePosition here to
// find out why the XML parser can't parse your markup e.g.
}
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
Hi Melanieab,
can you include a copy of what is inside your Catalog4.xml file, that
might help explain more precisely what your problem is.
Mark R Dawson
"melanieab" wrote: Hi, I have a button that, when clicked, saves all the info entered. It worked fine until suddenly it didn't, and I have no idea why. I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
I found that this sometimes happens when there's some unrecognized character, so I even started with a new xml file, but it still won't work. It yells at me when I try to say XmlNode Catalog = xml.DocumentEle ment. Any ideas on why this would suddenly stop working? Thanks, Mel
Here's some code: string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
XmlNode Catalog = xml.DocumentEle ment; (green error arrow here)
XmlElement file = xml.CreateEleme nt("File"); file.InnerText = number.ToString (); Catalog.AppendC hild(file);
XmlElement eCust = xml.CreateEleme nt("Cust"); eCust.InnerText = cust; file.AppendChil d(eCust); xml.Save(cat);
I've tried a few files. This one is Catalog4 (it's just empty except for
what was automatically generated):
<?xml version="1.0" encoding="utf-8" ?>
and I keep getting that same system error when trying to load
string cat = @"C:\Catalog4.x ml";
XmlDocument xml = new XmlDocument();
xml.Load(cat);
Next, here's Catalog3:
<?xml version="1.0" encoding="utf-8" ?>
<Catalog>
<File ID="1">
<Cust>mrn</Cust>
<CI>400</CI>
<Date>8/8/2005 2:56:45 PM</Date>
</File>
</Catalog>
Finally, this was my original one (Catalog2) where it just stopped working
after I decided I didn't want to use attributes and changed it from the
format in 3 to this one:
<?xml version="1.0" encoding="utf-8"?>
<Catalog>
<File>1<File>
<Cust>mrn</Cust>
<CI>400</CI>
<Date>8/8/2005 2:56:45 PM</Date>
<File>2<File>
<Cust>mab</Cust>
<CI>444</CI>
<Date>8/8/2005 2:58:23 PM</Date>
</Catalog>
Thanks for looking at it!!!
Mel
"Mark R. Dawson" wrote: Hi Melanieab, can you include a copy of what is inside your Catalog4.xml file, that might help explain more precisely what your problem is.
Mark R Dawson
"melanieab" wrote:
Hi, I have a button that, when clicked, saves all the info entered. It worked fine until suddenly it didn't, and I have no idea why. I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
I found that this sometimes happens when there's some unrecognized character, so I even started with a new xml file, but it still won't work. It yells at me when I try to say XmlNode Catalog = xml.DocumentEle ment. Any ideas on why this would suddenly stop working? Thanks, Mel
Here's some code: string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
XmlNode Catalog = xml.DocumentEle ment; (green error arrow here)
XmlElement file = xml.CreateEleme nt("File"); file.InnerText = number.ToString (); Catalog.AppendC hild(file);
XmlElement eCust = xml.CreateEleme nt("Cust"); eCust.InnerText = cust; file.AppendChil d(eCust); xml.Save(cat);
Actually now, after playing around with other sections of the code, it seems
I can't use xml at all anymore. At the beginning, I declare a private
DataTable tCat, then later when I want to load the info into a datagrid, I
say tCat = new DataTable (which worked fine before), but now I get the same
error message as below. I have no idea what's going on.
"Martin Honnen" wrote:
melanieab wrote:
I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
The Load method parses the XML and throws an exception if the markup is not well formed: <http://msdn.microsoft. com/library/default.asp?url =/library/en-us/cpref/html/frlrfSystemXmlX mlDocumentClass LoadTopic2.asp> So catch the exception e.g. try { xml.Load(cat); } catch (XmlException e) { // now check e.Message, e.LineNumber, e.LinePosition here to // find out why the XML parser can't parse your markup e.g. }
--
Martin Honnen --- MVP XML http://JavaScript.FAQTs.com/
I've tried a few files. This one is Catalog4 (it's just empty except for
what was automatically generated):
<?xml version="1.0" encoding="utf-8" ?>
and I keep getting that same system error when trying to load
string cat = @"C:\Catalog4.x ml";
XmlDocument xml = new XmlDocument();
xml.Load(cat);
Next, here's Catalog3:
<?xml version="1.0" encoding="utf-8" ?>
<Catalog>
<File ID="1">
<Cust>mrn</Cust>
<CI>400</CI>
<Date>8/8/2005 2:56:45 PM</Date>
</File>
</Catalog>
Finally, this was my original one (Catalog2) where it just stopped working
after I decided I didn't want to use attributes and changed it from the
format in 3 to this one:
<?xml version="1.0" encoding="utf-8"?>
<Catalog>
<File>1<File>
<Cust>mrn</Cust>
<CI>400</CI>
<Date>8/8/2005 2:56:45 PM</Date>
<File>2<File>
<Cust>mab</Cust>
<CI>444</CI>
<Date>8/8/2005 2:58:23 PM</Date>
</Catalog>
Thanks for looking at it!!!
Mel
"Mark R. Dawson" wrote: Hi Melanieab, can you include a copy of what is inside your Catalog4.xml file, that might help explain more precisely what your problem is.
Mark R Dawson
"melanieab" wrote:
Hi, I have a button that, when clicked, saves all the info entered. It worked fine until suddenly it didn't, and I have no idea why. I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
I found that this sometimes happens when there's some unrecognized character, so I even started with a new xml file, but it still won't work. It yells at me when I try to say XmlNode Catalog = xml.DocumentEle ment. Any ideas on why this would suddenly stop working? Thanks, Mel
Here's some code: string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
XmlNode Catalog = xml.DocumentEle ment; (green error arrow here)
XmlElement file = xml.CreateEleme nt("File"); file.InnerText = number.ToString (); Catalog.AppendC hild(file);
XmlElement eCust = xml.CreateEleme nt("Cust"); eCust.InnerText = cust; file.AppendChil d(eCust); xml.Save(cat);
Hi Melanieab,
I am not sure if you mistyped this for your reply but the XML: <?xml version="1.0" encoding="utf-8"?> <Catalog> <File>1<File> <Cust>mrn</Cust> <CI>400</CI> <Date>8/8/2005 2:56:45 PM</Date> <File>2<File> <Cust>mab</Cust> <CI>444</CI> <Date>8/8/2005 2:58:23 PM</Date> </Catalog>
has an invalid <File> tag, the closing bracket is not correct, you have
<File>1<File> when it should be <File>1</File> this would definitely cause
an exception when you try to load the XML and the document tries to parse the
XML.
For your catalog4.xml file, if all it contains is:
<?xml version="1.0" encoding="utf-8" ?>
then an exception will be thrown because there is no document for the XML
document to load, it fails trying to parse the data on the Load method call,
if you have something like:
<?xml version="1.0" encoding="utf-8" ?>
<myRootElemen t />
then this will load okay. Basically make sure in your code that you always
have a root element in your XML file even if you do not have anything to put
inside it.
Hope that helps
Mark R Dawson
"melanieab" wrote:
I've tried a few files. This one is Catalog4 (it's just empty except for what was automatically generated):
<?xml version="1.0" encoding="utf-8" ?>
and I keep getting that same system error when trying to load string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
Next, here's Catalog3:
<?xml version="1.0" encoding="utf-8" ?> <Catalog> <File ID="1"> <Cust>mrn</Cust> <CI>400</CI> <Date>8/8/2005 2:56:45 PM</Date> </File> </Catalog>
Finally, this was my original one (Catalog2) where it just stopped working after I decided I didn't want to use attributes and changed it from the format in 3 to this one:
<?xml version="1.0" encoding="utf-8"?> <Catalog> <File>1<File> <Cust>mrn</Cust> <CI>400</CI> <Date>8/8/2005 2:56:45 PM</Date> <File>2<File> <Cust>mab</Cust> <CI>444</CI> <Date>8/8/2005 2:58:23 PM</Date> </Catalog>
Thanks for looking at it!!! Mel "Mark R. Dawson" wrote:
Hi Melanieab, can you include a copy of what is inside your Catalog4.xml file, that might help explain more precisely what your problem is.
Mark R Dawson
"melanieab" wrote:
Hi, I have a button that, when clicked, saves all the info entered. It worked fine until suddenly it didn't, and I have no idea why. I get the error An unhandled exception of type 'System.Xml.Xml Exception' occurred in system.xml.dll Additional information: System error.
I found that this sometimes happens when there's some unrecognized character, so I even started with a new xml file, but it still won't work. It yells at me when I try to say XmlNode Catalog = xml.DocumentEle ment. Any ideas on why this would suddenly stop working? Thanks, Mel
Here's some code: string cat = @"C:\Catalog4.x ml"; XmlDocument xml = new XmlDocument(); xml.Load(cat);
XmlNode Catalog = xml.DocumentEle ment; (green error arrow here)
XmlElement file = xml.CreateEleme nt("File"); file.InnerText = number.ToString (); Catalog.AppendC hild(file);
XmlElement eCust = xml.CreateEleme nt("Cust"); eCust.InnerText = cust; file.AppendChil d(eCust); xml.Save(cat); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Matt Rapoport |
last post by:
I'm running an NT service with a thread. The thread performs a
calculation every so often and appends the number to a text file.
Every so often the thread just stops - or so it seems. The text file
stops getting numbers added to it but the service is still running and
no errors have been thrown. I'm quite sure that the code would catch
an error and post it to the event viewer if one were arising.
The only other relevant points I can...
|
by: Dean J. Garrett |
last post by:
We've had a small Access database driving a website using ASP code for a
couple of years now. About 2 months ago, the code would intermittantly get
database access errors like the one below. It doesn't always happen, in fact
it can go for days without happening. When this started, the Access database
was Access 97, but since then we've upgraded to Access 2003, but it still
happens. To cure, we do an IISRESET and it fixes the situation for a...
|
by: Adam |
last post by:
Hi!
I've modified a javascript order form calculation script that tallies
up the subtotal, shipping/handling, and total automatically.
I did some modifications and it still worked fine, even in Netscape,
but at some point the Shipping/Handling field has ceased to display
correctly in that browser, showing a Not A Number error. (In Safari it
looks fine, and it calculates correctly in all browsers I've tested it
with.)
|
by: allenj |
last post by:
DB2 UDB 7.2 WSE
Fixpak 9
Linux Red Hat 7.3
A very strange thing just happened w/ my DB2 server. I am on Linux and
using NIS - the instance owner is in the servers /etc/passwd file.
Suddenly, DB2 would not authenticate any NIS-based logins, but it
*would* authenticate the local non-NIS instance owner. This was
happening not only w/ local connections on the server, but also
|
by: Michiel Rapati-Kekkonen |
last post by:
Sometimes it happens that an application that worked well before
starts to complain.
All kind of simple commands seem suddenly to be ununderstandable.
I then check the list of 'references', if I see something unusual.
(I use a non-English version and References is my guess for the translation)
If DAO objects is there, Visual Basic extensions etc.
Nothing unusual this time, at least: to my knowledge. Which is only
limited...
Can anybody...
| |
by: Roman Mashak |
last post by:
Hello, All!
I faced with unknown problem for me, hopefully local guru can help me out.
#define MSGLEN 32
#define BUFFLEN 1024
typedef struct msg_s {
unsigned char msg_flag;
unsigned char msg_type;
|
by: melanieab |
last post by:
Hi,
I'd been saying DataGrid.HitTestInfo HitInfo = dg.HitTest(e.X, e.Y); for a
while without any problem (of course with using System.Windows.Forms;). Then
suddently I got errors and had to add System.Windows.Forms. in front of
DataGrid.HitTestInfo. Just wondering if anyone knew of possible reasons for
this.
Thanks!
Melanie
|
by: Pieter |
last post by:
Hi,
I developed an Outlook Add In (VB.NET 2005, for Outlook 2003) that sometimes
suddenly stops loading. I've put everywhere in the code Exception Handlers,
but no Exception is catched.
it seems that other add ins aren't loaded afterwarths (nod32).
Does anybody know a way to find out why an outlook add could do this? and
find out after the problem what caused the problem?
|
by: =?Utf-8?B?TGlzYUxHSw==?= |
last post by:
Yesterday Outlook stopped working on my computer. All I get is an error
message saying "Cannot open the Outlook window. The set folders cannot be
opened. Errors have been detected in the file. Use the inbox repair tool...
(I can't get to my inbox!) to diagnose and repair errors in the file."
This all happened after an update. I don't know what to do. I need those
e-mails back for my work. Can anyone help me, please?
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |