-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
Description
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 thetargetNamespace
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 aschemaLocation
. 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.