MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / autoClose

Method autoClose

server/webdav/internal/xml/xml.go:503–519  ·  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

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

Callers 1

TokenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected