(space string, p *xpp.XMLPullParser)
| 91 | } |
| 92 | |
| 93 | func 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…