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

Method writeEnd

opensca/sca/java/xml/marshal.go:751–773  ·  view source on GitHub ↗
(name Name)

Source from the content-addressed store, hash-verified

749}
750
751func (p *printer) writeEnd(name Name) error {
752 if name.Local == "" {
753 return fmt.Errorf("xml: end tag with no name")
754 }
755 if len(p.tags) == 0 || p.tags[len(p.tags)-1].Local == "" {
756 return fmt.Errorf("xml: end tag </%s> without start tag", name.Local)
757 }
758 if top := p.tags[len(p.tags)-1]; top != name {
759 if top.Local != name.Local {
760 return fmt.Errorf("xml: end tag </%s> does not match start tag <%s>", name.Local, top.Local)
761 }
762 return fmt.Errorf("xml: end tag </%s> in namespace %s does not match start tag <%s> in namespace %s", name.Local, name.Space, top.Local, top.Space)
763 }
764 p.tags = p.tags[:len(p.tags)-1]
765
766 p.writeIndent(-1)
767 p.WriteByte('<')
768 p.WriteByte('/')
769 p.WriteString(name.Local)
770 p.WriteByte('>')
771 p.popPrefix()
772 return nil
773}
774
775func (p *printer) marshalSimple(typ reflect.Type, val reflect.Value) (string, []byte, error) {
776 switch val.Kind() {

Callers 4

marshalValueMethod · 0.95
marshalTextInterfaceMethod · 0.95
EncodeTokenMethod · 0.80
trimMethod · 0.80

Calls 4

writeIndentMethod · 0.95
WriteByteMethod · 0.95
WriteStringMethod · 0.95
popPrefixMethod · 0.95

Tested by

no test coverage detected