[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-users
Subject:    Re: How to do Schema Validation
From:       Rob Benton <rob.benton () conwaycorp ! net>
Date:       2005-08-21 3:46:11
Message-ID: 43080940.2080000 () conwaycorp ! net
[Download RAW message or body]

Stephen Collyer wrote:
> Jane Jin (janej) wrote:
> 
>> Hello All,
>>  
>> I'm trying to do schema validation on an xml file. I set the following
>> features:
>>  
>>                     parser->setFeature(XMLUni::fgDOMNamespaces, true);
>>                     parser->setFeature(XMLUni::fgXercesSchema, true);
>>  
>> parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
>>                     schema_file = XMLString::transcode("message.xsd");
> 
> 
> I've only used the Perl bindings to Xerces, but to turn on validation
> I have successfully used the following feature, rather than
> SchemaFullChecking:
> 
> parser->setFeature(XML::Xerces::XMLUni::fgSAX2CoreValidation, true);
> 
> (translated from Perl to C++ so check syntax before using)
> 


Here's what I've got and it seems to work for me:

=======================================================================================
parser->setFeature(XMLUni::fgXercesSchema, true);
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
parser->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,
	schema_location);
=======================================================================================
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic