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
xsd:sequence is not respected when using layout struct to handle non-builtin types #85
Comments
This is tricky, because the original struct is embedded in the layout struct:
The most straightforward way I can see to preserve order is to do away with the embedding, name each field of the This will make the |
I had this problem also. Solution was I changed the type in the struct from time.Time to xsdDateTime, and now this just uses the custom marshal/unmarshal interface on that type directly, rather than going through a layout stuff for the higher level struct. Unclear if I've caused some edge case or not, but so far it appears to work just fine, and order is preserved. It does mean I have to type override it when using the struct, but that's fine for my usecase. |
I have an xsd:sequence that has an xsd:dateTime in the 3rd position.
As you know, xsd:sequence is strictly positional.
The generated MarshalXML code declares a layout struct to handle the conversion from time.Time to *xsdDateTime with a new member with the same same (member shadowing)
Unfortunately the shadowing member is serialized at last position, so the generated XML is not validated against the original XSD file
I hope my explanation is clear enough, I am attaching XSD files I am using to reproduce this issue (Italian electronic invoice formats)
sdi.zip
The text was updated successfully, but these errors were encountered: