Can't import single file into different namespaces
If same file is imported to different namespaces schema is imported only once. Example:
<xs:import namespace="urn:my:space" schemaLocation="coreschemas/datatypes.xsd"/>
<xs:import namespace="urn:my:other" schemaLocation="coreschemas/datatypes.xsd"/>
Possible solution (?): In SchemaReader.php add namespace, like:
if (isset($this->loadedFiles[$schema->getTargetNamespace() . $file])) {
$schema->addSchema($this->loadedFiles[$schema->getTargetNamespace() . $file]);
Same in setter.
Hi, thanks for starting this conversation.
Can you please create a pull request with the suggested solution?
Sure. I figured it's an xsd-reader package thing (sorry for mess).
I did changes, but unfortunately it doesn't pass your tests.
Probably my knowledge of XML is not enough, but explain to me if you can this test:
<xs:import schemaLocation="http://www.example.com/xsd.xsd" namespace="http://www.example.com"></xs:import>
How reader in this test can read schema from given location (http://www.example.com/xsd.xsd) ?
How reader in this test can read schema from given location (http://www.example.com/xsd.xsd) ?
https://github.com/goetas-webservices/xsd-reader/blob/e61848111e396e2d0e90664cdea179fdea4c1f45/tests/ImportTest.php#L15
this line is putting in cache a xsd for that url, thus later no http request is needed.
xsd-reader has a sort of aliasing that allows you to declare some schemas locally instead of reading them each time from the network.