473,403 Members | 2,338 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,403 software developers and data experts.

Xerces-C++ Schema validation

Hello,

I'm looking for a way of validating/parsing the xsd file (schema), i
only been able of validating the xml file with the corresponding
schema, but what i want is only validate the xsd file, to check if the
schema is valid.

I'm using Xerces-C++ and the only thing that i found is a way of
parsing the xml file with the xml schema like this:

SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
...
parser->loadGrammar(xsdFile.c_str(), Grammar::SchemaGrammarType,
true);
parser->setFeature(XMLUni::fgXercesUseCachedGrammarInPars e, true);
parser->parse(xmlFile.c_str());

But when i try this with only the xsd file
(ex:parser->parse(xsdFile.c_str());) the parser gives me these errors:
ERR: Unknown element 'xs:element'
ERR: Attribute 'ref' is not declared for element 'xs:element'
ERR: Unknown element 'xs:schema'
ERR: Attribute '{http://www.w3.org/2000/xmlns/}xs' is not declared for
element 'xs:schema'
ERR: Unknown element 'xs:element'
ERR: Attribute 'name' is not declared

My question is:
is there any way in Xerces-C++ to validate one xsd file only, not the
xml file against it's schema?

Thanks
Nuno

Oct 25 '06 #1
1 4709
Hi Nuno!

AFAIK Xerces can't do this for you. Using Saxon-SA you can validate the
schema itself.

Regards
spiff

http://www.spycomponents.com
ValidatorBuddy - Use Xerces, Saxon or MSXML in XMLSpy
Nuno schrieb:
Hello,

I'm looking for a way of validating/parsing the xsd file (schema), i
only been able of validating the xml file with the corresponding
schema, but what i want is only validate the xsd file, to check if the
schema is valid.

I'm using Xerces-C++ and the only thing that i found is a way of
parsing the xml file with the xml schema like this:

SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
...
parser->loadGrammar(xsdFile.c_str(), Grammar::SchemaGrammarType,
true);
parser->setFeature(XMLUni::fgXercesUseCachedGrammarInPars e, true);
parser->parse(xmlFile.c_str());

But when i try this with only the xsd file
(ex:parser->parse(xsdFile.c_str());) the parser gives me these errors:
ERR: Unknown element 'xs:element'
ERR: Attribute 'ref' is not declared for element 'xs:element'
ERR: Unknown element 'xs:schema'
ERR: Attribute '{http://www.w3.org/2000/xmlns/}xs' is not declared for
element 'xs:schema'
ERR: Unknown element 'xs:element'
ERR: Attribute 'name' is not declared

My question is:
is there any way in Xerces-C++ to validate one xsd file only, not the
xml file against it's schema?

Thanks
Nuno
Oct 25 '06 #2

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

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...
2
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...
1
by: Stu | last post by:
I am trying to build the xerces shared library with 2.3.0 version of their source code on an AIX 5.1 32 bit machine with the following version of the g++ compiler /usr/local/bin/g++ -v Reading...
0
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...
0
by: Jim Phelps | last post by:
After having memory leak issues with Xerces-c 2.3.0 for Solaris 2.7 for CC 6.2 I have decided to update to at least 2.4. I have downloaded the binary tarball and have installed it on my...
0
by: Dale Gerdemann | last post by:
I've been trying to use DOM level 3 with xerces-2_6_2. There's a sample called samples/DOM3.java, but I've had trouble with compilation. I've downloaded Xerces-J-bin.2.6.2 and...
18
by: jacksu | last post by:
I have a simple program to run xpath with xerces 1_2_7 XPathFactory factory = XPathFactory.newInstance(); XPath xPath = factory.newXPath(); XPathExpression xp = xPath.compile(strXpr);...
3
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...
2
by: Vlad Zorinov | last post by:
I'm getting the following error after a couple of months of XML processing, using Xerces 2.0.0 in an apache tomcat. Does anyone have any ideas what this problem may be or what I should do to solve...
3
by: Raphael Tagliani | last post by:
(english version below) Bonjour! Je travaille sur un gros projet java, qui parse beaucoup de fichiers xml au lancement d'un serveur. Nous avons un problème de concurrence qu lancement. En...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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
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...
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.