Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 1.07 KB

README.md

File metadata and controls

36 lines (25 loc) · 1.07 KB

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

Example usage

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 for creating the C# version.