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

Method writeStart

opensca/sca/java/xml/marshal.go:713–749  ·  view source on GitHub ↗

writeStart writes the given start element.

(start *StartElement)

Source from the content-addressed store, hash-verified

711
712// writeStart writes the given start element.
713func (p *printer) writeStart(start *StartElement) error {
714 if start.Name.Local == "" {
715 return fmt.Errorf("xml: start tag with no name")
716 }
717
718 p.tags = append(p.tags, start.Name)
719 p.markPrefix()
720
721 p.writeIndent(1)
722 p.WriteByte('<')
723 p.WriteString(start.Name.Local)
724
725 if start.Name.Space != "" {
726 p.WriteString(` xmlns="`)
727 p.EscapeString(start.Name.Space)
728 p.WriteByte('"')
729 }
730
731 // Attributes
732 for _, attr := range start.Attr {
733 name := attr.Name
734 if name.Local == "" {
735 continue
736 }
737 p.WriteByte(' ')
738 if name.Space != "" {
739 p.WriteString(p.createAttrPrefix(name.Space))
740 p.WriteByte(':')
741 }
742 p.WriteString(name.Local)
743 p.WriteString(`="`)
744 p.EscapeString(attr.Value)
745 p.WriteByte('"')
746 }
747 p.WriteByte('>')
748 return nil
749}
750
751func (p *printer) writeEnd(name Name) error {
752 if name.Local == "" {

Callers 4

marshalValueMethod · 0.95
marshalTextInterfaceMethod · 0.95
EncodeTokenMethod · 0.80
pushMethod · 0.80

Calls 6

markPrefixMethod · 0.95
writeIndentMethod · 0.95
WriteByteMethod · 0.95
WriteStringMethod · 0.95
EscapeStringMethod · 0.95
createAttrPrefixMethod · 0.95

Tested by

no test coverage detected