Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xsdgen issue - root element #11

Closed
junghao opened this issue Mar 2, 2017 · 1 comment
Closed

xsdgen issue - root element #11

junghao opened this issue Mar 2, 2017 · 1 comment

Comments

@junghao
Copy link

junghao commented Mar 2, 2017

From the xsd specification http://www.fdsn.org/xml/station/fdsn-station-1.0.xsd, the "Root element" defined:

<!--  Root element  -->
<xs:element name="FDSNStationXML" type="fsx:RootType"/>
<!--  Type definitions  -->
<xs:complexType name="RootType">
<xs:annotation>
...

Which means the root element struct name should be "FDSNStationXML", e.g.:

type FDSNStationXML struct {
	SchemaVersion float64       `xml:"schemaVersion,attr"`
...

However, currently xsdgen's output is:

type RootType struct {
	SchemaVersion float64       `xml:"schemaVersion,attr"`
...

This problem only happens in the root element.

@junghao junghao changed the title xsdgen issue xsdgen issue - root element Mar 2, 2017
@droyo
Copy link
Owner

droyo commented Mar 3, 2017

In this case the xsdgen package is behaving as intended. This is a type declaration, and in the schema, the type name is fsx:RootType. I'm open to discussing whether this is desired behavior. Currently, the xsd package totally ignores top-level elements and attributes, and just searches them for type declaration. Honestly I don't quite know what to do with top-level element declarations in an xml schema.

For this specific instance, you can get what you want like this:

xsdgen -r 'RootType -> FDSNStationXML'

@droyo droyo closed this as completed Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants