Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
isimluk committed Nov 8, 2022
1 parent 2c8803a commit 8cd2a2d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metaschema/generate.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package metaschema

import (
"encoding/xml"
"fmt"
"io"
"io/ioutil"
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
26 changes: 26 additions & 0 deletions pkg/xml_dtd/decoder.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 8cd2a2d

Please sign in to comment.