If the top element on the stack is autoclosing and t is not the end tag, invent the end tag.
(t Token)
| 513 | // If the top element on the stack is autoclosing and |
| 514 | // t is not the end tag, invent the end tag. |
| 515 | func (d *Decoder) autoClose(t Token) (Token, bool) { |
| 516 | if d.stk == nil || d.stk.kind != stkStart { |
| 517 | return nil, false |
| 518 | } |
| 519 | for _, s := range d.AutoClose { |
| 520 | if strings.EqualFold(s, d.stk.name.Local) { |
| 521 | // This one should be auto closed if t doesn't close it. |
| 522 | et, ok := t.(EndElement) |
| 523 | if !ok || !strings.EqualFold(et.Name.Local, d.stk.name.Local) { |
| 524 | return EndElement{d.stk.name}, true |
| 525 | } |
| 526 | break |
| 527 | } |
| 528 | } |
| 529 | return nil, false |
| 530 | } |
| 531 | |
| 532 | var errRawToken = errors.New("xml: cannot use RawToken from UnmarshalXML method") |
| 533 |