Skip to content

Top level element references does not prune namespace #101

@wiegell

Description

@wiegell

If you have an .xsd with a non-top-level element like this:
<element ref="here:SomeTopLevelElement">

It will not create a usable go struct

Steps to reproduce the issue:

  1. See test cases from this PR: Fixes #99: trim ns from ref #100
  2. MyType11 will look like this without the fix from the PR:
// MyType11 ...
type MyType11 struct {
	HereSubLevel *MyType12 `xml:"here:SubLevel"`
}

Describe the results you received:

The MyType11 struct above will not support being unmarshalled into, if the element does not have an explicit namespace (here:) set

Describe the results you expected:

Should work with global namespaces set (xmlns="http://example.org/") not just named namespaces (xmlns:here="http://www.w3.org/2001/XMLSchema")

Output of go version:

go version go1.24.2 darwin/arm64

xgen version or commit ID:

d9d0ba0e21ddfb95ded66c033276c4c066e08a34

Environment details (OS, physical, etc.):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions