Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions datadictionary/datadictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package datadictionary

import (
"encoding/xml"
"io"
"os"
)

Expand Down Expand Up @@ -305,15 +306,20 @@ func Parse(path string) (*DataDictionary, error) {
}
defer xmlFile.Close()

return ParseSrc(xmlFile)
}

//ParseSrc loads and and build a datadictionary instance from an xml source.
func ParseSrc(xmlSrc io.Reader) (*DataDictionary, error) {
doc := new(XMLDoc)
decoder := xml.NewDecoder(xmlFile)
decoder := xml.NewDecoder(xmlSrc)
if err := decoder.Decode(doc); err != nil {
return nil, err
}

b := new(builder)
var dict *DataDictionary
if dict, err = b.build(doc); err != nil {
dict, err := b.build(doc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with this change, the declaration of dict above is no longer necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ye, I thought it was there for stylistic reasons, fixing...

if err != nil {
return nil, err
}

Expand Down