DTD

package
v0.0.0-...-0cd33ab Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package DTD Representss main structs of a DTD

Specifications: https://www.w3.org/TR/xml11/

Found this reference very usefull: https://xmlwriter.net/xml_guide/attlist_declaration.shtml

This is a simplified implementation

This package offers one struct per DTD blocks Each struct will implements the IDTDBlock the IDTDBlock is necessary for the parser to populate and process its collection

Package DTD Represents main structs of a DTD

Package DTD Represents main structs of a DTD

Package DTD Represents main structs of a DTD

Package DTD Represents main structs of a DTD

Package DTD Represents main structs of a DTD

Package DTD Represents main structs of a DTD

Package DTD Represents main structs of a DTD

Index

Constants

View Source
const (
	// DTD Block type
	UNIDENTIFIED    = -1
	XMLDECL         = 0
	ATTRIBUTE       = 1
	COMMENT         = 3
	ELEMENT         = 4
	ENTITY          = 5
	PCDATA          = 6
	EXPORTED_ENTITY = 7
	ATTLIST         = 8
	NOTATION        = 9

	// string type
	CDATA = 20

	// Tokenized Attribute type
	TOKEN_ID       = 30
	TOKEN_IDREF    = 31
	TOKEN_IDREFS   = 32
	TOKEN_ENTITY   = 33
	TOKEN_ENTITIES = 34
	TOKEN_NMTOKEN  = 35
	TOKEN_NMTOKENS = 36

	//Enumerated Attribute Type:	Attribute Description:
	ENUM_NOTATION = 37
	ENUM_ENUM     = 38
)

Variables

This section is empty.

Functions

func AttributeType

func AttributeType(a int) string

AttributeType convert DTD Attribute type (int) to its corresponding string value

func IsAttlistType

func IsAttlistType(i interface{}) bool

IsAttlistType check if the interface is a DTD.Comment

func IsCommentType

func IsCommentType(i interface{}) bool

IsCommentType check if the interface is a DTD.Comment

func IsElementType

func IsElementType(i interface{}) bool

IsElementType check if the interface is a DTD.Element

func IsEntityType

func IsEntityType(i interface{}) bool

IsEntityType check if the interface is a DTD.ExportedEntity

func IsNotationType

func IsNotationType(i interface{}) bool

IsNotationType check if the interface is a DTD.Notation

func SeekAttributeType

func SeekAttributeType(s string) int

SeekAttributeType Attempt to identify attribute type

func Translate

func Translate(i int) string

Translate convert block type constant to a name

Types

type Attlist

type Attlist struct {
	Name       string
	Value      string
	Attributes []Attribute
	Entities   []string
}

Attlist represents an attlist

func (*Attlist) GetExported

func (a *Attlist) GetExported() bool

GetExported Unused, tells if the comment was exported implements IDTDBlock

func (*Attlist) GetExtra

func (a *Attlist) GetExtra() *DTDExtra

GetExtra Get extrainformation

func (*Attlist) GetName

func (a *Attlist) GetName() string

GetName Get the name implements IDTDBlock

func (*Attlist) GetValue

func (a *Attlist) GetValue() string

GetValue Get the value implements IDTDBlock

func (*Attlist) Render

func (a *Attlist) Render() string

Render an Attlist implements IDTDBlock

func (*Attlist) SetExported

func (a *Attlist) SetExported(v bool)

SetExported set the current entity to exported implements IDTDBlock

type Attribute

type Attribute struct {
	Name     string
	Type     int
	Default  string
	Value    string
	Implied  bool
	Required bool
	Fixed    bool
	IsEntity bool
}

Attribute represents an attribute

func (*Attribute) GetName

func (a *Attribute) GetName() string

GetExported Unused, tells if the comment was exported implements IDTDBlock

func (*Attribute) Render

func (a *Attribute) Render() string

Render an Attribute

type Comment

type Comment struct {
	Value    string
	Exported bool
}

Comment represents a comment

func (*Comment) GetExtra

func (c *Comment) GetExtra() *DTDExtra

GetExtra Get extrainformation

func (*Comment) GetName

func (c *Comment) GetName() string

GetName Get the name implements IDTDBlock

func (*Comment) GetValue

func (c *Comment) GetValue() string

GetValue Get the value implements IDTDBlock

func (*Comment) Render

func (c *Comment) Render() string

Render an entity implements IDTDBlock

func (*Comment) SetExported

func (c *Comment) SetExported(v bool)

SetExported set the current entity to exported implements IDTDBlock

type DTDExtra

type DTDExtra struct {
	IsPublic    bool
	IsSystem    bool
	IsExported  bool
	IsParameter bool
	Attributes  []Attribute
	Url         string
	PublicID    string
	SystemID    string
}

type Element

type Element struct {
	Name  string
	Value string
}

Element represents a DTD element

func (*Element) GetExtra

func (e *Element) GetExtra() *DTDExtra

GetExtra Get extrainformation

func (*Element) GetName

func (e *Element) GetName() string

GetName Get the name implements IDTDBlock

func (*Element) GetValue

func (e *Element) GetValue() string

GetValue Get the value implements IDTDBlock

func (*Element) Render

func (e *Element) Render() string

Render an Element implements IDTDBlock

func (*Element) SetExported

func (e *Element) SetExported(v bool)

SetExported set the current entity to exported implements IDTDBlock

type Entity

type Entity struct {
	Parameter  bool
	IsExternal bool
	IsInternal bool
	Name       string
	Value      string
	Public     bool
	System     bool
	Url        string
	Exported   bool
	Attributes []Attribute
}

Entity representss a DTD Entity

func (*Entity) GetExtra

func (e *Entity) GetExtra() *DTDExtra

GetExtra Get extrainformation

func (*Entity) GetName

func (e *Entity) GetName() string

GetName Get the name implements IDTDBlock

func (*Entity) GetValue

func (e *Entity) GetValue() string

GetValue Get the value implements IDTDBlock

func (Entity) MarshalLogObject

func (e Entity) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (Entity) Render

func (e Entity) Render() string

Render an entity implements IDTDBlock

func (*Entity) SetExported

func (e *Entity) SetExported(v bool)

SetExported set the current entity to exported implements IDTDBlock

type IDTDBlock

type IDTDBlock interface {
	GetName() string
	Render() string
	SetExported(v bool)
	GetValue() string
	GetExtra() *DTDExtra
}

IDTDBlock Interface for DTD block

type Notation

type Notation struct {
	Name     string
	Public   bool
	System   bool
	PublicID string
	SystemID string
}

Notation reprensents a notation

func (*Notation) GetExtra

func (n *Notation) GetExtra() *DTDExtra

GetExtra Get extrainformation

func (*Notation) GetName

func (n *Notation) GetName() string

GetName Get the name implements IDTDBlock

func (*Notation) GetValue

func (n *Notation) GetValue() string

GetValue Get the value implements IDTDBlock

func (*Notation) Render

func (n *Notation) Render() string

Render an Notation implements IDTDBlock <!NOTATION name SYSTEM "URI"> <!NOTATION name PUBLIC "public_ID"> <!NOTATION name PUBLIC "public_ID" "URI">

func (*Notation) SetExported

func (n *Notation) SetExported(v bool)

SetExported set the current entity to exported implements IDTDBlock

type XMLDecl

type XMLDecl struct {
	Version  string
	Encoding string
}

Attlist represents an attlist

func (*XMLDecl) GetExported

func (a *XMLDecl) GetExported() bool

GetExported Unused, tells if the comment was exported implements IDTDBlock

func (*XMLDecl) GetName

func (a *XMLDecl) GetName() string

GetName Get the name implements IDTDBlock

func (*XMLDecl) GetParameter

func (a *XMLDecl) GetParameter() bool

GetParameter return parameter for entity only implements IDTDBlock

func (*XMLDecl) GetUrl

func (a *XMLDecl) GetUrl() string

GetUrl the entity url implements IDTDBlock

func (*XMLDecl) GetValue

func (a *XMLDecl) GetValue() string

GetValue Get the value implements IDTDBlock

func (*XMLDecl) Render

func (a *XMLDecl) Render() string

Render an Attlist implements IDTDBlock

func (*XMLDecl) SetExported

func (a *XMLDecl) SetExported(v bool)

SetExported set the current entity to exported implements IDTDBlock

Jump to

Keyboard shortcuts

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