public function __construct(ConfigInterface $config, $xsdUrl)
 {
     $this->url = $xsdUrl;
     // Generate a stream context used by libxml to access external resources.
     // This will allow DOMDocument to load XSDs through a proxy.
     $streamContextFactory = new StreamContextFactory();
     libxml_set_streams_context($streamContextFactory->create($config));
     $document = new DOMDocument();
     $loaded = $document->load($xsdUrl);
     if (!$loaded) {
         throw new Exception('Unable to load XML from ' . $xsdUrl);
     }
     parent::__construct($document, $document->documentElement);
     // Register the schema to avoid cyclic imports.
     self::$loadedUrls[] = $xsdUrl;
     // Locate and instantiate schemas which are referenced by the current schema.
     // A reference in this context can either be
     // - an import from another namespace: http://www.w3.org/TR/xmlschema-1/#composition-schemaImport
     // - an include within the same namespace: http://www.w3.org/TR/xmlschema-1/#compound-schema
     $this->referereces = array();
     foreach ($this->xpath('//wsdl:import/@location|' . '//s:import/@schemaLocation|' . '//s:include/@schemaLocation') as $reference) {
         $referenceUrl = $reference->value;
         if (strpos($referenceUrl, '//') === false) {
             $referenceUrl = dirname($xsdUrl) . '/' . $referenceUrl;
         }
         if (!in_array($referenceUrl, self::$loadedUrls)) {
             $this->referereces[] = new SchemaDocument($config, $referenceUrl);
         }
     }
 }
 public function __construct($xsdUrl)
 {
     $this->url = $xsdUrl;
     $document = new DOMDocument();
     $loaded = $document->load($xsdUrl);
     if (!$loaded) {
         throw new Exception('Unable to load XML from ' . $xsdUrl);
     }
     parent::__construct($document, $document->documentElement);
     // Register the schema to avoid cyclic imports.
     self::$loadedUrls[] = $xsdUrl;
     // Locate and instantiate schemas which are imported by the current schema.
     $this->imports = array();
     foreach ($this->xpath('//wsdl:import/@location|//s:import/@schemaLocation') as $import) {
         $importUrl = $import->value;
         if (strpos($importUrl, '//') === false) {
             $importUrl = dirname($xsdUrl) . '/' . $importUrl;
         }
         if (!in_array($importUrl, self::$loadedUrls)) {
             $this->imports[] = new SchemaDocument($importUrl);
         }
     }
 }