473,545 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Xerces not validating document correctly

2 New Member
Hi,

I am using Xerces 2.8.

When I try to validate a file which is in the same folder as the xsd, it works fine. But if I try to validate an XML file which is in some other folder, it gives me a whole load of "unknown element" errors for every element in my XML file.

This is the code that I am using:

Expand|Select|Wrap|Line Numbers
  1.  
  2. XMLPlatformUtils::Initialize();
  3.  
  4.     XercesDOMParser *parser = new XercesDOMParser;
  5.     parser->setValidationScheme(XercesDOMParser::Val_Always);
  6.     parser->setDoNamespaces(true);
  7.     parser->setDoSchema(true);
  8.     parser->setValidationSchemaFullChecking(true);
  9.  
  10.     parser -> setExternalSchemaLocation ("http://blah blah.xsd");
  11.  
  12.     ParseErrorHandler *handler = new ParseErrorHandler();
  13.     parser->setErrorHandler(handler);
  14.  
  15.     parser->parse(filename);
  16.  
The filename is being passed correctly.
Oct 27 '08 #1
2 2270
jkmyoung
2,057 Recognized Expert Top Contributor
The parser is not getting the schema.

Do you have spaces in the filename? Try replacing with %20.
Oct 28 '08 #2
tarunprabhu
2 New Member
The parser is not getting the schema.

Do you have spaces in the filename? Try replacing with %20.
Ok, I had to specify the full path to the xsd. How stupid! Thanks anyway.
Oct 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4251
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...
0
1764
by: BODIN | last post by:
I have an XML document, which is actually physically stored in 2 separated files. doc1.xml and doc2.xml I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two physical files, and use of XML Schema.
1
1826
by: Kevin Partin | last post by:
I have downloaded the latest Xerces-J files from Apache.org and am trying to use them to validate an xml data file against a schema that I wrote. Can someone please provide me with the java command line that I would need to invoke in order to perform this validation? For the life of me I can't find any documentation on this (or at least it is...
2
3926
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
7
13333
by: Georg J. Stach | last post by:
Hi, as mentioned above I'd like to validate a simple XML-document with a simple DTD. For this, I use Java and Xerces. But, when I have tags of this form: <tag>some characters in here</tag> Xerces always complains with:
3
2750
by: ciaran.mchale | last post by:
Hi folks, I downloaded the binary version of Xerces C++ 2.7.0 for Windows and am using it to help me get up to speed with XML and XML Schema. So please excuse me if this is a "novice" question. In the samples/data directory, I ran the following command for all the files: DOMPrint -n -s -f -v=always <filename>
2
1422
by: Robert W. | last post by:
Hi, I have written a schema, specifying attributeFormDefault and elementFormDefault to be "qualified". If I parse an instance document validating against this schema with the DOMParser from xerces2-j (2.8.0) and then serialising the DOM-tree again into a file, all optional attributes are added with their default values, but they are not...
9
2997
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>
2
2348
by: Boris Kolpackov | last post by:
Hi, I am pleased to announce the availability of Apache Xerces-C++ 3.0.0. Xerces-C++ is an open-source validating XML parser written in a portable subset of C++. It provides DOM (level 1, 2, and 3), SAX, and SAX2 APIs and supports validation of XML documents against DTD and XML Schema. This release includes a large number of new...
0
7479
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...
0
7411
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...
0
7773
tracyyun
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...
0
4962
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...
0
3468
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...
0
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
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
1
1028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
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...

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.