xmllex

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package xmllex provides lexical XML parsing helpers.

Index

Constants

View Source
const (
	XMLNamespace   = xmlstream.XMLNamespace
	XMLNSNamespace = xmlstream.XMLNSNamespace
	XSINamespace   = xmlstream.XSINamespace
	XSDNamespace   = xmlstream.XSDNamespace
)

Common XML namespaces.

Variables

This section is empty.

Functions

func IsIgnorableOutsideRoot

func IsIgnorableOutsideRoot(data []byte, allowBOM bool) bool

IsIgnorableOutsideRoot reports whether data contains only XML whitespace. If allowBOM is true, a leading BOM is permitted before any other character.

Types

type DocumentState added in v0.0.25

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

DocumentState tracks document-boundary lexical state shared by XML token loops.

func NewDocumentState added in v0.0.25

func NewDocumentState() DocumentState

NewDocumentState returns an initialized document-boundary state.

func (*DocumentState) OnEndElement added in v0.0.25

func (s *DocumentState) OnEndElement(closeRoot bool)

OnEndElement advances state for an end-element token. closeRoot should be true only when this token closes the document root element.

func (*DocumentState) OnOutsideMarkup added in v0.0.25

func (s *DocumentState) OnOutsideMarkup()

OnOutsideMarkup advances state for comments/PI/directives outside root.

func (*DocumentState) OnStartElement added in v0.0.25

func (s *DocumentState) OnStartElement()

OnStartElement advances state for a start-element token.

func (*DocumentState) RootClosed added in v0.0.25

func (s *DocumentState) RootClosed() bool

RootClosed reports whether the root element has been closed.

func (*DocumentState) RootSeen added in v0.0.25

func (s *DocumentState) RootSeen() bool

RootSeen reports whether a root start element has been seen.

func (*DocumentState) StartElementAllowed added in v0.0.25

func (s *DocumentState) StartElementAllowed() bool

StartElementAllowed reports whether a start element may appear at this point.

func (*DocumentState) ValidateOutsideCharData added in v0.0.25

func (s *DocumentState) ValidateOutsideCharData(data []byte) bool

ValidateOutsideCharData reports whether character data outside root is ignorable.

Jump to

Keyboard shortcuts

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