bharath s wrote:
Thanks Pelton..Its working for the sample file given...But my xml file uses
a different namespace other than xml:base...My document looks like this

<cdf:Benchmark id="test" resolved="1" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://checklists.nist.gov/xccdf/1.1";
xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1
file:///home/bharath/Desktop/MY_PROJECT/finalvalid/xccdf-1.1.xsd"
id="aixpert-test-1"
resolved="0"
 xml:lang="en">

So i have to use gXercesSchemaExternalSchemaLocation only.

My schema looks like this

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    targetNamespace="http://checklists.nist.gov/xccdf/1.1";
    elementFormDefault="qualified" attributeFormDefault="unqualified">


Its still giving the same error...Plz review my xml and schema snippets and
let me know for any changes....

While xsi:noNamespaceSchemaLocation has to specify the location for a single namespace (the one with empty namespace), xsi:schemaLocation must specify the schema for every other namespace; so its structure is "<namespace1> <location1> <namespace2> <location2> ..." (hence the error message "the schemaLocation attribute does not contain pairs of values"). In your case you should use "http://checklists.nist.gov/xccdf/1.1 personal.xsd"

Alberto

Thanks in advance.

On Mon, Mar 24, 2008 at 9:04 PM, Jesse Pelton <[EMAIL PROTECTED]> wrote:

Try fgXercesSchemaExternalNoNameSpaceSchemaLocation in place of
fgXercesSchemaExternalSchemaLocation.  You have to let Xerces know not
to associate the schema with a namespace.

-----Original Message-----
From: bharath s [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2008 10:59 AM
To: [email protected]
Subject: Re: SCHEMA

Thanks a lot for the link Pelton.
But the sample xml file given has

xsi:noNamespaceSchemaLocation='personal.xsd'


it doesnt hav xsi:schemaLocation as schema file doesnt have any
targetNamespace...

Is there any feature of DOMBuilder which i have missed out?

Im currently doing this:

         parser->setFeature(XMLUni::fgXercesSchema, true);
       parser->setFeature(XMLUni::fgDOMValidation, true);
       parser->setFeature(XMLUni::fgDOMNamespaces, true);
       parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
       parser->setFeature(XMLUni::fgXercesValidateAnnotations, true);
       parser->setFeature(XMLUni::fgXercesSkipDTDValidation, true);
       XMLCh* test=XMLString::transcode("personal.xsd");

parser->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,test);
       parser->setFeature( XMLUni::fgXercesSchemaFullChecking, true);

       myhandler* errHandler = new myhandler();
       parser->setErrorHandler(errHandler);//Set error hadler to our
own
handler to display appropriate messages
       char* xmlFile = "personnel.xml";
       DOMDocument *doc = 0;
       try {
           doc = parser->parseURI(xmlFile);//Parse the xml file into a
DOM
tree
       }




Thanks in advance,

Bharath Shankar.


On Mon, Mar 24, 2008 at 5:49 PM, Jesse Pelton <[EMAIL PROTECTED]> wrote:

It looks to me like the error is as reported: your schemaLocation
string
does not contain namespace/location URI pairs (separated by spaces).
See http://www.w3.org/TR/xmlschema-0/#ref40.  I'd expect validation to
fail if a) there are an odd number of values (as in your example) or
b)
one or more values is not a well-formed URI.

-----Original Message-----
From: bharath s [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2008 6:55 AM
To: [email protected]
Subject: SCHEMA

Hi all,

Im trying to validate the sample xml file given with
xerces2.8source..i.e..personnel.xml  against the schema
personal.xsd

Im doing this

 parser->setFeature(XMLUni::fgXercesSchema, true);
       parser->setFeature(XMLUni::fgDOMValidation, true);
       parser->setFeature(XMLUni::fgDOMNamespaces, true);
       parser->setFeature(XMLUni::fgDOMDatatypeNormalization, true);
       parser->setFeature(XMLUni::fgXercesValidateAnnotations, true);
       parser->setFeature(XMLUni::fgXercesSkipDTDValidation, true);
       XMLCh* test=XMLString::transcode("personal.xsd");


parser->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,test);
       parser->setFeature( XMLUni::fgXercesSchemaFullChecking, true);

       myhandler* errHandler = new myhandler();
       parser->setErrorHandler(errHandler);//Set error hadler to our
own
handler to display appropriate messages
       char* xmlFile = "personnel.xml";
       DOMDocument *doc = 0;
       try {
           doc = parser->parseURI(xmlFile);//Parse the xml file into a
DOM
tree
       }


But the program is giving an error

The schemaLocation attribute does not contain pairs of values.
At line 4
At column 50
terminate called after throwing an instance of
'xercesc_2_8::DOMException'
Aborted (core dumped)


I need some help...Plz...


Thanks in advance,

Bharath Shankar




Reply via email to