Comments (6)
This is certainly a bug. Looking at SubDeedType
in DeedV2.xsd, I see this:
<xs:complexType name="SubDeedType">
<xs:sequence>
<xs:element ref="f:UIC" minOccurs="0" maxOccurs="unbounded">
...
and the element being referenced is element UIC
in FieldsSchema.xsd
<xs:element name="UIC" >
<xs:complexType>
<xs:sequence>
<xs:element name="CompanyControl" type="xs:string" minOccurs="1" maxOccurs="1" />
...
The xsd
package tries to simplify schema by flattening references, like those in SubDeedType
, and by naming anonymous types like the one in the UIC
element. The documents are much easier to parse & generate code for when there are no references and all types have a name.
You can see this 'simplification' using the aqwari.net/xml/cmd/xsdparse
tool. Here's a bit of what it transforms the SubDeedType
into:
<xs:complexType name="SubDeedType">
<xs:complexContent>
<xs:restriction base="xs:anyType">
<xs:sequence>
<xs:element name="UIC" type="_anon148" minOccurs="0" maxOccurs="unbounded" ...
Can you spot the error? _anon148
is not in DeedV2's namespace, it's in FieldsSchema. It should be
<xs:element name="UIC" type="f:_anon148" minOccurs="0" maxOccurs="unbounded" ...
from go-xml.
After reviewing the code, the bug is in the flattenRef function; when copying a reference to an object in another namespace, it fails to qualify any names contained within.
from go-xml.
I took a look at the flattenRef function, tried to check where this bug could be, but I couldn't find it. Probably, because even after reading the code, logging things, I still don't get completely what's going on.
from go-xml.
I should have time to look at this on the weekend. I believe the error is not handling attributes such as "type"
, which can contain a QName, here.
from go-xml.
I've added a test that reproduces the issue in a much smaller example, in the import-type-from-otherns branch.
from go-xml.
Thanks for waiting @arjanvaneersel , I ran the command you provided after merging #66 and it produces output now. Please reopen if the issue isn't fixed for you.
from go-xml.
Related Issues (20)
- Add "Code generated ..." comment line automatically HOT 1
- Allow wsdlgen to take build tags HOT 2
- xsdgen: gen type "measResults": Unknown built-in type "anySimpleType" HOT 6
- Timezone is not considered in MarshalText method HOT 4
- Schema with restriction and base="xsd:dateTime" HOT 1
- Unable to unmarshal embedded xhtml HOT 3
- could not find base type anySimpleType in namespace http://www.w3.org/2001/XMLSchema HOT 3
- Cannot use non-namespaced (but included) types in schema HOT 4
- complexType DetailedHashSum: could not find type "BinaryDataType" in namespace http://service.ddex.net/xml/avs/avs for element DataType HOT 3
- complexType localElement: could not find type in namespace for attribute substitutionGroup HOT 11
- utf-8 name in xsd HOT 3
- Issue with `type="xsd:date" maxOccurs="unbounded"` HOT 1
- Failed to parse chardata. HOT 2
- Element ref not generating and linking types correctly. HOT 3
- question about walking the xsd HOT 3
- Does not generate code HOT 1
- Tests generated for `gentests/books/books_test.go` do not pass
- replace rule not working to create shared types
- aqwari.net is down HOT 1
- xsdgen problem with string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-xml.