jasons      2002/08/27 12:42:56

  Modified:    perl     postModule.pl
  Log:
        * postModule.pl (Repository):
        DOM_ => DOM
        DOMParser => XercesDOMParser
  
  Revision  Changes    Path
  1.28      +40 -40    xml-xerces/perl/postModule.pl
  
  Index: postModule.pl
  ===================================================================
  RCS file: /home/cvs/xml-xerces/perl/postModule.pl,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- postModule.pl     25 Apr 2002 01:55:33 -0000      1.27
  +++ postModule.pl     27 Aug 2002 19:42:56 -0000      1.28
  @@ -5,20 +5,20 @@
   
   my($progname) = $0 =~ m"\/([^/]*)";
   
  -my @dom_node_list_methods = qw(DOM_Document::getElementsByTagName
  -                         DOM_Document::getElementsByTagNameNS
  -                         DOM_Element::getElementsByTagName
  -                         DOM_Element::getElementsByTagNameNS
  -                         DOM_Node::getChildNodes
  +my @domnode_list_methods = qw(DOMDocument::getElementsByTagName
  +                         DOMDocument::getElementsByTagNameNS
  +                         DOMElement::getElementsByTagName
  +                         DOMElement::getElementsByTagNameNS
  +                         DOMNode::getChildNodes
                            );
   
  -my @dom_node_map_methods = qw(DOM_DocumentType::getEntities
  -                         DOM_DocumentType::getNotations
  -                         DOM_Node::getAttributes
  +my @domnode_map_methods = qw(DOMDocumentType::getEntities
  +                         DOMDocumentType::getNotations
  +                         DOMNode::getAttributes
                            );
   
  -my @dom_copy_methods = qw(DOM_XMLDecl
  -                       DOM_Attr
  +my @domcopy_methods = qw(DOMXMLDecl
  +                       DOMAttr
                         );
   
   my %VARS;
  @@ -58,7 +58,7 @@
       # we're only keeping DESTROY for the parsers until we know better
       # we get core dumps if it's defined on some classes
       if (/sub DESTROY/) {
  -      unless (grep {$_ eq $CURR_CLASS} qw(DOMParser
  +      unless (grep {$_ eq $CURR_CLASS} qw(XercesDOMParser
                                          SAXParser
                                          SAX2XMLReader))
         {
  @@ -70,7 +70,7 @@
                   "    return unless defined \$self;\n",
                   1);
         }
  -      if ($CURR_CLASS eq 'DOM_Document') {
  +      if ($CURR_CLASS eq 'DOMDocument') {
        print TEMP <<'EOT';
   sub DESTROY {
       my $self = shift;
  @@ -84,8 +84,8 @@
         next;
       }
   
  -    # we remove all the enums inherited through DOM_Node
  -    next if /^*[_A-Z]+_NODE =/ && !/DOM_Node/;
  +    # we remove all the enums inherited through DOMNode
  +    next if /^*[_A-Z]+_NODE =/ && !/DOMNode/;
   
       # now we set these aliases correctly
       s/\*XML::Xerces::/*XML::Xercesc::/;
  @@ -112,26 +112,26 @@
       # split on multiple lines to be readable, using s{}{}x
       s{
         return\s*undef\s*if\s*\(\!defined\(\$result\)\)
  -     }{return \$result unless ref(\$result) =~ m[XML::Xerces]}x;
  +     }{return \$result unless UNIVERSAL::isa(\$result,'XML::Xerces')}x;
   
       #######################################################################
       #
       # Perl API specific changes
       #
   
  -    #   DOM_NodeList: automatically convert to perl list
  +    #   DOMNodeList: automatically convert to perl list
       #      if called in a list context
  -    if (grep {/$CURR_CLASS/} @dom_node_list_methods) {
  +    if (grep {/$CURR_CLASS/} @domnode_list_methods) {
         if (my ($sub) = /^sub\s+([\w_]+)/) {
        $sub = "$ {CURR_CLASS}::$sub";
  -     if (grep {/$sub$/} @dom_node_list_methods) {
  +     if (grep {/$sub$/} @domnode_list_methods) {
          my $fix = <<'EOT';
       unless (defined $result) {
         return () if wantarray;
         return undef; # if *not* wantarray
       }
       return $result->to_list() if wantarray;
  -    $DOM_NodeList::OWNER{$result} = 1; 
  +    $DOMNodeList::OWNER{$result} = 1; 
   EOT
          fix_method(\*FILE,
                     \*TEMP,
  @@ -143,19 +143,19 @@
         }
       }
   
  -    #   DOM_NamedNodeMap: automatically convert to perl hash
  +    #   DOMNamedNodeMap: automatically convert to perl hash
       #      if called in a list context
  -    if (grep {/$CURR_CLASS/} @dom_node_map_methods) {
  +    if (grep {/$CURR_CLASS/} @domnode_map_methods) {
         if (my ($sub) = /^sub\s+([\w_]+)/) {
        $sub = "$ {CURR_CLASS}::$sub";
  -     if (grep {/$sub$/} @dom_node_map_methods) {
  +     if (grep {/$sub$/} @domnode_map_methods) {
          my $fix = <<'EOT';
       unless (defined $result) {
         return () if wantarray;
         return undef; # if *not* wantarray
       }
       return $result->to_hash() if wantarray;
  -    $DOM_NamedNodeMap::OWNER{$result} = 1;
  +    $DOMNamedNodeMap::OWNER{$result} = 1;
   EOT
          fix_method(\*FILE,
                     \*TEMP,
  @@ -187,15 +187,15 @@
   
       # we need to fix setAttribute() so that undefined values don't
       # cause a core dump
  -    if ($CURR_CLASS =~ /DOM_Element/) {
  -      if (/XML::Xercesc::DOM_Element_setAttribute;/) {
  +    if ($CURR_CLASS =~ /DOMElement/) {
  +      if (/XML::Xercesc::DOMElement_setAttribute;/) {
        print TEMP <<"EOT";
   sub setAttribute {
       my (\$self,\$attr,\$val) = \@_;
       return unless defined \$attr and defined \$val;
  -    my \$result = XML::Xercesc::DOM_Element_setAttribute(\@_);
  +    my \$result = XML::Xercesc::DOMElement_setAttribute(\@_);
       return \$result unless ref(\$result) =~ m[XML::Xerces];
  -    \$XML::Xerces::DOM_Attr::OWNER{\$result} = 1; 
  +    \$XML::Xerces::DOMAttr::OWNER{\$result} = 1; 
       my %resulthash;
       tie %resulthash, ref(\$result), \$result;
       return bless \\\%resulthash, ref(\$result);
  @@ -212,7 +212,7 @@
       # don't print out SWIG's default overloaded methods, we'll make our own
       next if /XML::Xerces.*__overload__/;
   
  -    if ($CURR_CLASS =~ /(DOMParser|SAXParser)/) {
  +    if ($CURR_CLASS =~ /(AbstractDOMParser|SAXParser)/) {
         my $parser = $1;
         if (/XML::Xercesc::${parser}_parse;/) {
        print TEMP <<"EOT";
  @@ -371,7 +371,7 @@
         }
       }
   
  -    if (grep {/$CURR_CLASS/} @dom_copy_methods) {
  +    if (grep {/$CURR_CLASS/} @domcopy_methods) {
         if (/^sub.*__constructor__/) {
        remove_method(\*FILE);
        next;
  @@ -514,7 +514,7 @@
         }
       }
   
  -    if ($CURR_CLASS =~ /DOM_DOMException/) {
  +    if ($CURR_CLASS =~ /DOMDOMException/) {
         if (/^sub\s+new/) {
        # add the reverse name lookup for the error codes
        print TEMP <<'EOT';
  @@ -643,16 +643,16 @@
         next;
       }
   
  -    if ($CURR_CLASS eq 'DOM_Document') {
  +    if ($CURR_CLASS eq 'DOMDocument') {
         if (/^sub\s+createTreeWalker/) {
        my $fix = <<'EOT';
       my ($self,$root,$what,$filter,$expand) = @_;
  -    my $callback = $XML::Xerces::DOM_TreeWalker::OWNER{$self}->{__NODE_FILTER};
  +    my $callback = $XML::Xerces::DOMTreeWalker::OWNER{$self}->{__NODE_FILTER};
       if (defined $callback) {
         $callback->set_callback_obj($filter);
       } else {
         $callback = XML::Xerces::PerlNodeFilterCallbackHandler->new($filter);
  -      $XML::Xerces::DOM_TreeWalker::OWNER{$self}->{__NODE_FILTER} = $callback;
  +      $XML::Xerces::DOMTreeWalker::OWNER{$self}->{__NODE_FILTER} = $callback;
       }
       my @args = ($self,$root,$what,$callback,$expand);
   EOT
  @@ -665,16 +665,16 @@
         }
       }
   
  -    if ($CURR_CLASS eq 'DOM_Document') {
  +    if ($CURR_CLASS eq 'DOMDocument') {
         if (/^sub\s+createNodeIterator/) {
        my $fix = <<'EOT';
       my ($self,$root,$what,$filter,$expand) = @_;
  -    my $callback = $XML::Xerces::DOM_NodeIterator::OWNER{$self}->{__NODE_FILTER};
  +    my $callback = $XML::Xerces::DOMNodeIterator::OWNER{$self}->{__NODE_FILTER};
       if (defined $callback) {
         $callback->set_callback_obj($filter);
       } else {
         $callback = XML::Xerces::PerlNodeFilterCallbackHandler->new($filter);
  -      $XML::Xerces::DOM_NodeIterator::OWNER{$self}->{__NODE_FILTER} = $callback;
  +      $XML::Xerces::DOMNodeIterator::OWNER{$self}->{__NODE_FILTER} = $callback;
       }
       my @args = ($self,$root,$what,$callback,$expand);
   EOT
  @@ -687,15 +687,15 @@
         }
       }
   
  -    # look for: *getDocument = *XML::Xercesc::*_getDocument;
  -    if (/\*XML::Xercesc::DOMParser_getDocument/) {
  +    # fix the issue that deleting a parser deletes the document
  +    if (/\*XML::Xercesc::AbstractDOMParser_getDocument/) {
         print TEMP <<'EOT';
   # hold a reference to the parser internally, so that the
   # document can exist after the parser has gone out of scope
   sub getDocument {
     my ($self) = @_;
  -  my $result = XML::Xercesc::DOMParser_getDocument($self);
  -  $XML::Xerces::DOM_Document::OWNER{$result}->{__PARSER} = $self;
  +  my $result = XML::Xercesc::AbstractDOMParser_getDocument($self);
  +  $XML::Xerces::DOMDocument::OWNER{$result}->{__PARSER} = $self;
     return $result;
   }
   EOT
  
  
  

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

Reply via email to