We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Some XSD have attributes with xsd:dateTime. For instance, http://www.omg.org/spec/ReqIF/20110401/reqif.xsd, used for exchanging requirements between authoring tools, have 24 of them.
xsd:dateTime
<xsd:attribute name="LAST-CHANGE" type="xsd:dateTime" use="required" />
At runtime, the marshalling/unmarshalling of an xml will fail
Error parsing XML: cannot unmarshal into soap.XSDDateTime
or
Error parsing XML: cannot marshal into soap.XSDDateTime
To allow for marshalling/unmarshalling, one have to patch the soap package with 2 additional methods.
soap
Below is a non idomatic implementation that works so far
func (xdt XSDDateTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) { const myFormat = "2006-01-02T15:04:05.000-07:00" return xml.Attr{ Name: name, Value: xdt.ToGoTime().Format(myFormat), }, nil } func (xdt *XSDDateTime) UnmarshalXMLAttr(attr xml.Attr) error { var err error const layout = "2006-01-02T15:04:05.000-07:00" xdt.innerTime, err = time.Parse(layout, attr.Value) if err != nil { return fmt.Errorf("could not parse time: %v", err) } return nil }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Some XSD have attributes with
xsd:dateTime
. For instance, http://www.omg.org/spec/ReqIF/20110401/reqif.xsd, used for exchanging requirements between authoring tools, have 24 of them.At runtime, the marshalling/unmarshalling of an xml will fail
or
To allow for marshalling/unmarshalling, one have to patch the
soap
package with 2 additional methods.Below is a non idomatic implementation that works so far
The text was updated successfully, but these errors were encountered: