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

Imported XSD files are not supported #8

Open
sotex opened this issue May 27, 2019 · 0 comments
Open

Imported XSD files are not supported #8

sotex opened this issue May 27, 2019 · 0 comments

Comments

@sotex
Copy link

sotex commented May 27, 2019

If the imported XSD file is not a local file, the No such file or directory will be misreported.
I simply modified the parseXSDFile function to satisfy my use. (Not a good modification)

func parseXSDFile(fname string) ([]xsdSchema, error) {
        if fname[0:4] == "http" {
                url := strings.Replace(fname,"http:/","http://",-1)
                url = strings.Replace(url,"https:/","https://",-1)
                res,err := http.Get(url)
                if err != nil {
                        return nil,err
                }
                f,err := os.Create(filepath.Base(fname))
                if err != nil {
                        return nil,err
                }
                defer f.Close()
                io.Copy(f,res.Body)
                fname = filepath.Base(fname)
        }
        f, err := os.Open(fname)
        if err != nil {
                return nil, err
        }
        defer f.Close()

        return parse(f, fname)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant