You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by bharath s <bh...@gmail.com> on 2008/03/24 11:54:45 UTC

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

Re: SCHEMA

Posted by Alberto Massari <am...@datadirect.com>.
bharath s wrote:
> No Alberto it is still giving the same error
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cdf:Benchmark id= "test" resolved= "0"
> xmlns="http://checklists.nist.gov/xccdf/1.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1
> file:xccdf.xsd">
>   

"file:xccdf.xsd" is not a valid URI; either use just "xccdf.xsd", or the complete "file:///x:/dir/xccdf.xsd"; also, your root element is using the cdf: prefix but it's missing the xmlns:cdf declaration (as you are using xmlns="http://checklists.nist.gov/xccdf/1.1", you can just remove the cdf prefix)

Alberto


> For this its saying
>
> The schemaLocation attribute does not contain pairs of values.
> At line 6
> At column 17
> terminate called after throwing an instance of 'xercesc_2_8::DOMException'
> Aborted (core dumped)
>
> why is it giving the error at column 17?..Column 17 is character after
> closing '>'...
>
>
> Thanks in advance
>
> Bharath Shankar
>
> On 3/25/08, Alberto Massari <am...@datadirect.com> wrote:
>   
>> 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 <js...@pkc.com> 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:bharaths1987@gmail.com]
>>>> Sent: Monday, March 24, 2008 10:59 AM
>>>> To: c-users@xerces.apache.org
>>>> 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 <js...@pkc.com> 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:bharaths1987@gmail.com]
>>>>> Sent: Monday, March 24, 2008 6:55 AM
>>>>> To: c-users@xerces.apache.org
>>>>> 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
>>>>>
>>>>>
>>>>>           
>>>       
>>
>>     
>
>   



Re: SCHEMA

Posted by bharath s <bh...@gmail.com>.
No Alberto it is still giving the same error

<?xml version="1.0" encoding="UTF-8"?>
<cdf:Benchmark id= "test" resolved= "0"
xmlns="http://checklists.nist.gov/xccdf/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1
file:xccdf.xsd">

For this its saying

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

why is it giving the error at column 17?..Column 17 is character after
closing '>'...


Thanks in advance

Bharath Shankar

On 3/25/08, Alberto Massari <am...@datadirect.com> wrote:
>
> 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 <js...@pkc.com> 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:bharaths1987@gmail.com]
> >> Sent: Monday, March 24, 2008 10:59 AM
> >> To: c-users@xerces.apache.org
> >> 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 <js...@pkc.com> 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:bharaths1987@gmail.com]
> >>> Sent: Monday, March 24, 2008 6:55 AM
> >>> To: c-users@xerces.apache.org
> >>> 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
> >>>
> >>>
> >
> >
>
>
>

Re: SCHEMA

Posted by Alberto Massari <am...@datadirect.com>.
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 <js...@pkc.com> 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:bharaths1987@gmail.com]
>> Sent: Monday, March 24, 2008 10:59 AM
>> To: c-users@xerces.apache.org
>> 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 <js...@pkc.com> 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:bharaths1987@gmail.com]
>>> Sent: Monday, March 24, 2008 6:55 AM
>>> To: c-users@xerces.apache.org
>>> 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
>>>
>>>       
>
>   



Re: SCHEMA

Posted by bharath s <bh...@gmail.com>.
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....

Thanks in advance.

On Mon, Mar 24, 2008 at 9:04 PM, Jesse Pelton <js...@pkc.com> 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:bharaths1987@gmail.com]
> Sent: Monday, March 24, 2008 10:59 AM
> To: c-users@xerces.apache.org
> 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 <js...@pkc.com> 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:bharaths1987@gmail.com]
> > Sent: Monday, March 24, 2008 6:55 AM
> > To: c-users@xerces.apache.org
> > 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
> >
>

RE: SCHEMA

Posted by Jesse Pelton <js...@PKC.com>.
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:bharaths1987@gmail.com] 
Sent: Monday, March 24, 2008 10:59 AM
To: c-users@xerces.apache.org
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 <js...@pkc.com> 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:bharaths1987@gmail.com]
> Sent: Monday, March 24, 2008 6:55 AM
> To: c-users@xerces.apache.org
> 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
>

Re: SCHEMA

Posted by bharath s <bh...@gmail.com>.
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 <js...@pkc.com> 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:bharaths1987@gmail.com]
> Sent: Monday, March 24, 2008 6:55 AM
> To: c-users@xerces.apache.org
> 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
>

RE: SCHEMA

Posted by Jesse Pelton <js...@PKC.com>.
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:bharaths1987@gmail.com] 
Sent: Monday, March 24, 2008 6:55 AM
To: c-users@xerces.apache.org
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