mibes404 / zeep

XSD/WSDL client code generator for Rust
MIT License
41 stars 18 forks source link

Error openning file "No such file or directory" #2

Closed mlevkov closed 4 years ago

mlevkov commented 4 years ago

Hello, I've tried to use your tool to generate the XML parser for the attached XSD. However, irrespective of where the file is located, it is telling me that: Failed to process DASH-MPD.xsd: writer error: No such file or directory (os error 2)

I used the following command: ./zeep -p . -i DASH-MPD.xsd -o ./zeep_generated_dash.xml

I even tried a full path, to no avail. Pardon for a silly question, is this a bug or a human error?

I've attached the file for your use.

Note: rename from .xsd.txt to .xsd to use it. DASH-MPD.xsd.txt

Thank you, Max

horacimacias commented 4 years ago

the problem seems to be related to the xlink.xsd file included in your xsd:

<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlink.xsd"/>

can you try putting that file in the same path you're running this on?

horacimacias commented 4 years ago

Using the PR, the output should then be:

Failed to process DASH-MPD.xsd: writer error: Unable to read file ./xlink.xsd: No such file or directory (os error 2)

hopefully that helps troubleshoot faster.

mlevkov commented 4 years ago

Thank you for the change. However, it appears that the issue is presenting a new message now, though a more informative than before. Command line: ./target/release/zeep -p resources/dash -i dash.xsd -o examples/dash/dash.rs

parsing resources/dash/dash.xsd --> examples/dash/dash.rs
Failed to process dash.xsd: writer error: Unable to read file resources/dash/http://www.w3.org/2001/xml.xsd: No such file or directory (os error 2)
mlevkov commented 4 years ago

thanks to your added message detail, I've been able to find the culprit. The issue was with the schemaLocation attribute. It was pointing to the web resource, hence the code took that and attempted to locate the resource. I would, perhaps, recommend trying to obtain the resource from the HTTP location if that is possible. However, I've obtained the resource myself, placed it in the same folder where everything else for my source was and it was able to complete the process successfully.

horacimacias commented 4 years ago

thanks for the feedback. I've updated the PR to also include retrieving files over http or https if the location starts with "http://" or "https://"

mlevkov commented 4 years ago

great, thank you