473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Xerces not validating document correctly

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 2267
jkmyoung
2,057 Expert 2GB
The parser is not getting the schema.

Do you have spaces in the filename? Try replacing with %20.
Oct 28 '08 #2
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
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...
0
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...
1
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...
2
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...
7
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> ...
3
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....
2
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...
9
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>...
2
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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,...
0
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...

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.