473,785 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xerces C++ problem if XML file not present

Hi,

I am using the Xerces C++ parser API (2.3.0) on Solaris 2.8 and am getting a
problem if I try to parse a file which does not exist.

Here's the code:

XercesDOMParser *parser = new XercesDOMParser ;

try
{
parser->parse(file.dat a());
}
catch (const XMLException& xmlException)
{
logError("Confi gFileReader::Re adGeneralConfig File An error occurred
attempting to parse XML file %s, cause = $s", file,
xmlException.ge tMessage());
return false;
}
catch (const DOMException& domException)
{
logError("Confi gFileReader::Re adGeneralConfig File An error occurred
attempting to parse DOM file %s, code = $s", file, domException.co de);
return false;
}
catch (...)
{
logError("Confi gFileReader::Re adGeneralConfig File An unknown error
occurred attempting to parse XML file %s", file);
return false;
}

Everything is fine if the XML file exists and it is parsed without problem.
However if the file does not exist an exception is not thrown and the
program continues to try and traverse the doucment tree (which does not
exist of course). Even the (...) catch-all exception is not run.

Is there anything I have missed here? I can't see anything from the sample
Xerces stuff and the API documentation.

Many thanks

Greg
Jul 20 '05 #1
0 1452

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

Similar topics

0
4272
by: bugbear | last post by:
Subject pretty much says it all. I'd like to parse XML (duh!) using Xerces (because its fast, and reliable, and comprehensive, and supports lots of features). I'd like to conform to standards as much as possible, so I'd like to call Xerces under the JAXP API. I'd like to validate the XML against a DTD, so that errors are flagged up to the user, and I can transcribe
2
2719
by: Bekkali Hicham | last post by:
hi, i have downloaded the latest version 2.4 of Xerces, and unziped it, i end up with a diectory hierarchy like this c:\xerces-2_4_0\XercesImpl.jar c:\xerces-2_4_0\XercesSamples.jar c:\xerces-2_4_0\xml-apis.jar c:\xerces-2_4_0\xmlParserAPIS.jar c:\xerces-2_4_0\data c:\xerces-2_4_0\docs c:\xerces-2_4_0\samples there is no bin directory, my question is :
0
1216
by: Greg O'Rawe | last post by:
Hi, I'm using Xerces C++ to parse some XML files - I use the XercesDOMParser object and invoke the "parse" method, catching exceptions for various types of errors. I also have an error handler object installed which reports fatal and non-fatal errors. The XML file resides on a remote server so the parameter to the parse method will be a URL. The problem is that one particular XML file is optional, so my program should continue if the...
0
3091
by: Waseem | last post by:
Hi I have looked and tried everything and i still cant sort this out i have no idea why this wont work I am using Xerces Perl on Windows and Debian to try this and it wont work on both of them. Basically i am tryin to do simple tree transversale and get the node values out
1
2346
by: Vineeth | last post by:
Hi, I am using xerces2.6.0 and am developing a program for converting an xml document to a text file. My program is extending the DefaultHandler. The first problem I am facing is that even though I have turned the Validation feature off, the SAX parser still needs the DTD to be present. If I remove the DOCTYPE declaration from the XML file then it raises an exception for unparsed entities. If I provide a zero byte DTD then the SX parser...
2
3958
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home Canonicalpath-Directory4: \\wkdis3\ROOT\home\bwe\ You selected the file named AAA.XML getXmlAlgorithmDocument(): IOException Not logged in
1
2746
by: Francesc Guim Bernat | last post by:
Dear colleagues, i'm getting in troubles using one XML library with Visual Studio .NET and Xerces with Xalan. When i execute the code i get the next run time error: "Run-Time Check Failure #2 - Stack around the variable 'resolver' was corrupted." Looking on internet i've seen that the compiler, if you're running your
3
3405
by: Matt | last post by:
Hello, Summary: Where can one download a Xerces-C (XML pardser) dynamic library file (.DLL file) for Windows (Win98/WinNT/Win2k/WinXP/Win2003, including server flavors; don't need to support pre-98) without having to build the library from source? We posed this question to the Xerces-users email list, but have yet to
9
3020
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13> <binaryobject3></binaryobject3>
0
9643
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
9480
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,...
0
10319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
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...
1
10087
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
5380
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
4046
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
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
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.