mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-12-23 22:11:10 +02:00
* Use XML parser based on encoding/xml * Implement raw XML parser * Speed-up xml parser * Add line number to XML parser syntax errors * Add svgparser.StartElement.SelfClosing * Utilize bufio.Reader.ReadSlice in XML parser * Polish XML parser tests; Add XML parser benchmark * Move XML parser to ./xmlparser * Use all XML parser tokens as pointers * Add xmlparser.Document.ReplaceEntities method * Combine xmlparser.Text and xmlparset.CData * Optimize entities replacement in xmlparser * xmlparser.parseEntityMap: ignore comments * xmlparser: add document parsing benchmark * xmlparser: Refactor attributes * xmlparser: simplify Attributes.Filter * xmlparser: add Attributes.Has, Node.FilterChildren, and Node.FilterChildNodes * xmlparser: add Node.ChildNodes
28 lines
420 B
Go
28 lines
420 B
Go
package xmlparser
|
|
|
|
import "strings"
|
|
|
|
type Name string
|
|
|
|
func (n Name) Split() (string, string) {
|
|
ind := strings.IndexByte(string(n), ':')
|
|
if ind == -1 {
|
|
return "", string(n)
|
|
}
|
|
return string(n[:ind]), string(n[ind+1:])
|
|
}
|
|
|
|
func (n Name) Space() string {
|
|
space, _ := n.Split()
|
|
return space
|
|
}
|
|
|
|
func (n Name) Local() string {
|
|
_, local := n.Split()
|
|
return local
|
|
}
|
|
|
|
func (n Name) String() string {
|
|
return string(n)
|
|
}
|