Documentation
¶
Overview ¶
Package engine reads a document with a profile (PROFILE_FORMAT.md): it consumes the element events of package xmlread, as the generic reader does, and makes the blocks the profile's rules say. Elements with no rule are read generically and counted.
Index ¶
- Constants
- type Engine
- func (e *Engine) Attr(i int, q profile.QName) (string, bool)
- func (e *Engine) Comment(r *xmlread.Reader, t []byte, final bool, start, end int64)
- func (e *Engine) Counts() (controls, invalid int)
- func (e *Engine) EndElement(r *xmlread.Reader, el *xmlread.Element, start, end int64)
- func (e *Engine) Finish(end int64)
- func (e *Engine) HasToken(i int, q profile.QName, tok string) bool
- func (e *Engine) Len() int
- func (e *Engine) Name(i int) profile.QName
- func (e *Engine) PartWarnings(p *gofastcore.Part)
- func (e *Engine) Parts() []*gofastcore.Part
- func (e *Engine) StartElement(r *xmlread.Reader, el *xmlread.Element)
- func (e *Engine) Stop() bool
- func (e *Engine) Text(r *xmlread.Reader, t []byte, start, end int64)
- type Options
Constants ¶
const ( // MaxTableColumns bounds the columns of a table. MaxTableColumns = 1024 // MaxRowSpan bounds how many rows one cell spans. MaxRowSpan = 65535 // MaxNamesCounted bounds the distinct names counted in the // xml.unmapped_* warnings; the rest are counted together. MaxNamesCounted = 1000 // MaxParts bounds the parts a profile's part rules start. MaxParts = 100000 )
Fixed bounds. What they cut is reported with limit.exceeded.
const ( // AttrAnchorParent is the identifier of the nearest enclosing element // a rule names with "anchor", on a block with no identifier of its own. AttrAnchorParent = "anchor_parent" // AttrHeaderSource is "profile" on a table whose header row is the // profile's fixed text. AttrHeaderSource = "header_source" // AttrTitle is a link's title ("title") in its stored record. AttrTitle = "title" // AttrHref is the address of a link, on its record in the stored part. AttrHref = "href" )
Keys of Block.Attrs the engine writes.
const ( WarnUnmappedElements = "xml.unmapped_elements" WarnUnmappedAttributes = "xml.unmapped_attributes" WarnSkipped = "xml.skipped_elements" )
Warning codes of the engine.
const MaxNamesListed = 100
MaxNamesListed bounds the names a warning lists.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// Meta collects the metadata the rules give.
Meta gofastcore.Metadata
// Counts for the whole reading.
ValuesCut, ColumnsCut, SpansCut, TextCut, PartsCut int
// RowSpanCut counts cells whose row span was cut to MaxRowSpan.
RowSpanCut int
// PendingCut counts blocks cut because more than MaxPendingBlocks
// attribute notes waited for them.
PendingCut int
Controls, Invalid int
// contains filtered or unexported fields
}
Engine is the profile consumer. It implements xmlread.Handler.
func (*Engine) Comment ¶
Comment implements xmlread.Handler: a comment is a note marked stored, at its place.
func (*Engine) Counts ¶
Counts returns the control characters removed and invalid bytes met in all the text made.
func (*Engine) EndElement ¶
EndElement implements xmlread.Handler.
func (*Engine) HasToken ¶
HasToken implements profile.TokenPath: an element's tested value is split into its tokens once, the first time a rule tests it.
func (*Engine) PartWarnings ¶
func (e *Engine) PartWarnings(p *gofastcore.Part)
PartWarnings writes the engine's warnings about part p.
func (*Engine) Parts ¶
func (e *Engine) Parts() []*gofastcore.Part
Parts returns the parts made, the stored part last if there is one.
func (*Engine) StartElement ¶
StartElement implements xmlread.Handler.