go-xml icon indicating copy to clipboard operation
go-xml copied to clipboard

Does not generate code

Open kikohnl opened this issue 3 years ago • 1 comments

I have a large schema from a vendor, Cisco/Broadworks which I need to create API calls to build utilities from.

xdsparse has no problem with the xsd, but xsdgen creates an go file with no structures or code:

cat xsdgen_output.go // Code generated by xsdgen. DO NOT EDIT.

package ws

I have attached the Schema.

Rel_21.sp1_1.551_OCISchemaAS.zip

kikohnl avatar Jun 04 '21 18:06 kikohnl

Did you try adding -ns "", assuming there is no particular target namespace in the xsd? I.e. xsdgen -pkg some -o some.go -ns "" some.xsd.

In my case it made the difference from

// Code generated by xsdgen. DO NOT EDIT.

package some

to

// Code generated by xsdgen. DO NOT EDIT.

package some

type Some1 struct {
	Some2 string  `xml:" some2"`
        ...
}
...

for an XSD that declares no namespace like this:

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<xsd:element name="some1">
...

Lercher avatar Nov 28 '23 15:11 Lercher