MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / readCData

Method readCData

xmlparser/decoder.go:519–544  ·  view source on GitHub ↗

readCData reads a CDATA section (until `]]>`).

()

Source from the content-addressed store, hash-verified

517
518// readCData reads a CDATA section (until `]]>`).
519func (d *Decoder) readCData() ([]byte, bool) {
520 if !d.checkAndDiscardPrefix(cdataStart) {
521 if d.err == nil {
522 d.setSyntaxErrorf("invalid sequence <![ not part of <![CDATA[")
523 }
524 return nil, false
525 }
526
527 d.buf.Reset()
528
529 // Read until ']]>'
530 for {
531 if !d.mustReadUntil('>') {
532 return nil, false
533 }
534
535 if d.buf.HasSuffix(cdataEnd) {
536 break
537 }
538 }
539
540 // Trim the trailing ']]>'
541 d.buf.Remove(len(cdataEnd))
542
543 return d.buf.Bytes(), true
544}
545
546// readDoctype reads a directive (until `>`).
547func (d *Decoder) readDoctype() ([]byte, bool) {

Callers 1

TokenMethod · 0.95

Calls 7

checkAndDiscardPrefixMethod · 0.95
setSyntaxErrorfMethod · 0.95
mustReadUntilMethod · 0.95
ResetMethod · 0.80
HasSuffixMethod · 0.80
RemoveMethod · 0.80
BytesMethod · 0.80

Tested by

no test coverage detected