Changeset 1926

Show
Ignore:
Timestamp:
05/11/07 13:05:39 (20 months ago)
Author:
david
Message:

fixed undef var errors, added code for removal of xml:base attributes again, refs #519

Location:
branches/david-xml_config_handlers/src/config
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/david-xml_config_handlers/src/config/AgaviIXmlConfigHandler.interface.php

    r1924 r1926  
    5959   * @since      0.11.0 
    6060   */ 
    61   public function execute(array $array = array()); 
     61  public function execute(array $docs = array()); 
    6262} 
    6363 
  • branches/david-xml_config_handlers/src/config/AgaviXmlConfigParser.class.php

    r1923 r1926  
    4040   
    4141  /** 
     42   * @var        string The path to the config file we're currently parsing. 
     43   */ 
     44  protected $config = ''; 
     45   
     46  /** 
    4247   * @param      string An absolute filesystem path to a configuration file. 
    4348   * @param      array  An associative array of validation information. 
     
    133138  public function load($config) 
    134139  { 
     140    $this->config = $config; 
     141     
    135142    $luie = libxml_use_internal_errors(true); 
    136143    libxml_clear_errors(); 
     
    186193        ); 
    187194      } 
     195    } 
     196     
     197    $xpath = $this->createXpath($doc); 
     198    // remove all xml:base attributes inserted by XIncludes 
     199    $nodes = $xpath->query('//@xml:base', $doc); 
     200    foreach($nodes as $node) { 
     201      $node->ownerElement->removeAttributeNode($node); 
    188202    } 
    189203     
     
    241255                sprintf( 
    242256                  'Configuration file "%s" could not be parsed due to the following error%s that occured while loading the specified XSL stylesheet "%s": ' . "\n\n%s",  
    243                   $config,  
     257                  $this->config,  
    244258                  count($errors) > 1 ? 's' : '',  
    245259                  $href, 
     
    252266              sprintf( 
    253267                'Configuration file "%s" could not be parsed because the inline stylesheet "%s" referenced in the "xml-stylesheet" processing instruction could not be found in the document.',  
    254                 $config,  
     268                $this->config,  
    255269                $href 
    256270              ) 
     
    271285              sprintf( 
    272286                'Configuration file "%s" could not be parsed due to the following error%s that occured while loading the specified XSL stylesheet "%s": ' . "\n\n%s",  
    273                 $config,  
     287                $this->config,  
    274288                count($errors) > 1 ? 's' : '',  
    275289                $href, 
     
    294308            sprintf( 
    295309              'Configuration file "%s" could not be parsed due to the following error%s that occured while importing the specified XSL stylesheet "%s": ' . "\n\n%s",  
    296               $config,  
     310              $this->config,  
    297311              count($errors) > 1 ? 's' : '',  
    298312              $href, 
     
    316330            sprintf( 
    317331              'Configuration file "%s" could not be parsed due to the following error%s that occured while transforming the document using the XSL stylesheet "%s": ' . "\n\n%s",  
    318               $config,  
     332              $this->config,  
    319333              count($errors) > 1 ? 's' : '',  
    320334              $href, 
     
    402416      if(!is_readable($validationFile)) { 
    403417        libxml_use_internal_errors($luie); 
    404         $error = 'Validation file "' . $validationFile . '" for configuration file "' . $config . '" does not exist or is unreadable'; 
     418        $error = 'Validation file "' . $validationFile . '" for configuration file "' . $this->config . '" does not exist or is unreadable'; 
    405419        throw new AgaviUnreadableException($error); 
    406420      } 
     
    416430          sprintf( 
    417431            'XML Schema validation of configuration file "%s" failed due to the following error%s: ' . "\n\n%s",  
    418             $config,  
     432            $this->config,  
    419433            count($errors) > 1 ? 's' : '',  
    420434            implode("\n", $errors) 
     
    443457      if(!is_readable($validationFile)) { 
    444458        libxml_use_internal_errors($luie); 
    445         $error = 'Validation file "' . $validationFile . '" for configuration file "' . $config . '" does not exist or is unreadable'; 
     459        $error = 'Validation file "' . $validationFile . '" for configuration file "' . $this->config . '" does not exist or is unreadable'; 
    446460        throw new AgaviUnreadableException($error); 
    447461      } 
     
    457471          sprintf( 
    458472            'XML Schema validation of configuration file "%s" failed due to the following error%s: ' . "\n\n%s",  
    459             $config,  
     473            $this->config,  
    460474            count($errors) > 1 ? 's' : '',  
    461475            implode("\n", $errors) 
     
    487501      if(!is_readable($validationFile)) { 
    488502        libxml_use_internal_errors($luie); 
    489         $error = 'Validation file "' . $validationFile . '" for configuration file "' . $config . '" does not exist or is unreadable'; 
     503        $error = 'Validation file "' . $validationFile . '" for configuration file "' . $this->config . '" does not exist or is unreadable'; 
    490504        throw new AgaviUnreadableException($error); 
    491505      } 
     
    501515          sprintf( 
    502516            'XML Schema validation of configuration file "%s" failed due to the following error%s: ' . "\n\n%s",  
    503             $config,  
     517            $this->config,  
    504518            count($errors) > 1 ? 's' : '',  
    505519            implode("\n", $errors)