goxml

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOK_INVALID = iota
	TOK_EOF
	TOK_ID
	TOK_STRING
	TOK_PREFIX_SEP               // Symbol ":"
	TOK_EQUAL                    // Symbol "="
	TOK_OPEN_ELEMENT_TAG         // Symbol "<"
	TOK_CLOSE_SINGLE_ELEMENT_TAG // Symbol "/>"
	TOK_OPEN_CLOSING_ELEMENT_TAG // Symbol "</"
	TOK_CLOSE_ELEMENT_TAG        // Symbol ">"
	TOK_OPEN_COMMENT             // Symbol "<!--"
	TOK_CLOSE_COMMENT            // Symbol "-->"
	TOK_OPEN_PROCINST            // Symbol "<?"
	TOK_CLOSE_PROCINST           // Symbol "?>"
)
View Source
const CommentElementFlag = 0b100
View Source
const ProcInstFlag = 0b1
View Source
const TextElementFlag = 0b10

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name  QName
	Value string
}

func NewAttribute

func NewAttribute(name any, value string) Attribute

func (Attribute) String

func (attr Attribute) String() string

func (*Attribute) WriteTo

func (attr *Attribute) WriteTo(w io.Writer, args WriteArgs)

type Document

type Document struct {
	Children []Element
}

func NewDocument

func NewDocument(children []Element) Document

func (*Document) AttachChild

func (doc *Document) AttachChild(child Element)

func (*Document) WriteTo

func (doc *Document) WriteTo(w io.Writer, args WriteArgs)

type Element

type Element struct {
	Tag        QName
	Text       string
	Children   []Element
	Attributes map[string]Attribute
	Flag       byte
}

func NewCommentElement

func NewCommentElement(text string) Element

func NewElement

func NewElement(tag any, text string, flag byte, children []Element, attributes []Attribute) Element

func NewTextElement

func NewTextElement(text string) Element

func (*Element) AttachAttribute

func (el *Element) AttachAttribute(attr Attribute)

func (*Element) AttachChild

func (el *Element) AttachChild(child Element)

func (Element) String

func (el Element) String() string

func (*Element) WriteTo

func (el *Element) WriteTo(w io.Writer, args WriteArgs)

type NamespaceTable

type NamespaceTable struct {
	// contains filtered or unexported fields
}

func (*NamespaceTable) Attach

func (table *NamespaceTable) Attach(parent *NamespaceTable)

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser(r io.Reader, args ParserArgs) Parser

func (*Parser) GetTrace

func (p *Parser) GetTrace() []string

func (*Parser) Parse

func (p *Parser) Parse() result.Result[Document]

type ParserArgs

type ParserArgs struct {
	// Allows to trace the operations of the parser
	Debug bool
}

type QName

type QName struct {
	Local  string
	Prefix option.Option[string]
}

func (QName) String

func (q QName) String() string

func (*QName) WriteTo

func (qname *QName) WriteTo(w io.Writer, args WriteArgs)

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.Reader) Scanner

func (*Scanner) Next

func (l *Scanner) Next() option.Option[result.Result[Token]]

type Token

type Token struct {
	Type  int8
	Value string
	Row   int
	Col   int
}

func (Token) String

func (tok Token) String() string

func (Token) TypeName

func (tok Token) TypeName() string

type WriteArgs

type WriteArgs struct {
	Level int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL