FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com,

I'd like you to review this change to
https://code.google.com/p/graphics-go


Description:
graphics-go: fix opencv_parser xml decoding

Please review this at http://codereview.appspot.com/6495122/

Affected files:
M graphics/detect/opencv_parser.go


Index: graphics/detect/opencv_parser.go
===================================================================
--- a/graphics/detect/opencv_parser.go
+++ b/graphics/detect/opencv_parser.go
@@ -34,10 +34,10 @@
type opencv_storage struct {
Any struct {
XMLName xml.Name
- Type_id string `xml:"attr"`
+ Type string `xml:"type_id,attr"`
Size string `xml:"size"`
Stages []xmlStages `xml:"stages>grp"`
- }
+ } `xml:",any"`
}

func buildFeature(r string) (f Feature, err error) {
@@ -53,8 +53,8 @@
}

func buildCascade(s *opencv_storage) (c *Cascade, name string, err error) {
- if s.Any.Type_id != "opencv-haar-classifier" {
- err = fmt.Errorf("got %s want opencv-haar-classifier", s.Any.Type_id)
+ if s.Any.Type != "opencv-haar-classifier" {
+ err = fmt.Errorf("got %s want opencv-haar-classifier", s.Any.Type)
return
}
name = s.Any.XMLName.Local
@@ -117,7 +117,7 @@
buf = bytes.Replace(buf, []byte("</_>"), []byte("</grp>"), -1)

s := &opencv_storage{}
- err = xml.Unmarshal(bytes.NewBuffer(buf), s)
+ err = xml.Unmarshal(buf, s)
if err != nil {
return
}

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedSep 13, '12 at 2:45a
activeSep 14, '12 at 12:16a
posts6
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase