GithubHelp home page GithubHelp logo

Comments (1)

halostatue avatar halostatue commented on July 23, 2024

Note that GoComply/xsd2go generates this correctly. If xgen were to generate this correctly, there would be another issue for xsd:extends where the parent type has mixed="true" and the child type has mixed="false" or unspecified. Specifically, xgen makes the choice to generate the following code for such an entry:

// SharedTypeCustomAttributes ...
type SharedTypeCustomAttributes struct {
	XMLName         xml.Name                     `xml:"sharedType.CustomAttributes"`
	Customattribute []*SharedTypeCustomAttribute `xml:"custom-attribute"`
}

// SharedTypeCustomAttribute ...
type SharedTypeCustomAttribute struct {
	XMLName         xml.Name `xml:"sharedType.CustomAttribute"`
	AttributeidAttr string   `xml:"attribute-id,attr"`
	XmlLangAttr     string   `xml:"xml:lang,attr,omitempty"`
	Value           []string `xml:"value"`
}

// SharedTypeSiteSpecificCustomAttributes ...
type SharedTypeSiteSpecificCustomAttributes struct {
	XMLName         xml.Name                                 `xml:"sharedType.SiteSpecificCustomAttributes"`
	Customattribute []*SharedTypeSiteSpecificCustomAttribute `xml:"custom-attribute"`
}

// SharedTypeSiteSpecificCustomAttribute ...
type SharedTypeSiteSpecificCustomAttribute struct {
	XMLName    xml.Name `xml:"sharedType.SiteSpecificCustomAttribute"`
	SiteidAttr string   `xml:"site-id,attr,omitempty"`
	*SharedTypeCustomAttribute
}

If SharedTypeCustomAttribute gets InnerXml generated, then SharedTypeSiteSpecificCustomAttribute will also implicitly get InnerXml through the embedding. This is something not well defined in the XSD specification, but that discussions from 2005 on the XSD mailing list and 2012 on StackOverflow strongly suggest that the mixed attribute is not inherited. That means that SharedTypeSiteSpecificCustomAttribute would need to be implemented separately and not via embedded inheritance since the mixed attribute differs (or, more specifically, that mixed=false is stricter than mixed=true). (The optimization could be kept if the mixed attributes matched, and I believe that there is a bug in the SFCC impex XSD which I have reported into the SFCC black hole.)

from xgen.

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.