Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xsdfetch utility #35

Open
droyo opened this issue Oct 20, 2017 · 0 comments
Open

xsdfetch utility #35

droyo opened this issue Oct 20, 2017 · 0 comments

Comments

@droyo
Copy link
Owner

droyo commented Oct 20, 2017

Some XML schema, such as http://schema.bolagsverket.se/extern/foretagsinformation/F5_Rakenskapsinformation_2.00.xsd , make heavy use of imports. Add a tool, xsdfetch,
that can be used to retrieve all the schema imported by a target schema.

Example usage:

xsdfetch url
xsdfetch filename

Some notes:

  • Oftentimes the schemaLocation field can be relative. In that case, we should treat it as relative to the targetNamespace of the main schema. If that file is not found, we can then consider it relative to the URL of the main file (if we are fetching via URL).
  • Many <import> statements do not contain a schemaLocation. One heuristic to find the schema file, in that case, is to append .xsd to the schema's name space.
  • Some name spaces are not URLs. In that case, if there is no schemaLocation, there's not much we can do.
  • Should handle <import> and <include>.
  • Should fetch dependent schema, and dependencies of their dependencies, and so on.

All schema should be downloaded to the current directory, using path.Base(targetNS) + ".xsd" as the file name, if unique.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant