From db13d6a33d668109b898ad8a7f123dc472b8e24e Mon Sep 17 00:00:00 2001 From: jf-tech Date: Tue, 25 Aug 2020 07:58:10 +1200 Subject: [PATCH] move Parse func back to original position in src to reduce diff size --- parse.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/parse.go b/parse.go index b967a9c..618ad2c 100644 --- a/parse.go +++ b/parse.go @@ -20,20 +20,6 @@ func LoadURL(url string) (*Node, error) { return Parse(resp.Body) } -// Parse returns the parse tree for the XML from the given Reader. -func Parse(r io.Reader) (*Node, error) { - p := createParser(r) - for { - _, err := p.parse() - if err == io.EOF { - return p.doc, nil - } - if err != nil { - return nil, err - } - } -} - type parser struct { decoder *xml.Decoder doc *Node @@ -163,3 +149,17 @@ func (p *parser) parse() (*Node, error) { } } } + +// Parse returns the parse tree for the XML from the given Reader. +func Parse(r io.Reader) (*Node, error) { + p := createParser(r) + for { + _, err := p.parse() + if err == io.EOF { + return p.doc, nil + } + if err != nil { + return nil, err + } + } +}