You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Schmid, David" <sc...@cajvc.com> on 2001/07/20 01:38:40 UTC

Access to Schema via SchemaValidator?

I am trying to do the equivalent of the EnumVal sample, except using a
SchemaValidator instead of a DTDValidator. My program compiles, but just
crashes when it tries to parse the start tag.

Should I expect this to work yet? Any hints? I don't know my way around
Xerces awfully well yet...

Thanks in advance






---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Access to Schema via SchemaValidator?

Posted by "Peter A. Volchek" <Pe...@ti.com.od.ua>.
> I am trying to do the equivalent of the EnumVal sample, except using a
> SchemaValidator instead of a DTDValidator. My program compiles, but just
> crashes when it tries to parse the start tag.
>
> Should I expect this to work yet? Any hints? I don't know my way around
> Xerces awfully well yet...
>
> Thanks in advance
>

Yes,
Seems that you ran into the same problem as I did when wrote the same sample
as you.
I wanted to open a bug but forgot :(
The workaround is the following:

- Don't use the Schema validator in a way they do for DTD validator

    Instead of

    //SchemaValidator* valToUse = new SchemaValidator;
    // SAXParser parser(valToUse);
...
    //SchemaGrammar* grammar = (SchemaGrammar*) valToUse->getGrammar();

    write:
    SAXParser parser;

    and later, access the Grammar as

    SchemaGrammar* grammar = (SchemaGrammar*)
parser.getValidator().getGrammar();

If you wish, you may use and rewrite my initial Schema sample (see the
attachment)

Best regards,

Peter A. Volchek
Software Engineer
Metis International, Inc.
PeterV@ti.com.od.ua