diff --git a/metaschema/generate.go b/metaschema/generate.go index b1bed07..5fdf7bf 100644 --- a/metaschema/generate.go +++ b/metaschema/generate.go @@ -1,7 +1,6 @@ package metaschema import ( - "encoding/xml" "fmt" "io" "io/ioutil" @@ -10,6 +9,7 @@ import ( "github.com/gocomply/metaschema/metaschema/parser" "github.com/gocomply/metaschema/metaschema/templates" + "github.com/gocomply/metaschema/pkg/xml_dtd" ) func Generate(metaschemaDir, goModule, outputDir string) error { @@ -43,7 +43,7 @@ func Generate(metaschemaDir, goModule, outputDir string) error { func decode(metaschemaDir, goModule string, r io.Reader) (*parser.Metaschema, error) { var meta parser.Metaschema - d := xml.NewDecoder(r) + d := xml_dtd.NewDecoder(r) if err := d.Decode(&meta); err != nil { return nil, fmt.Errorf("Error decoding metaschema: %s", err) diff --git a/pkg/xml_dtd/decoder.go b/pkg/xml_dtd/decoder.go new file mode 100644 index 0000000..d8dd035 --- /dev/null +++ b/pkg/xml_dtd/decoder.go @@ -0,0 +1,26 @@ +package xml_dtd + +import ( + "encoding/xml" + "io" +) + +type Decoder struct { + *xml.Decoder +} + +func NewDecoder(r io.Reader) *Decoder { + dtd := &Decoder{ + Decoder: xml.NewDecoder(r), + } + dtd.Entity = map[string]string{ + "allowed-values-control-group-property-name": "TODO-FIX-THIS", + "allowed-values-component_inventory-item_property-name": "TODO-FIX-THIS", + "allowed-values-component_component_property-name": "TODO-FIX-THIS", + } + return dtd +} + +func (d *Decoder) Decode(v interface{}) error { + return d.Decoder.Decode(v) +}