File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -835,12 +835,15 @@ func (d *Decoder) rawToken() (Token, error) {
835
835
d .ungetc (b )
836
836
837
837
a := Attr {}
838
- // Tag has a list of attributes bound to a namespace or not.
839
- a .Name , ok = d .nsname ()
840
- // if !ok the attribute name has no namespace
838
+ if a .Name , ok = d .nsname (); ! ok {
839
+ if d .err == nil {
840
+ d .err = d .syntaxError ("expected attribute name in element" )
841
+ }
842
+ return nil , d .err
843
+ }
841
844
d .space ()
842
845
if b , ok = d .mustgetc (); ! ok {
843
- d .err = d .syntaxError ("expected attribute name in element" )
846
+ // d.err = d.syntaxError("expected attribute name in element")
844
847
return nil , d .err
845
848
}
846
849
if b != '=' { // nsname.Local is the attribute name if xmlns is present otherwise err was returned
Original file line number Diff line number Diff line change @@ -730,7 +730,7 @@ var characterTests = []struct {
730
730
{"<?xml version=\" 1.0\" ?>\x0b <doc/>" , "illegal character code U+000B" },
731
731
{"\xef \xbf \xbe <doc/>" , "illegal character code U+FFFE" },
732
732
{"<?xml version=\" 1.0\" ?><doc>\r \n <hiya/>\x07 <toots/></doc>" , "illegal character code U+0007" },
733
- {"<?xml version=\" 1.0\" ?><doc \x12 ='value'>what's up</doc>" , "expected = after attribute name" },
733
+ {"<?xml version=\" 1.0\" ?><doc \x12 ='value'>what's up</doc>" , "expected attribute name in element " },
734
734
{"<doc>&abc\x01 ;</doc>" , "invalid character entity &abc (no semicolon)" },
735
735
{"<doc>&\x01 ;</doc>" , "invalid character entity & (no semicolon)" },
736
736
{"<doc>&\xef \xbf \xbe ;</doc>" , "invalid character entity &\uFFFE ;" },
You can’t perform that action at this time.
0 commit comments