https://github.com/factrylabs/go-b2mml
Go structs for the MESA International standards B2MML and BatchML. Ported from the C# B2MML.NET Library
https://github.com/factrylabs/go-b2mml
b2mml b2mml-batchml go industry-40 isa-95 manufacturing mesa
Last synced: 5 months ago
JSON representation
Go structs for the MESA International standards B2MML and BatchML. Ported from the C# B2MML.NET Library
- Host: GitHub
- URL: https://github.com/factrylabs/go-b2mml
- Owner: factrylabs
- License: mit
- Created: 2017-05-09T09:58:23.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-09T13:30:34.000Z (about 9 years ago)
- Last Synced: 2024-06-20T08:13:19.473Z (almost 2 years ago)
- Topics: b2mml, b2mml-batchml, go, industry-40, isa-95, manufacturing, mesa
- Language: Go
- Size: 103 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-b2mml
A Go package contains structs for all the types defined in the MESA International standards B2MML and BatchML schemas. It is a port of the C# [B2MML.NET](https://github.com/jpdillingham/B2MML.NET) package.
# Example usage
```go
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
b2mml "github.com/factrylabs/go-b2mml"
)
func main() {
data, _ := ioutil.ReadFile("/path/to/materiallot.xml")
ml := b2mml.MaterialLotType{}
_ := xml.Unmarshal(data, &ml)
fmt.Printf("Resulting B2MML struct:\n%+v\n", ml)
}
```
# FAQ
**Why not generate directly from the B2MML schema?**
For a project we had to unmarshal some B2MML messages to Go structs. There is no mature xsd code generator for Go (yet, according to our experience), and it seemed much easier to simply "translate" the C# code generated by the Microsoft (R) Xml Schemas/DataTypes support utility (xsd.exe) than to write an xsd generator ourselves.
# Contributing
Feel free to open an issue or a to submit a pull request...
# Credits
Thanks to [jpdillingham](https://github.com/jpdillingham) for creating the C# version.