/** * @param string $request * @param array $args */ public function fix_xml($request, $args) { $request_dom = XML::Loader()->load($request); $xpath = new DOMXPath($request_dom); $arguments_dom_node = $xpath->query("//*[local-name()='Envelope']/*[local-name()='Body']/*")->item(0); $this->fix_xml_node($arguments_dom_node, $args[0], $xpath); if (version_compare(PHP_VERSION, '5.2.3', '<')) { $this->remove_empty_header_elements($xpath); } return $request_dom->saveXML(); }
/** * @param boolean $reload * * @return Dev_Source_Module */ protected function load($reload = false) { if (!$this->xml || $reload) { $is_cdata = false; $text = ''; $is_ignore = false; foreach ($this->file->open('r')->text() as $line) { if (preg_match('{^///\\s+<ignore>}', $line)) { $is_ignore = true; } if (preg_match('{^///\\s+</ignore>}', $line)) { $is_ignore = false; $text .= "\n"; continue; } if (preg_match('{^\\s*$|^<\\?php|^\\?>}', $line) || $is_ignore) { $text .= "\n"; continue; } if (preg_match('{^///(.*)$}', $line, $m)) { $text .= ($is_cdata ? "]]>\n" : '') . $m[1] . "\n"; $is_cdata = false; } else { if ($is_cdata) { $text .= "\n" . rtrim($line); } else { $text .= '<![CDATA[' . rtrim($line); $is_cdata = true; } } } if (!($this->xml = Core::with($loader = XML::Loader())->load($text))) { throw new Dev_Source_InvalidSourceException($this->name, $text, $loader->errors); } } return $this->xml; }