Comments (6)
@isimluk , I had the same problem and managed to create a minimal example:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- definition of simple elements -->
<xs:element name="name" type="xs:string"/>
<!-- definition of complex elements -->
<xs:element name="referencingthename">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Could you have a look at it?
from xsd2go.
Having the same issue with a XSD file that has <xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
and only xs namespace.
from xsd2go.
@mr-kashif, could you please provide all the XSD files for me to reproduce?
from xsd2go.
@isimluk This specification from gaeb (a german standard for b2b communication) triggers the same error.
GAEB_DA_XML_Lib_3.3_2021-05.xsd.txt (renamed to .txt because github does not allow .xsd)
Processing 'GAEB_DA_XML_Lib_3.3_2021-05.xsd'
Parsing: GAEB_DA_XML_Lib_3.3_2021-05.xsd
panic: Internal error: Unknown xmlns prefix:
goroutine 1 [running]:
github.com/gocomply/xsd2go/pkg/xsd.(*Schema).xmlnsByPrefix(...)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/schema.go:111
github.com/gocomply/xsd2go/pkg/xsd.(*Schema).findReferencedSchemaByPrefix(0xc000185560?, {0x0, 0x0})
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/schema.go:105 +0x79
github.com/gocomply/xsd2go/pkg/xsd.(*Schema).findReferencedType(0xc0001bab40, {0xc000185560, 0xa})
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/schema.go:90 +0x8e
github.com/gocomply/xsd2go/pkg/xsd.(*Element).compile(0xc000350000, 0xc000034000?, 0x300000002?)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/element.go:145 +0x1a6
github.com/gocomply/xsd2go/pkg/xsd.(*Sequence).compile(0xc000302850, 0x791be0?, 0x0?)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/sequence.go:21 +0x5d
github.com/gocomply/xsd2go/pkg/xsd.(*ComplexType).compile(0xc00046a000, 0xc0001bab40, 0xc000012180?)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/types.go:106 +0x6d
github.com/gocomply/xsd2go/pkg/xsd.(*Schema).compile(0xc0001bab40)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/schema.go:61 +0x10a
github.com/gocomply/xsd2go/pkg/xsd.(*Workspace).loadXsd(0xc0001b0460, {0xc000012180, 0x1f}, 0x1)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/workspace.go:95 +0xdfa
github.com/gocomply/xsd2go/pkg/xsd.NewWorkspace({0xc000185294, 0x9}, {0xc000012180, 0x1f}, {0x7e6638, 0x0, 0x0})
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd/workspace.go:27 +0xfc
github.com/gocomply/xsd2go/pkg/xsd2go.Convert({0xc000012180, 0x1f}, {0xc00000a0f0, 0x4}, {0xc00000a100, 0x4}, {0x7e6638, 0x0, 0x0})
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/pkg/xsd2go/generate.go:12 +0x15a
github.com/gocomply/xsd2go/cli/cmd.glob..func2(0xc0001c82c0?)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/cli/cmd/cmd.go:44 +0xd1
github.com/urfave/cli.HandleAction({0x505260?, 0x575d50?}, 0x7?)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/vendor/github.com/urfave/cli/app.go:524 +0xa8
github.com/urfave/cli.Command.Run({{0x559143, 0x7}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x56d98c, 0x44}, {0x0, ...}, ...}, ...)
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/vendor/github.com/urfave/cli/command.go:173 +0x652
github.com/urfave/cli.(*App).Run(0xc0001bc380, {0xc000102000, 0x5, 0x8})
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/vendor/github.com/urfave/cli/app.go:277 +0x8a7
github.com/gocomply/xsd2go/cli/cmd.Execute()
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/cli/cmd/cmd.go:21 +0x128
main.main()
C:/Users/xf/Desktop/tmp/gaeb/xsd2go/cli/gocomply_xsd2go/main.go:8 +0x19
from xsd2go.
Yes please to the above comment.
from xsd2go.
The problem occurs when the parser searches a referenced element without a prefix like ref="name"
and then does not find a namespace for it. To resolve it, you can specify a targetNamespace
for your schema like this:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="exampleNamespace">
<!-- definition of simple elements -->
<xs:element name="name" type="xs:string"/>
<!-- definition of complex elements -->
<xs:element name="referencingthename">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
from xsd2go.
Related Issues (20)
- stack overflow when processing schema importing multiple files HOT 5
- add support for xsd:duration
- panic: Type xsd:Name not implemented
- XMLName element has invalid xml tag HOT 2
- panic: Type xsd:unsignedInt not implemented HOT 2
- Handle multiple XSD files? HOT 3
- Add xs:union support
- Type xsd:long is not implemented HOT 2
- Type xsd:integer not implemented HOT 1
- [0.1.4] Generated types incomplete with no errors or warnings HOT 4
- Type xsd:float not implemented HOT 1
- panic: Type xsd:negativeInteger not implemented
- panic: Type xsd:language not implemented
- ISO-8859-1 encoded XSD failes. HOT 2
- Type xsd:IDREF not implemented
- panic: Type xsd:time not implemented HOT 4
- xsd:positiveInteger is not implemented HOT 1
- Cannot resolve type reference: integer HOT 2
- Nothing generated from XSD
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 xsd2go.