Changeset 259
- Timestamp:
- 02/14/07 16:50:20 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/xml/stubXMLXIncludeStreamWrapper.php
r207 r259 35 35 protected static $cachePath; 36 36 /** 37 * include path to use if file not found in current path 38 * 39 * @var string 40 */ 41 protected static $includePath; 42 /** 37 43 * current xml file 38 44 * … … 87 93 /** 88 94 * sets the cache path to use 95 * 96 * @param string $cachePath 89 97 */ 90 98 public static function setCachePath($cachePath) 91 99 { 92 100 self::$cachePath = $cachePath; 101 if (file_exists($cachePath . '/xml') == false) { 102 mkdir($cachePath . '/xml', 0700, true); 103 } 104 } 105 106 /** 107 * sets the include path to use 108 * 109 * @param string $includePath 110 */ 111 public static function setIncludePath($includePath) 112 { 113 self::$includePath = $includePath; 93 114 } 94 115 … … 106 127 $this->parsePath($path); 107 128 if (file_exists($this->fileName) == false) { 108 return false; 129 if (file_exists(self::$includePath . '/' . $this->fileName) == false) { 130 return false; 131 } 132 133 $this->fileName = self::$includePath . '/' . $this->fileName; 109 134 } 110 135 … … 170 195 protected function appendError(DOMDocument $resultDoc, $level, $message) 171 196 { 172 $element = $resultDoc->createElement(' stub:error', ucfirst($level) . ': ' . $message);173 $element->setAttribute(' stub:errorType', $level);197 $element = $resultDoc->createElement('error', ucfirst($level) . ': ' . $message); 198 $element->setAttribute('errorType', $level); 174 199 if (null != $this->part && strlen($this->part) > 0) { 175 200 $xpath = new DOMXPath($resultDoc); 176 201 $entry = $xpath->query("/parts/part[@name='" . $this->part ."']")->item(0); 177 $entry->appendChild($element); 202 if (null !== $entry) { 203 $entry->appendChild($element); 204 } else { 205 $resultDoc->documentElement->appendChild($element); 206 } 178 207 } else { 179 208 $resultDoc->documentElement->appendChild($element);
