-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
42 lines (35 loc) · 918 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package gosaxml
// Name is a name with a possible prefix like "xmlns:blubb"
// or simply without prefix like "a"
type Name struct {
Local []byte
Prefix []byte
}
// Attr is an attribute of an element.
// Only tokens of type TokenTypeStartElement can have attributes.
type Attr struct {
Name Name
Value []byte
SingleQuote bool
}
// constants for Token.Kind
const (
TokenTypeInvalid = iota
TokenTypeStartElement
TokenTypeEndElement
TokenTypeProcInst
TokenTypeDirective
TokenTypeTextElement
TokenTypeCharData
)
// Token represents the union of all possible token types
// with their respective information.
type Token struct {
// only for TokenTypeStartElement, TokenTypeEndElement and TokenTypeProcInst
Name Name
// only for TokenTypeStartElement
Attr []Attr
// only for TokenTypeDirective, TokenTypeTextElement, TokenTypeCharData and TokenTypeProcInst
ByteData []byte
Kind byte
}