MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / translate

Method translate

opensca/sca/java/xml/xml.go:342–358  ·  view source on GitHub ↗

Apply name space translation to name n. The default name space (for Space=="") applies only to element names, not to attribute names.

(n *Name, isElementName bool)

Source from the content-addressed store, hash-verified

340// The default name space (for Space=="")
341// applies only to element names, not to attribute names.
342func (d *Decoder) translate(n *Name, isElementName bool) {
343 switch {
344 case n.Space == xmlnsPrefix:
345 return
346 case n.Space == "" && !isElementName:
347 return
348 case n.Space == xmlPrefix:
349 n.Space = xmlURL
350 case n.Space == "" && n.Local == xmlnsPrefix:
351 return
352 }
353 if v, ok := d.ns[n.Space]; ok {
354 n.Space = v
355 } else if n.Space == "" {
356 n.Space = d.DefaultSpace
357 }
358}
359
360func (d *Decoder) switchToReader(r io.Reader) {
361 // Get efficient byte at a time reader.

Callers 2

TokenMethod · 0.95
popElementMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected