Giter VIP home page Giter VIP logo

Comments (5)

isimluk avatar isimluk commented on August 23, 2024 1

I am not entirely sure, but this could be an easy fix. At least a very brief look at the code suggests that.

We cache XSD files we already read

if cache {
ws.Cache[xsdPath] = schema
}

and few lines below we load all the imports of the current file:

if err := si.load(ws, dir); err != nil {
return nil, err
}

Potentially we just need to wrap this si.load() call with an if that will ensure not to load schemas that have been already loaded.

Not sure however, if the compilation of the xsd schemas won't fail later on. Would you like to explore this and propose a patch?

Thanks!

from xsd2go.

dratasich avatar dratasich commented on August 23, 2024 1

I think the sub-schemas are then missing in the workspace, leading to missing types. I will try to remove the recursion and collect all imports - split parse and compile.

from xsd2go.

isimluk avatar isimluk commented on August 23, 2024

Hello @dratasich,

Your analysis seems to be correct. There is circular dependency in these XSD files and current codebase does not account for such case.

from xsd2go.

dratasich avatar dratasich commented on August 23, 2024

Cool, thanks @isimluk for pointing out the responsible code parts.

With

	for idx := range schema.Imports {
		childXsdPath := filepath.Join(dir, schema.Imports[idx].SchemaLocation)
		_, found := ws.Cache[childXsdPath]
		if found {
			continue
		}
		if err := schema.Imports[idx].load(ws, dir); err != nil {
			return nil, err
		}
	}

I could avoid the stack overflow - thanks again!
Unfortunately I still have an error, so I have to check if its a model error (my guess) or if I miss a type due to this change.

./gocomply_xsd2go convert ~/repos/parkandride-api/gen/3.4/DATEXII_3_LocationReferencing.xsd datex3 .
Processing '/home/denise/repos/parkandride-api/gen/3.4/DATEXII_3_LocationReferencing.xsd'
	Parsing: /home/denise/repos/parkandride-api/gen/3.4/DATEXII_3_LocationReferencing.xsd
	Parsing: /home/denise/repos/parkandride-api/gen/3.4/DATEXII_3_LocationReferencing.xsd
	Parsing: /home/denise/repos/parkandride-api/gen/3.4/DATEXII_3_Common.xsd
panic: Cannot resolve type reference: com:Boolean

from xsd2go.

dratasich avatar dratasich commented on August 23, 2024

I succeeded to generate Go code with xgen -l Go (and Java code with jaxb with a bindings.xml / config).

To cope with circular imports I think it would need a bigger restructuring/rewriting in the xsd/workspace.go file.
So I will close this issue here.

from xsd2go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.