MCPcopy
hub / github.com/mmcdole/gofeed / PrefixForNamespace

Function PrefixForNamespace

internal/shared/extparser.go:93–112  ·  view source on GitHub ↗
(space string, p *xpp.XMLPullParser)

Source from the content-addressed store, hash-verified

91}
92
93func PrefixForNamespace(space string, p *xpp.XMLPullParser) string {
94 // First we check if the global namespace map
95 // contains an entry for this namespace/prefix.
96 // This way we can use the canonical prefix for this
97 // ns instead of the one defined in the feed.
98 if prefix, ok := canonicalNamespaces[space]; ok {
99 return prefix
100 }
101
102 // Next we check if the feed itself defined this
103 // this namespace and return it if we have a result.
104 if prefix, ok := p.Spaces[space]; ok {
105 return prefix
106 }
107
108 // Lastly, any namespace which is not defined in the
109 // the feed will be the prefix itself when using Go's
110 // xml.Decoder.Token() method.
111 return space
112}
113
114// Namespaces taken from github.com/kurtmckee/feedparser
115// These are used for determining canonical name space prefixes

Callers 3

parseItemMethod · 0.92
IsExtensionFunction · 0.85
ParseExtensionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…