Changeset 98
- Timestamp:
- 03/29/07 22:10:40 (2 years ago)
- Files:
-
- trunk/XJConf/DefinitionParser.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/XJConf/DefinitionParser.php
r94 r98 32 32 */ 33 33 const TAG_NAMESPACE = 'namespace'; 34 /**34 /** 35 35 * stack for currently open definitions 36 36 * … … 135 135 public function hasClassLoader($namespace) 136 136 { 137 return (isset($this->classLoaders[$namespace]) );137 return (isset($this->classLoaders[$namespace]) == true || isset($this->classLoaders['__default']) == true); 138 138 } 139 139 … … 146 146 public function getClassLoader($namespace) 147 147 { 148 149 if ($this->hasClassLoader($namespace) == true) { 148 if (isset($this->classLoaders[$namespace]) == true) { 150 149 return $this->classLoaders[$namespace]; 150 } 151 152 if (isset($this->classLoaders['__default']) == true) { 153 return $this->classLoaders['__default']; 151 154 } 152 155 … … 185 188 { 186 189 $this->initParser(); 187 $this->reader->open($filename);190 $this->reader->open($filename); 188 191 while ($this->reader->read()) { 189 192 switch ($this->reader->nodeType) { … … 194 197 $empty = $this->reader->isEmptyElement; 195 198 if (TRUE == $this->reader->hasAttributes) { 196 // go to first attribute197 $attribute = $this->reader->moveToFirstAttribute();198 // save data of all attributes199 while (TRUE == $attribute) {200 $attributes[$this->reader->localName] = $this->reader->value;201 $attribute = $this->reader->moveToNextAttribute();202 }203 }199 // go to first attribute 200 $attribute = $this->reader->moveToFirstAttribute(); 201 // save data of all attributes 202 while (TRUE == $attribute) { 203 $attributes[$this->reader->localName] = $this->reader->value; 204 $attribute = $this->reader->moveToNextAttribute(); 205 } 206 } 204 207 $this->startElement($nameSpaceURI, $elementName, $attributes); 205 208 if (true === $empty) { … … 238 241 // a new namespace 239 242 if (self::TAG_NAMESPACE == $sName) { 240 if (isset($atts['uri']) == false) {241 throw new InvalidNamespaceDefinitionException('The <' . self::TAG_NAMESPACE . '> tag is missing the uri attribute.');243 if (isset($atts['uri']) == false) { 244 throw new InvalidNamespaceDefinitionException('The <' . self::TAG_NAMESPACE . '> tag is missing the uri attribute.'); 242 245 } 243 246 244 247 // change current namespace to new namespace 245 248 $this->currentNamespace = $atts['uri']; 246 return;249 return; 247 250 } 248 251 … … 256 259 257 260 array_push($this->defHandlerStack, $defHandler); 258 }261 } 259 262 260 263 /**
