Documentation ¶
Overview ¶
Package scanner allows to extract information from the DTD and create corresponding DTD structs
Index ¶
- type DTDScanner
- func (sc *DTDScanner) NextBlock() bool
- func (sc *DTDScanner) ParseAttlist(s *sentence) *DTD.Attlist
- func (sc *DTDScanner) ParseComment(s *sentence) *DTD.Comment
- func (sc *DTDScanner) ParseElement(s *sentence) *DTD.Element
- func (sc *DTDScanner) ParseEntity(s *sentence) *DTD.Entity
- func (sc *DTDScanner) ParseNotation(s *sentence) *DTD.Notation
- func (sc *DTDScanner) Previous() bool
- func (sc *DTDScanner) Scan() (DTD.IDTDBlock, []*word, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DTDScanner ¶
type DTDScanner struct { Data *bufio.Scanner WithComments bool Filepath string CurrentLine int // first line of a block CurrentChar int CharCount int LineCount int // line processed by the scanner CRLF bool // 0 linux / 1 dos Log *zap.SugaredLogger // contains filtered or unexported fields }
DTDScanner represents a DTD scanner
func NewScanner ¶
func NewScanner(path string, s string, log *zap.SugaredLogger) *DTDScanner
NewScanner returns a new DTD Scanner
func (*DTDScanner) ParseAttlist ¶
func (sc *DTDScanner) ParseAttlist(s *sentence) *DTD.Attlist
ParseAttlist Use the information in the sentence to return a pointer to a DTD.Attlist
[52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' [53] AttDef ::= S Name S AttType S DefaultDecl
func (*DTDScanner) ParseComment ¶
func (sc *DTDScanner) ParseComment(s *sentence) *DTD.Comment
ParseComment Use the information in the sentence to return a pointer to a DTD.Comment
func (*DTDScanner) ParseElement ¶
func (sc *DTDScanner) ParseElement(s *sentence) *DTD.Element
ParseEntity Use the information in the sentence to return a pointer to a DTD.Element @ref https://www.w3.org/TR/xml11/#elemdecls
Element Declaration [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' [VC: Unique Element Type Declaration] [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children
func (*DTDScanner) ParseEntity ¶
func (sc *DTDScanner) ParseEntity(s *sentence) *DTD.Entity
ParseEntity Use the information in the sentence to return a pointer to a DTD.Entity @ref https://www.w3.org/TR/xml11/#sec-entity-decl
Entity Declaration [70] EntityDecl ::= GEDecl | PEDecl [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>' [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>' [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) [74] PEDef ::= EntityValue | ExternalID
func (*DTDScanner) ParseNotation ¶
func (sc *DTDScanner) ParseNotation(s *sentence) *DTD.Notation
ParseNotation Use the information in the sentence to return a pointer to a DTD.Notation @ref https://www.w3.org/TR/xml11/#Notations
Element Declaration ¶
[82] NotationDec ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>' [VC: Unique Notation Name] [83] PublicID ::= 'PUBLIC' S PubidLiteral