Giter VIP home page Giter VIP logo

Comments (6)

wannes-geysen avatar wannes-geysen commented on July 21, 2024 1

@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.

ss185427 avatar ss185427 commented on July 21, 2024

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.

isimluk avatar isimluk commented on July 21, 2024

@mr-kashif, could you please provide all the XSD files for me to reproduce?

from xsd2go.

Simerax avatar Simerax commented on July 21, 2024

@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.

v1gnesh avatar v1gnesh commented on July 21, 2024

Yes please to the above comment.

from xsd2go.

sandmannmax avatar sandmannmax commented on July 21, 2024

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)

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.