I think that i have created the correct actual_cast and reinterpret_class,
but i just realized that this doesnt get propogated to the methods,

i see there is some code that has some 'transmogrification' regexp work
and does this work on the lsit @dom_node_methods.

do i need to do something with this? do i need to create a
@grammar_methods? what goes into this list and what doesnt go into this
list, or am i barking up the wrong tree?


On Wed, 13 Mar 2002, John Utz wrote:

> i figured it out, i think, based on getGrammarType and bless $self
> 
> On Wed, 13 Mar 2002, John Utz wrote:
> 
> > ok
> > 
> > On 13 Mar 2002, (Jason E. Stewart) wrote:
> > > 
> > > Ok. You're getting bitten by the SWIG-casts-things-to-the-base-class
> > > problem. Look at the class of the object your code printed out:
> > > XML::Xerces::Grammar into the bless command.
> > > 
> > > The way we get around this for the other class hierarchies is to use a
> > > method called actual_cast() to re-bless the object into the
> > > appropriate subclass:
> > > 
> > >   package XML::Xerces::DOM_Node;
> > > 
> > >   sub actual_cast {
> > >     return undef unless _isa( ref($_[0]), 'XML::Xerces::DOM_Node' );
> > >     return $_[0] if $_[0]->isNull;
> > >   
> > >     my $node_type = $_[0]->getNodeType;
> > >     return _reinterpret_cast('XML::Xerces::DOM_Text', $_[0])
> > 
> > this is a great idea, but how the heck do i resolve the type of Grammar
> > Class?
> > 
> > note that in the example that you provide, you are blessed with the
> > function getNodeType, because you are working with a DOM.
> > 
> > suggestions? wild ass guesses?
> > 
> > here's the 2 implementations sucked outta my Xerces.pm
> > 
> > ############# Class : XML::Xerces::Grammar ##############
> > 
> > package XML::Xerces::Grammar;
> > @ISA = qw( XML::Xerces );
> > %OWNER = ();
> > %ITERATORS = ();
> > *DTDGrammarType = *XML::Xercesc::Grammar_DTDGrammarType;
> > *SchemaGrammarType = *XML::Xercesc::Grammar_SchemaGrammarType;
> > *UNKNOWN_SCOPE = *XML::Xercesc::Grammar_UNKNOWN_SCOPE;
> > *TOP_LEVEL_SCOPE = *XML::Xercesc::Grammar_TOP_LEVEL_SCOPE;
> > 
> > *getGrammarType = *XML::Xercesc::Grammar_getGrammarType;
> > *getTargetNamespace = *XML::Xercesc::Grammar_getTargetNamespace;
> > sub findOrAddElemDecl {
> >     my @args = @_;
> >     my $result = XML::Xercesc::Grammar_findOrAddElemDecl(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *getElemId = *XML::Xercesc::Grammar_getElemId;
> > sub getElemDecl {
> >     my @args = @_;
> >     my $result = XML::Xercesc::Grammar_getElemDecl(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *getNotationDecl = *XML::Xercesc::Grammar_getNotationDecl;
> > sub putElemDecl {
> >     my @args = @_;
> >     my $result = XML::Xercesc::Grammar_putElemDecl(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *putNotationDecl = *XML::Xercesc::Grammar_putNotationDecl;
> > *reset = *XML::Xercesc::Grammar_reset;
> > 
> > 
> > ############# Class : XML::Xerces::SchemaGrammar ##############
> > 
> > package XML::Xerces::SchemaGrammar;
> > @ISA = qw( XML::Xerces XML::Xerces::Grammar );
> > %OWNER = ();
> > %ITERATORS = ();
> > sub new {
> >     my $pkg = shift;
> >     my @args = @_;
> >     my $self = XML::Xercesc::new_SchemaGrammar(@args);
> >     return undef if (!defined($self));
> >     bless $self, "XML::Xerces::SchemaGrammar";
> >     $OWNER{$self} = 1;
> >     my %retval;
> >     tie %retval, "XML::Xerces::SchemaGrammar", $self;
> >     return bless \%retval, $pkg;
> > }
> > 
> > 
> > *getGrammarType = *XML::Xercesc::SchemaGrammar_getGrammarType;
> > *getTargetNamespace = *XML::Xercesc::SchemaGrammar_getTargetNamespace;
> > sub findOrAddElemDecl {
> >     my @args = @_;
> >     my $result = XML::Xercesc::SchemaGrammar_findOrAddElemDecl(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *getElemId = *XML::Xercesc::SchemaGrammar_getElemId;
> > sub getElemDecl {
> >     my @args = @_;
> >     my $result = XML::Xercesc::SchemaGrammar_getElemDecl(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *getNotationDecl = *XML::Xercesc::SchemaGrammar_getNotationDecl;
> > sub putElemDecl {
> >     my @args = @_;
> >     my $result = XML::Xercesc::SchemaGrammar_putElemDecl(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *putNotationDecl = *XML::Xercesc::SchemaGrammar_putNotationDecl;
> > *reset = *XML::Xercesc::SchemaGrammar_reset;
> > *getElemEnumerator = *XML::Xercesc::SchemaGrammar_getElemEnumerator;
> > *getAttributeDeclRegistry =
> > *XML::Xercesc::SchemaGrammar_getAttributeDeclRegistry;
> > *getComplexTypeRegistry =
> > *XML::Xercesc::SchemaGrammar_getComplexTypeRegistry;
> > *getGroupInfoRegistry = *XML::Xercesc::SchemaGrammar_getGroupInfoRegistry;
> > *getAttGroupInfoRegistry =
> > *XML::Xercesc::SchemaGrammar_getAttGroupInfoRegistry;
> > sub getDatatypeRegistry {
> >     my @args = @_;
> >     my $result = XML::Xercesc::SchemaGrammar_getDatatypeRegistry(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > sub getNamespaceScope {
> >     my @args = @_;
> >     my $result = XML::Xercesc::SchemaGrammar_getNamespaceScope(@args);
> >     return $result unless ref($result) =~ m[XML::Xerces];
> >     my %resulthash;
> >     tie %resulthash, ref($result), $result;
> >     return bless \%resulthash, ref($result);
> > }
> > *getValidSubstitutionGroups =
> > *XML::Xercesc::SchemaGrammar_getValidSubstitutionGroups;
> > *getIDRefList = *XML::Xercesc::SchemaGrammar_getIDRefList;
> > *getUPAChecked = *XML::Xercesc::SchemaGrammar_getUPAChecked;
> > *setTargetNamespace = *XML::Xercesc::SchemaGrammar_setTargetNamespace;
> > *setAttributeDeclRegistry =
> > *XML::Xercesc::SchemaGrammar_setAttributeDeclRegistry;
> > *setComplexTypeRegistry =
> > *XML::Xercesc::SchemaGrammar_setComplexTypeRegistry;
> > *setGroupInfoRegistry = *XML::Xercesc::SchemaGrammar_setGroupInfoRegistry;
> > *setAttGroupInfoRegistry =
> > *XML::Xercesc::SchemaGrammar_setAttGroupInfoRegistry;
> > *setDatatypeRegistry = *XML::Xercesc::SchemaGrammar_setDatatypeRegistry;
> > *setNamespaceScope = *XML::Xercesc::SchemaGrammar_setNamespaceScope;
> > *setValidSubstitutionGroups =
> > *XML::Xercesc::SchemaGrammar_setValidSubstitutionGroups;
> > *setUPAChecked = *XML::Xercesc::SchemaGrammar_setUPAChecked;
> > *putGroupElemDecl = *XML::Xercesc::SchemaGrammar_putGroupElemDecl;
> > 
> >  
> > > jas.
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 


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

Reply via email to