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 Umesh Chandak <um...@gs-lab.com> on 2007/02/05 06:43:20 UTC

load grammar fails to load the http://schemas.xmlsoap.org/soap/encoding/

Hi All,
I am trying to import the namespace
http://schemas.xmlsoap.org/soap/encoding/ in my schema. But Xerces
loadGrammar function fails to load this schema. It gives me error 

Error:  /home/umeshc/Desktop/encoding.xml (Line 151: Column 52)
  It is an error for NOTATION to be used directly in a schema in
element/attribute 'NOTATION'.

Following is my code snippet ...

const bool schemaFullChecking = true;
SAX2XMLReaderImpl* parser = new
SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
    Janitor<SAX2XMLReaderImpl> janParser(parser);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
    parser->setFeature(XMLUni::fgXercesSchema, true);
    parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
schemaFullChecking);
    parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
    parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
    parser->setFeature(XMLUni::fgXercesDynamic, true);
    XMLEntityResolver * currentEntityResolver =
parser->getXMLEntityResolver();
    XMLImportIncludeResolverWrapper* r = new
XMLImportIncludeResolverWrapper(currentEntityResolver,
entityResolver,entityResolverArg, errors) ;
    parser->setXMLEntityResolver(r);

    XSDErrorHandler* errorHandler = new XSDErrorHandler();  // new
XSDErrorHandler(&cout);
    Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
    parser->setErrorHandler(errorHandler);
    Grammar* result = parser->loadGrammar(xsdFileName[0],
Grammar::SchemaGrammarType, true);
    delete r;
    
    if (errorHandler->hasErrors()) {
      printf("Error Handler flushed : %s
\n",errorHandler->str().c_str());
      return false;
    }
    if (result==NULL) {
      return false;
    }
    return true;  

Above namespace is standard namespace. There is an error on line 151 of
that namespace.
 Can any body tell we why this is happening. Does I need to different
setting than this for loadGrammar? Does I need to enable some feature
for this. Any help is appreciated.
Thanks in advance.
Regards,
Umesh


Re: load grammar fails to load the http://schemas.xmlsoap.org/soap/encoding/

Posted by Umesh Chandak <um...@gs-lab.com>.
Hi,
Sorry for posting the same message on both. I thought these are two
different list. This is the standard schema available on net at virtual
site http://schemas.xmlsoap.org/soap/encoding/ . you can look there
also. I am also attaching the same schema here also

On Mon, 2007-02-05 at 10:11 +0100, Alberto Massari wrote:
> Hi Umesh,
> please attach the schema you are trying to load (as the error is in 
> the schema, not in the code that loads it). Also, do not cross post 
> on both c-users and c-dev.
> 
> Alberto
> 
> At 11.13 05/02/2007 +0530, you wrote:
> >Hi All,
> >I am trying to import the namespace
> >http://schemas.xmlsoap.org/soap/encoding/ in my schema. But Xerces
> >loadGrammar function fails to load this schema. It gives me error
> >
> >Error:  /home/umeshc/Desktop/encoding.xml (Line 151: Column 52)
> >   It is an error for NOTATION to be used directly in a schema in
> >element/attribute 'NOTATION'.
> >
> >Following is my code snippet ...
> >
> >const bool schemaFullChecking = true;
> >SAX2XMLReaderImpl* parser = new
> >SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
> >     Janitor<SAX2XMLReaderImpl> janParser(parser);
> >     parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
> >     parser->setFeature(XMLUni::fgXercesSchema, true);
> >     parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
> >schemaFullChecking);
> >     parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
> >     parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
> >     parser->setFeature(XMLUni::fgXercesDynamic, true);
> >     XMLEntityResolver * currentEntityResolver =
> >parser->getXMLEntityResolver();
> >     XMLImportIncludeResolverWrapper* r = new
> >XMLImportIncludeResolverWrapper(currentEntityResolver,
> >entityResolver,entityResolverArg, errors) ;
> >     parser->setXMLEntityResolver(r);
> >
> >     XSDErrorHandler* errorHandler = new XSDErrorHandler();  // new
> >XSDErrorHandler(&cout);
> >     Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
> >     parser->setErrorHandler(errorHandler);
> >     Grammar* result = parser->loadGrammar(xsdFileName[0],
> >Grammar::SchemaGrammarType, true);
> >     delete r;
> >
> >     if (errorHandler->hasErrors()) {
> >       printf("Error Handler flushed : %s
> >\n",errorHandler->str().c_str());
> >       return false;
> >     }
> >     if (result==NULL) {
> >       return false;
> >     }
> >     return true;
> >
> >Above namespace is standard namespace. There is an error on line 151 of
> >that namespace.
> >  Can any body tell we why this is happening. Does I need to different
> >setting than this for loadGrammar? Does I need to enable some feature
> >for this. Any help is appreciated.
> >Thanks in advance.
> >Regards,
> >Umesh
> 
> 

Re: load grammar fails to load the http://schemas.xmlsoap.org/soap/encoding/

Posted by Alberto Massari <am...@datadirect.com>.
Hi Umesh,
please attach the schema you are trying to load (as the error is in 
the schema, not in the code that loads it). Also, do not cross post 
on both c-users and c-dev.

Alberto

At 11.13 05/02/2007 +0530, you wrote:
>Hi All,
>I am trying to import the namespace
>http://schemas.xmlsoap.org/soap/encoding/ in my schema. But Xerces
>loadGrammar function fails to load this schema. It gives me error
>
>Error:  /home/umeshc/Desktop/encoding.xml (Line 151: Column 52)
>   It is an error for NOTATION to be used directly in a schema in
>element/attribute 'NOTATION'.
>
>Following is my code snippet ...
>
>const bool schemaFullChecking = true;
>SAX2XMLReaderImpl* parser = new
>SAX2XMLReaderImpl(XMLPlatformUtils::fgMemoryManager, grammarPool);
>     Janitor<SAX2XMLReaderImpl> janParser(parser);
>     parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
>     parser->setFeature(XMLUni::fgXercesSchema, true);
>     parser->setFeature(XMLUni::fgXercesSchemaFullChecking,
>schemaFullChecking);
>     parser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, false);
>     parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
>     parser->setFeature(XMLUni::fgXercesDynamic, true);
>     XMLEntityResolver * currentEntityResolver =
>parser->getXMLEntityResolver();
>     XMLImportIncludeResolverWrapper* r = new
>XMLImportIncludeResolverWrapper(currentEntityResolver,
>entityResolver,entityResolverArg, errors) ;
>     parser->setXMLEntityResolver(r);
>
>     XSDErrorHandler* errorHandler = new XSDErrorHandler();  // new
>XSDErrorHandler(&cout);
>     Janitor<XSDErrorHandler> janErrorHandler(errorHandler);
>     parser->setErrorHandler(errorHandler);
>     Grammar* result = parser->loadGrammar(xsdFileName[0],
>Grammar::SchemaGrammarType, true);
>     delete r;
>
>     if (errorHandler->hasErrors()) {
>       printf("Error Handler flushed : %s
>\n",errorHandler->str().c_str());
>       return false;
>     }
>     if (result==NULL) {
>       return false;
>     }
>     return true;
>
>Above namespace is standard namespace. There is an error on line 151 of
>that namespace.
>  Can any body tell we why this is happening. Does I need to different
>setting than this for loadGrammar? Does I need to enable some feature
>for this. Any help is appreciated.
>Thanks in advance.
>Regards,
>Umesh