If the top element on the stack is autoclosing and t is not the end tag, invent the end tag.
(t Token)
| 501 | // If the top element on the stack is autoclosing and |
| 502 | // t is not the end tag, invent the end tag. |
| 503 | func (d *Decoder) autoClose(t Token) (Token, bool) { |
| 504 | if d.stk == nil || d.stk.kind != stkStart { |
| 505 | return nil, false |
| 506 | } |
| 507 | name := strings.ToLower(d.stk.name.Local) |
| 508 | for _, s := range d.AutoClose { |
| 509 | if strings.ToLower(s) == name { |
| 510 | // This one should be auto closed if t doesn't close it. |
| 511 | et, ok := t.(EndElement) |
| 512 | if !ok || et.Name.Local != name { |
| 513 | return EndElement{d.stk.name}, true |
| 514 | } |
| 515 | break |
| 516 | } |
| 517 | } |
| 518 | return nil, false |
| 519 | } |
| 520 | |
| 521 | var errRawToken = errors.New("xml: cannot use RawToken from UnmarshalXML method") |
| 522 |