protected function loadElement($name) { $xp = new XPath($this->schemaNode->ownerDocument); $xp->registerNamespace("xsd", self::XSD_NS); $nodes = $xp->query("xsd:element[@name='{$name}']", $this->schemaNode); if ($nodes->length) { $node = $nodes->item(0); if (!$node->hasAttribute("type")) { $type = $this->createAnonymType($node, $node->getAttribute("name")); return new Element($this, $type, $node->getAttribute("name"), 1, 1, false); } else { $elName = $node->getAttribute("name"); $typeName = $node->getAttribute("type"); list($ns, $name, $prefix) = self::findParts($node, $typeName); $type = $this->findType($ns, $name); return new Element($this, $type, $node->getAttribute("name"), 1, 1, false); } } foreach ($this->schemas as $schema) { try { return $schema->getElement($name); } catch (\Exception $e) { } } return false; }
protected function loadWsdl($path) { $xml = $this->getXML($path); $ns = $xml->documentElement->getAttribute("targetNamespace"); $this->parsedWsdl[$ns] = $xml; $xp = new XPath($xml); $xp->registerNamespace("wsdl", self::WSDL_NS); $imports = $xp->query("/wsdl:definitions/wsdl:import[@location]"); foreach ($imports as $import) { $relPath = UrlUtils::resolve_url($path, $import->getAttribute("location")); $ns = $import->getAttribute("namespace"); if (!$this->parsedWsdl[$ns]) { $this->loadWsdl($relPath); } } }