Skip to content

xsdfetch utility #35

@droyo

Description

@droyo

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions