Skip to content

Commit

Permalink
Merge pull request #2 from d1nfinite/main
Browse files Browse the repository at this point in the history
feat: support parse from reader
  • Loading branch information
vifraa authored Apr 19, 2022
2 parents 7aa35ce + 3b9aff5 commit 40b6a78
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gopom.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ func Parse(path string) (*Project, error) {
return &project, nil
}

func ParseFromReader(reader io.Reader) (*Project, error) {
b, _ := ioutil.ReadAll(reader)
var project Project

err := xml.Unmarshal(b, &project)
if err != nil {
return nil, err
}
return &project, nil
}

type Project struct {
XMLName xml.Name `xml:"project"`
ModelVersion string `xml:"modelVersion"`
Expand Down

0 comments on commit 40b6a78

Please sign in to comment.