droyo / go-xml

utility and code-generation libraries for XML
MIT License
304 stars 115 forks source link

Does not generate code #137

Open kikohnl opened 3 years ago

kikohnl commented 3 years ago

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

Lercher commented 11 months ago

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