Documentation
¶
Overview ¶
Package xmllex provides lexical XML parsing helpers.
Index ¶
- Constants
- func IsIgnorableOutsideRoot(data []byte, allowBOM bool) bool
- type DocumentState
- func (s *DocumentState) OnEndElement(closeRoot bool)
- func (s *DocumentState) OnOutsideMarkup()
- func (s *DocumentState) OnStartElement()
- func (s *DocumentState) RootClosed() bool
- func (s *DocumentState) RootSeen() bool
- func (s *DocumentState) StartElementAllowed() bool
- func (s *DocumentState) ValidateOutsideCharData(data []byte) bool
Constants ¶
const ( XMLNamespace = xmlstream.XMLNamespace XMLNSNamespace = xmlstream.XMLNSNamespace XSINamespace = xmlstream.XSINamespace XSDNamespace = xmlstream.XSDNamespace )
Common XML namespaces.
Variables ¶
This section is empty.
Functions ¶
func IsIgnorableOutsideRoot ¶
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.