MCPcopy Index your code
hub / github.com/XmirrorSecurity/OpenSCA-cli / autoClose

Method autoClose

opensca/sca/java/xml/xml.go:515–530  ·  view source on GitHub ↗

If the top element on the stack is autoclosing and t is not the end tag, invent the end tag.

(t Token)

Source from the content-addressed store, hash-verified

513// If the top element on the stack is autoclosing and
514// t is not the end tag, invent the end tag.
515func (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
532var errRawToken = errors.New("xml: cannot use RawToken from UnmarshalXML method")
533

Callers 1

TokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected