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

Method attrval

opensca/sca/java/xml/xml.go:846–878  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

844}
845
846func (d *Decoder) attrval() []byte {
847 b, ok := d.mustgetc()
848 if !ok {
849 return nil
850 }
851 // Handle quoted attribute values
852 if b == '"' || b == '\'' {
853 return d.text(int(b), false)
854 }
855 // Handle unquoted attribute values for strict parsers
856 if d.Strict {
857 d.err = d.syntaxError("unquoted or missing attribute value in element")
858 return nil
859 }
860 // Handle unquoted attribute values for unstrict parsers
861 d.ungetc(b)
862 d.buf.Reset()
863 for {
864 b, ok = d.mustgetc()
865 if !ok {
866 return nil
867 }
868 // https://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2
869 if 'a' <= b && b <= 'z' || 'A' <= b && b <= 'Z' ||
870 '0' <= b && b <= '9' || b == '_' || b == ':' || b == '-' {
871 d.buf.WriteByte(b)
872 } else {
873 d.ungetc(b)
874 break
875 }
876 }
877 return d.buf.Bytes()
878}
879
880// Skip spaces if any
881func (d *Decoder) space() {

Callers 1

rawTokenMethod · 0.95

Calls 5

mustgetcMethod · 0.95
textMethod · 0.95
syntaxErrorMethod · 0.95
ungetcMethod · 0.95
WriteByteMethod · 0.80

Tested by

no test coverage detected