"John Utz" <[EMAIL PROTECTED]> writes:

> Ok;
> 
> i am making good progress now. but i just got smacked:
> 
> here is the code from SEnumVal.cpp
> 
>     if ( parser.getValidator().getGrammar()->getGrammarType() !=
>        Grammar::SchemaGrammarType)
>     {
>         cout << "\n Non schema grammar, no output available\n" << endl;
>       return;
>     }
> 
> here is my implementation in perl:
> 
> die "Non schema grammar, no output available\n"
>     if( $saxParser->getValidator()->getGrammar()->getGrammarType() != 
>       $Grammar::SchemaGrammarType );
> 
> here is the error:
> 
> bash-2.04$ ./SEnumval.pl
> ../../Compile/XML-Xerces-1.6.0_0/samples/personal-schema.xml
> Name "Grammar::SchemaGrammarType" used only once: possible typo at
> ./SEnumval.pl line 37.
> Can't locate object method "TIEHASH" via package "XML::Xerces::Grammar" at
> /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/XML/Xerces.pm line 782.
> 
> 
> so, i'll admit that i faked up $Grammar::SchemaGrammarType because it
> seemed reasonable. is this missing functionality? i grepped for Grammar
> in the .pm's and didnt find it.

Ah... God bless SWIG. Five minutes later and we have:

  DB<2> use XML::Xerces

  DB<3> $d = XML::Xerces::DOMParser->new

  DB<4> x $d->getValidator
0  XML::Xerces::XMLValidator=HASH(0x10755f48)
     empty hash
  DB<5> x $d->getValidator->getGrammar
0  undef
  DB<6> $d->parse('samples/personal.xml')

  DB<7> x $d->getValidator->getGrammar
0  XML::Xerces::Grammar=HASH(0x10393b40)
     empty hash
  DB<8> x $d->getValidator->getGrammar->getGrammarType
0  0
  DB<9> p $d->getValidator->getGrammar->getGrammarType == 
$XML::Xerces::Grammar::DTDGrammarType
1

So it works ;-)

You'll notice that it's  $XML::Xerces::Grammar::DTDGrammarType and not
just  $Grammar::DTDGrammarType.

I'll check it all in to CVS tonight, give me an hour.
jas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to