Documentation ¶
Index ¶
- Constants
- Variables
- func Walk(n Node, f WalkFunc) error
- type Attribute
- func (n *Attribute) AddChild(cur Node) error
- func (n *Attribute) AddContent(b []byte) error
- func (n *Attribute) AddSibling(cur Node) error
- func (n Attribute) Content() []byte
- func (n Attribute) FirstChild() Node
- func (n *Attribute) IsDefault() bool
- func (n Attribute) LastChild() Node
- func (n Attribute) LocalName() string
- func (n Attribute) Name() string
- func (n *Attribute) NextAttribute() *Attribute
- func (n Attribute) NextSibling() Node
- func (n Attribute) OwnerDocument() *Document
- func (n Attribute) Parent() Node
- func (n Attribute) Prefix() string
- func (n Attribute) PrevSibling() Node
- func (n *Attribute) Replace(cur Node)
- func (n *Attribute) SetDefault(b bool)
- func (n *Attribute) SetNextSibling(cur Node)
- func (n *Attribute) SetOwnerDocument(doc *Document)
- func (n *Attribute) SetParent(cur Node)
- func (n *Attribute) SetPrevSibling(cur Node)
- func (n *Attribute) SetTreeDoc(doc *Document)
- func (n Attribute) Type() ElementType
- func (n Attribute) URI() string
- func (n Attribute) Value() string
- type AttributeDecl
- func (n *AttributeDecl) AddChild(cur Node) error
- func (n *AttributeDecl) AddContent(b []byte) error
- func (n *AttributeDecl) AddSibling(cur Node) error
- func (n AttributeDecl) Content() []byte
- func (n AttributeDecl) FirstChild() Node
- func (n AttributeDecl) LastChild() Node
- func (n AttributeDecl) LocalName() string
- func (n AttributeDecl) Name() string
- func (n AttributeDecl) NextSibling() Node
- func (n AttributeDecl) OwnerDocument() *Document
- func (n AttributeDecl) Parent() Node
- func (n AttributeDecl) PrevSibling() Node
- func (n *AttributeDecl) Replace(cur Node)
- func (n *AttributeDecl) SetNextSibling(cur Node)
- func (n *AttributeDecl) SetOwnerDocument(doc *Document)
- func (n *AttributeDecl) SetParent(cur Node)
- func (n *AttributeDecl) SetPrevSibling(cur Node)
- func (n *AttributeDecl) SetTreeDoc(doc *Document)
- func (n AttributeDecl) Type() ElementType
- type AttributeDefault
- type AttributeType
- type Comment
- func (n *Comment) AddChild(cur Node) error
- func (n *Comment) AddContent(b []byte) error
- func (n *Comment) AddSibling(cur Node) error
- func (n Comment) Content() []byte
- func (n Comment) Name() string
- func (n Comment) Namespace() *Namespace
- func (n Comment) Namespaces() []*Namespace
- func (n Comment) Prefix() string
- func (n *Comment) Replace(cur Node)
- func (n *Comment) SetNamespace(prefix, uri string, activate ...bool) error
- func (n *Comment) SetTreeDoc(doc *Document)
- func (n Comment) URI() string
- type DTD
- func (dtd *DTD) AddChild(cur Node) error
- func (dtd *DTD) AddContent(b []byte) error
- func (dtd *DTD) AddElementDecl(name string, typ ElementTypeVal, content *ElementContent) (*ElementDecl, error)
- func (dtd *DTD) AddEntity(name string, typ EntityType, publicID, systemID, content string) (*Entity, error)
- func (dtd *DTD) AddSibling(cur Node) error
- func (n DTD) Content() []byte
- func (n DTD) FirstChild() Node
- func (dtd *DTD) Free()
- func (dtd *DTD) GetElementDesc(name string) (*ElementDecl, bool)
- func (n DTD) LastChild() Node
- func (n DTD) LocalName() string
- func (dtd *DTD) LookupAttribute(name, prefix, elem string) (*AttributeDecl, bool)
- func (dtd *DTD) LookupElement(name, prefix string) (*ElementDecl, bool)
- func (dtd *DTD) LookupEntity(name string) (*Entity, bool)
- func (dtd *DTD) LookupParameterEntity(name string) (*Entity, bool)
- func (n DTD) Name() string
- func (n DTD) NextSibling() Node
- func (n DTD) OwnerDocument() *Document
- func (n DTD) Parent() Node
- func (n DTD) PrevSibling() Node
- func (dtd *DTD) RegisterAttribute(attr *AttributeDecl) error
- func (dtd *DTD) RemoveElement(name, prefix string)
- func (dtd *DTD) Replace(cur Node)
- func (n *DTD) SetNextSibling(cur Node)
- func (n *DTD) SetOwnerDocument(doc *Document)
- func (n *DTD) SetParent(cur Node)
- func (n *DTD) SetPrevSibling(cur Node)
- func (dtd *DTD) SetTreeDoc(doc *Document)
- func (n DTD) Type() ElementType
- type Document
- func (d *Document) AddChild(cur Node) error
- func (d *Document) AddContent(b []byte) error
- func (d *Document) AddEntity(name string, typ EntityType, externalID, systemID, content string) (*Entity, error)
- func (d *Document) AddSibling(n Node) error
- func (n Document) Content() []byte
- func (d *Document) CreateAttribute(name, value string, ns *Namespace) (attr *Attribute, err error)
- func (d *Document) CreateCharRef(name string) (*EntityRef, error)
- func (d *Document) CreateComment(value []byte) (*Comment, error)
- func (d *Document) CreateDTD() (*DTD, error)
- func (d *Document) CreateElement(name string) (*Element, error)
- func (d *Document) CreateElementContent(name string, etype ElementContentType) (*ElementContent, error)
- func (d *Document) CreateInternalSubset(name, externalID, systemID string) (*DTD, error)
- func (d *Document) CreateNamespace(prefix, uri string) (*Namespace, error)
- func (d *Document) CreatePI(target, data string) (*ProcessingInstruction, error)
- func (d *Document) CreateReference(name string) (*EntityRef, error)
- func (d *Document) CreateText(value []byte) (*Text, error)
- func (d *Document) Encoding() string
- func (d *Document) ExtSubset() *DTD
- func (n Document) FirstChild() Node
- func (d *Document) GetEntity(name string) (ent *Entity, found bool)
- func (d *Document) GetParameterEntity(name string) (*Entity, bool)
- func (d *Document) IntSubset() *DTD
- func (d *Document) InternalSubset() (*DTD, error)
- func (d *Document) IsMixedElement(name string) (bool, error)
- func (n Document) LastChild() Node
- func (n Document) LocalName() string
- func (n Document) Name() string
- func (n Document) NextSibling() Node
- func (n Document) OwnerDocument() *Document
- func (n Document) Parent() Node
- func (n Document) PrevSibling() Node
- func (d *Document) Replace(n Node)
- func (d *Document) SetDocumentElement(root Node) error
- func (n *Document) SetNextSibling(cur Node)
- func (n *Document) SetOwnerDocument(doc *Document)
- func (n *Document) SetParent(cur Node)
- func (n *Document) SetPrevSibling(cur Node)
- func (d *Document) SetTreeDoc(doc *Document)
- func (d *Document) Standalone() DocumentStandaloneType
- func (n Document) Type() ElementType
- func (d *Document) Version() string
- func (d *Document) XML(out io.Writer) error
- func (d Document) XMLString() (string, error)
- type DocumentStandaloneType
- type Dumper
- type Element
- func (n *Element) AddChild(cur Node) error
- func (n *Element) AddContent(b []byte) error
- func (n *Element) AddSibling(cur Node) error
- func (n Element) Attributes() []*Attribute
- func (n Element) Name() string
- func (n Element) Namespace() *Namespace
- func (n Element) Namespaces() []*Namespace
- func (n Element) Prefix() string
- func (n *Element) Replace(cur Node)
- func (n *Element) SetAttribute(name, value string) error
- func (n *Element) SetNamespace(prefix, uri string, activate ...bool) error
- func (n *Element) SetTreeDoc(doc *Document)
- func (n Element) URI() string
- func (n *Element) XML(out io.Writer) error
- func (n Element) XMLString() (string, error)
- type ElementContent
- type ElementContentOccur
- type ElementContentType
- type ElementDecl
- func (n *ElementDecl) AddChild(cur Node) error
- func (n *ElementDecl) AddContent(b []byte) error
- func (n *ElementDecl) AddSibling(cur Node) error
- func (n ElementDecl) Content() []byte
- func (n ElementDecl) FirstChild() Node
- func (n ElementDecl) LastChild() Node
- func (n ElementDecl) LocalName() string
- func (n ElementDecl) Name() string
- func (n ElementDecl) NextSibling() Node
- func (n ElementDecl) OwnerDocument() *Document
- func (n ElementDecl) Parent() Node
- func (n ElementDecl) PrevSibling() Node
- func (n *ElementDecl) Replace(cur Node)
- func (n *ElementDecl) SetNextSibling(cur Node)
- func (n *ElementDecl) SetOwnerDocument(doc *Document)
- func (n *ElementDecl) SetParent(cur Node)
- func (n *ElementDecl) SetPrevSibling(cur Node)
- func (n *ElementDecl) SetTreeDoc(doc *Document)
- func (n ElementDecl) Type() ElementType
- type ElementType
- type ElementTypeVal
- type Entity
- func (e *Entity) AddChild(cur Node) error
- func (e *Entity) AddContent(b []byte) error
- func (e *Entity) AddSibling(cur Node) error
- func (e *Entity) Checked() bool
- func (e *Entity) Content() []byte
- func (e *Entity) EntityType() int
- func (e *Entity) MarkChecked()
- func (n Entity) Name() string
- func (n Entity) Namespace() *Namespace
- func (n Entity) Namespaces() []*Namespace
- func (n Entity) Prefix() string
- func (e *Entity) Replace(cur Node)
- func (n *Entity) SetNamespace(prefix, uri string, activate ...bool) error
- func (e *Entity) SetOrig(s string)
- func (n *Entity) SetTreeDoc(doc *Document)
- func (n Entity) URI() string
- type EntityRef
- func (e *EntityRef) AddChild(cur Node) error
- func (e *EntityRef) AddContent(b []byte) error
- func (e *EntityRef) AddSibling(cur Node) error
- func (n EntityRef) Name() string
- func (n EntityRef) Namespace() *Namespace
- func (n EntityRef) Namespaces() []*Namespace
- func (n EntityRef) Prefix() string
- func (e *EntityRef) Replace(cur Node)
- func (n *EntityRef) SetNamespace(prefix, uri string, activate ...bool) error
- func (n *EntityRef) SetTreeDoc(doc *Document)
- func (n EntityRef) URI() string
- type EntityType
- type Enumeration
- type ErrAttrNotFound
- type ErrDTDDupToken
- type ErrParseError
- type ErrUnimplemented
- type LoadSubsetOption
- type Namespace
- type NamespaceContainer
- type Namespacer
- type Node
- type ParseOption
- type Parser
- type ProcessingInstruction
- func (p *ProcessingInstruction) AddChild(cur Node) error
- func (p *ProcessingInstruction) AddContent(b []byte) error
- func (p *ProcessingInstruction) AddSibling(cur Node) error
- func (n ProcessingInstruction) Content() []byte
- func (n ProcessingInstruction) FirstChild() Node
- func (n ProcessingInstruction) LastChild() Node
- func (n ProcessingInstruction) LocalName() string
- func (n ProcessingInstruction) Name() string
- func (n ProcessingInstruction) NextSibling() Node
- func (n ProcessingInstruction) OwnerDocument() *Document
- func (n ProcessingInstruction) Parent() Node
- func (n ProcessingInstruction) PrevSibling() Node
- func (p *ProcessingInstruction) Replace(cur Node)
- func (n *ProcessingInstruction) SetNextSibling(cur Node)
- func (n *ProcessingInstruction) SetOwnerDocument(doc *Document)
- func (n *ProcessingInstruction) SetParent(cur Node)
- func (n *ProcessingInstruction) SetPrevSibling(cur Node)
- func (p *ProcessingInstruction) SetTreeDoc(doc *Document)
- func (p *ProcessingInstruction) Type() ElementType
- type SubstitutionType
- type Text
- func (n *Text) AddChild(cur Node) error
- func (n *Text) AddContent(b []byte) error
- func (n *Text) AddSibling(cur Node) error
- func (n Text) Content() []byte
- func (n Text) Name() string
- func (n Text) Namespace() *Namespace
- func (n Text) Namespaces() []*Namespace
- func (n Text) Prefix() string
- func (n *Text) Replace(cur Node)
- func (n *Text) SetNamespace(prefix, uri string, activate ...bool) error
- func (n *Text) SetTreeDoc(doc *Document)
- func (n Text) URI() string
- type TreeBuilder
- func (t *TreeBuilder) AttributeDecl(ctxif sax.Context, eName string, aName string, typ int, deftype int, ...) error
- func (t *TreeBuilder) CDataBlock(_ sax.Context, data []byte) error
- func (t *TreeBuilder) Characters(ctxif sax.Context, data []byte) error
- func (t *TreeBuilder) Comment(ctxif sax.Context, data []byte) error
- func (t *TreeBuilder) ElementDecl(ctxif sax.Context, name string, typ int, content sax.ElementContent) error
- func (t *TreeBuilder) EndDTD(ctxif sax.Context) error
- func (t *TreeBuilder) EndDocument(ctxif sax.Context) error
- func (t *TreeBuilder) EndElementNS(ctxif sax.Context, localname, prefix, uri string) error
- func (t *TreeBuilder) EndEntity(ctxif sax.Context, name string) error
- func (t *TreeBuilder) EntityDecl(ctxif sax.Context, name string, typ int, publicID string, systemID string, ...) error
- func (t *TreeBuilder) Error(ctxif sax.Context, message string, args ...interface{}) error
- func (t *TreeBuilder) ExternalEntityDecl(ctxif sax.Context, name string, publicID string, systemID string) error
- func (t *TreeBuilder) ExternalSubset(ctxif sax.Context, name, eid, uri string) error
- func (t *TreeBuilder) GetEntity(ctxif sax.Context, name string) (ent sax.Entity, err error)
- func (t *TreeBuilder) GetExternalSubset(ctxif sax.Context, name string, baseURI string) error
- func (t *TreeBuilder) GetParameterEntity(ctxif sax.Context, name string) (sax.Entity, error)
- func (t *TreeBuilder) HasExternalSubset(ctxif sax.Context) (bool, error)
- func (t *TreeBuilder) HasInternalSubset(ctxif sax.Context) (bool, error)
- func (t *TreeBuilder) IgnorableWhitespace(ctxif sax.Context, content []byte) error
- func (t *TreeBuilder) InternalEntityDecl(ctxif sax.Context, name string, value string) error
- func (t *TreeBuilder) InternalSubset(ctxif sax.Context, name, eid, uri string) error
- func (t *TreeBuilder) IsStandalone(ctxif sax.Context) (bool, error)
- func (t *TreeBuilder) NotationDecl(ctxif sax.Context, name string, publicID string, systemID string) error
- func (t *TreeBuilder) ProcessingInstruction(ctxif sax.Context, target, data string) error
- func (t *TreeBuilder) Reference(ctxif sax.Context, name string) error
- func (t *TreeBuilder) ResolveEntity(ctxif sax.Context, publicID string, systemID string) (sax.ParseInput, error)
- func (t *TreeBuilder) SetDocumentLocator(ctxif sax.Context, loc sax.DocumentLocator) error
- func (t *TreeBuilder) SkippedEntity(ctxif sax.Context, name string) error
- func (t *TreeBuilder) StartDTD(ctxif sax.Context, name string, publicID string, systemID string) error
- func (t *TreeBuilder) StartDocument(ctxif sax.Context) error
- func (t *TreeBuilder) StartElementNS(ctxif sax.Context, localname, prefix, uri string, namespaces []sax.Namespace, ...) error
- func (t *TreeBuilder) StartEntity(ctxif sax.Context, name string) error
- func (t *TreeBuilder) UnparsedEntityDecl(ctxif sax.Context, name string, publicID string, systemID string, ...) error
- type WalkFunc
Constants ¶
const ( XMLNamespace = "http://www.w3.org/XML/1998/namespace" XMLNsPrefix = "xmlns" XMLPrefix = "xml" XMLTextNoEnc = "textnoenc" )
const ( StandaloneInvalidValue = -99 StandaloneExplicitYes = 1 StandaloneExplicitNo = 0 StandaloneNoXMLDecl = -1 StandaloneImplicitNo = -2 )
const MaxNameLength = 50000
const Version = `0.0.1`
Variables ¶
var ( ErrNilNode = errors.New("nil node") ErrInvalidOperation = errors.New("operation cannot be performed") ErrDuplicateAttribute = errors.New("duplicate attribute") )
var ( EntityLT = newEntity("lt", InternalPredefinedEntity, "", "", "<", "<") EntityGT = newEntity("gt", InternalPredefinedEntity, "", "", ">", ">") EntityAmpersand = newEntity("amp", InternalPredefinedEntity, "", "", "&", "&") EntityApostrophe = newEntity("apos", InternalPredefinedEntity, "", "", "'", "'") EntityQuote = newEntity("quot", InternalPredefinedEntity, "", "", `"`, """) )
var ( ErrAmpersandRequired = errors.New("'&' was required here") ErrAttrListNotFinished = errors.New("attrlist must finish with a ')'") ErrAttrListNotStarted = errors.New("attrlist must start with a '('") ErrAttributeNameRequired = errors.New("attribute namewas required here (ATTLIST)") ErrByteCursorRequired = errors.New("inconsistent state: required ByteCursor") ErrDocTypeNameRequired = errors.New("doctype name required") ErrDocTypeNotFinished = errors.New("doctype not finished") ErrDocumentEnd = errors.New("extra content at document end") ErrEOF = errors.New("end of file reached") ErrElementContentNotFinished = errors.New("element content not finished") ErrEmptyDocument = errors.New("start tag expected, '<' not found") ErrEntityNotFound = errors.New("entity not found") ErrEqualSignRequired = errors.New("'=' was required here") ErrGtRequired = errors.New("'>' was required here") ErrHyphenInComment = errors.New("'--' not allowed in comment") ErrInvalidChar = errors.New("invalid char") ErrInvalidComment = errors.New("invalid comment section") ErrInvalidCDSect = errors.New("invalid CDATA section") ErrInvalidDocument = errors.New("invalid document") ErrInvalidDTD = errors.New("invalid DTD section") ErrInvalidElementDecl = errors.New("invalid element declaration") ErrInvalidEncodingName = errors.New("invalid encoding name") ErrInvalidName = errors.New("invalid xml name") ErrInvalidProcessingInstruction = errors.New("invalid processing instruction") ErrInvalidVersionNum = errors.New("invalid version") ErrInvalidXMLDecl = errors.New("invalid XML declration") ErrInvalidParserCtx = errors.New("invalid parser context") ErrLtSlashRequired = errors.New("'</' is required") ErrMisplacedCDATAEnd = errors.New("misplaced CDATA end ']]>'") ErrNameTooLong = errors.New("name is too long") ErrNameRequired = errors.New("name is required") ErrNmtokenRequired = errors.New("nmtoken is required") ErrNotationNameRequired = errors.New("notation name expected in NOTATION declaration") ErrNotationNotFinished = errors.New("notation must finish with a ')'") ErrNotationNotStarted = errors.New("notation must start with a '('") ErrOpenParenRequired = errors.New("'(' is required") ErrPCDATARequired = errors.New("'#PCDATA' required") ErrPercentRequired = errors.New("'%' is required") ErrPrematureEOF = errors.New("end of document reached") ErrUndeclaredEntity = errors.New("undeclared entity") ErrSemicolonRequired = errors.New("';' is required") ErrSpaceRequired = errors.New("space required") ErrStartTagRequired = errors.New("start tag expected, '<' not found") ErrValueRequired = errors.New("value required") )
var ( ErrCDATANotFinished = errors.New("invalid CDATA section (premature end)") ErrCDATAInvalid = errors.New("invalid CDATA section") )
var ErrParseSucceeded = errors.New("parse succeeded")
Functions ¶
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
func (*Attribute) AddContent ¶
func (*Attribute) AddSibling ¶
func (Attribute) FirstChild ¶
func (n Attribute) FirstChild() Node
func (*Attribute) NextAttribute ¶
NextAttribute is a thin wrapper around NextSibling() so that the caller does not have to constantly type assert
func (Attribute) NextSibling ¶
func (n Attribute) NextSibling() Node
func (Attribute) OwnerDocument ¶
func (n Attribute) OwnerDocument() *Document
func (Attribute) PrevSibling ¶
func (n Attribute) PrevSibling() Node
func (*Attribute) SetDefault ¶
func (*Attribute) SetNextSibling ¶
func (n *Attribute) SetNextSibling(cur Node)
func (*Attribute) SetOwnerDocument ¶
func (n *Attribute) SetOwnerDocument(doc *Document)
func (*Attribute) SetPrevSibling ¶
func (n *Attribute) SetPrevSibling(cur Node)
func (*Attribute) SetTreeDoc ¶
func (Attribute) Type ¶
func (n Attribute) Type() ElementType
type AttributeDecl ¶
type AttributeDecl struct {
// contains filtered or unexported fields
}
AttributeDecl is an xml attribute delcaration from DTD
func (*AttributeDecl) AddChild ¶
func (n *AttributeDecl) AddChild(cur Node) error
func (*AttributeDecl) AddContent ¶
func (n *AttributeDecl) AddContent(b []byte) error
func (*AttributeDecl) AddSibling ¶
func (n *AttributeDecl) AddSibling(cur Node) error
func (AttributeDecl) FirstChild ¶
func (n AttributeDecl) FirstChild() Node
func (AttributeDecl) NextSibling ¶
func (n AttributeDecl) NextSibling() Node
func (AttributeDecl) OwnerDocument ¶
func (n AttributeDecl) OwnerDocument() *Document
func (AttributeDecl) PrevSibling ¶
func (n AttributeDecl) PrevSibling() Node
func (*AttributeDecl) Replace ¶
func (n *AttributeDecl) Replace(cur Node)
func (*AttributeDecl) SetNextSibling ¶
func (n *AttributeDecl) SetNextSibling(cur Node)
func (*AttributeDecl) SetOwnerDocument ¶
func (n *AttributeDecl) SetOwnerDocument(doc *Document)
func (*AttributeDecl) SetPrevSibling ¶
func (n *AttributeDecl) SetPrevSibling(cur Node)
func (*AttributeDecl) SetTreeDoc ¶
func (n *AttributeDecl) SetTreeDoc(doc *Document)
func (AttributeDecl) Type ¶
func (n AttributeDecl) Type() ElementType
type AttributeDefault ¶
type AttributeDefault int
const ( AttrDefaultInvalid AttributeDefault = iota AttrDefaultNone AttrDefaultRequired AttrDefaultImplied AttrDefaultFixed )
type AttributeType ¶
type AttributeType int
const ( AttrInvalid AttributeType = iota AttrCDATA AttrID AttrIDRef AttrIDRefs AttrEntity AttrEntities AttrNmtoken AttrNmtokens AttrEnumeration AttrNotation )
type Comment ¶
type Comment struct {
// contains filtered or unexported fields
}
Comment is just a wrapper around Node so that we can use Go-ish type checks
func (*Comment) AddContent ¶
func (*Comment) AddSibling ¶
AddSibling adds a new sibling to the end of the sibling nodes.
func (Comment) Namespaces ¶
func (n Comment) Namespaces() []*Namespace
func (*Comment) SetNamespace ¶
func (*Comment) SetTreeDoc ¶
type DTD ¶
type DTD struct {
// contains filtered or unexported fields
}
func (*DTD) AddContent ¶
func (*DTD) AddElementDecl ¶
func (dtd *DTD) AddElementDecl(name string, typ ElementTypeVal, content *ElementContent) (*ElementDecl, error)
func (*DTD) AddSibling ¶
func (DTD) FirstChild ¶
func (n DTD) FirstChild() Node
func (*DTD) GetElementDesc ¶
func (dtd *DTD) GetElementDesc(name string) (*ElementDecl, bool)
func (*DTD) LookupAttribute ¶
func (dtd *DTD) LookupAttribute(name, prefix, elem string) (*AttributeDecl, bool)
func (*DTD) LookupElement ¶
func (dtd *DTD) LookupElement(name, prefix string) (*ElementDecl, bool)
func (*DTD) LookupParameterEntity ¶
func (DTD) NextSibling ¶
func (n DTD) NextSibling() Node
func (DTD) OwnerDocument ¶
func (n DTD) OwnerDocument() *Document
func (DTD) PrevSibling ¶
func (n DTD) PrevSibling() Node
func (*DTD) RegisterAttribute ¶
func (dtd *DTD) RegisterAttribute(attr *AttributeDecl) error
func (*DTD) RemoveElement ¶
func (*DTD) SetNextSibling ¶
func (n *DTD) SetNextSibling(cur Node)
func (*DTD) SetOwnerDocument ¶
func (n *DTD) SetOwnerDocument(doc *Document)
func (*DTD) SetPrevSibling ¶
func (n *DTD) SetPrevSibling(cur Node)
func (*DTD) SetTreeDoc ¶
func (DTD) Type ¶
func (n DTD) Type() ElementType
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func CreateDocument ¶
func CreateDocument() *Document
func NewDocument ¶
func NewDocument(version, encoding string, standalone DocumentStandaloneType) *Document
func (*Document) AddContent ¶
func (*Document) AddSibling ¶
func (*Document) CreateAttribute ¶
func (*Document) CreateElementContent ¶
func (d *Document) CreateElementContent(name string, etype ElementContentType) (*ElementContent, error)
func (*Document) CreateInternalSubset ¶
func (*Document) CreateNamespace ¶
func (*Document) CreatePI ¶
func (d *Document) CreatePI(target, data string) (*ProcessingInstruction, error)
func (*Document) CreateReference ¶
func (Document) FirstChild ¶
func (n Document) FirstChild() Node
func (*Document) GetParameterEntity ¶
func (*Document) InternalSubset ¶
func (Document) NextSibling ¶
func (n Document) NextSibling() Node
func (Document) OwnerDocument ¶
func (n Document) OwnerDocument() *Document
func (Document) PrevSibling ¶
func (n Document) PrevSibling() Node
func (*Document) SetDocumentElement ¶
func (*Document) SetNextSibling ¶
func (n *Document) SetNextSibling(cur Node)
func (*Document) SetOwnerDocument ¶
func (n *Document) SetOwnerDocument(doc *Document)
func (*Document) SetPrevSibling ¶
func (n *Document) SetPrevSibling(cur Node)
func (*Document) SetTreeDoc ¶
func (*Document) Standalone ¶
func (d *Document) Standalone() DocumentStandaloneType
func (Document) Type ¶
func (n Document) Type() ElementType
type DocumentStandaloneType ¶
type DocumentStandaloneType int
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
Element is just a wrapper around Node so that we can use Go-ish type checks
func (*Element) AddContent ¶
func (*Element) AddSibling ¶
AddSibling adds a new sibling to the end of the sibling nodes.
func (Element) Attributes ¶
func (Element) Namespaces ¶
func (n Element) Namespaces() []*Namespace
func (*Element) SetAttribute ¶
func (*Element) SetNamespace ¶
func (*Element) SetTreeDoc ¶
type ElementContent ¶
type ElementContent struct {
// contains filtered or unexported fields
}
type ElementContentOccur ¶
type ElementContentOccur int
const ( ElementContentOnce ElementContentOccur = iota + 1 ElementContentOpt ElementContentMult ElementContentPlus )
type ElementContentType ¶
type ElementContentType int
const ( ElementContentPCDATA ElementContentType = iota + 1 ElementContentElement ElementContentSeq ElementContentOr )
type ElementDecl ¶
type ElementDecl struct {
// contains filtered or unexported fields
}
ElementDecl is an xml element declaration from DTD
func (*ElementDecl) AddChild ¶
func (n *ElementDecl) AddChild(cur Node) error
func (*ElementDecl) AddContent ¶
func (n *ElementDecl) AddContent(b []byte) error
func (*ElementDecl) AddSibling ¶
func (n *ElementDecl) AddSibling(cur Node) error
func (ElementDecl) FirstChild ¶
func (n ElementDecl) FirstChild() Node
func (ElementDecl) NextSibling ¶
func (n ElementDecl) NextSibling() Node
func (ElementDecl) OwnerDocument ¶
func (n ElementDecl) OwnerDocument() *Document
func (ElementDecl) PrevSibling ¶
func (n ElementDecl) PrevSibling() Node
func (*ElementDecl) Replace ¶
func (n *ElementDecl) Replace(cur Node)
func (*ElementDecl) SetNextSibling ¶
func (n *ElementDecl) SetNextSibling(cur Node)
func (*ElementDecl) SetOwnerDocument ¶
func (n *ElementDecl) SetOwnerDocument(doc *Document)
func (*ElementDecl) SetPrevSibling ¶
func (n *ElementDecl) SetPrevSibling(cur Node)
func (*ElementDecl) SetTreeDoc ¶
func (n *ElementDecl) SetTreeDoc(doc *Document)
func (ElementDecl) Type ¶
func (n ElementDecl) Type() ElementType
type ElementType ¶
type ElementType int
const ( ElementNode ElementType = iota + 1 AttributeNode TextNode CDATASectionNode EntityRefNode EntityNode ProcessingInstructionNode CommentNode DocumentNode DocumentTypeNode DocumentFragNode NotationNode HTMLDocumentNode DTDNode ElementDeclNode AttributeDeclNode EntityDeclNode NamespaceDeclNode XIncludeStartNode XIncludeEndNode // This doesn't exist in libxml2. Do we need it? NamespaceNode )
func (ElementType) String ¶
func (i ElementType) String() string
type ElementTypeVal ¶
type ElementTypeVal int
ElementTypeVal represents the different possibilities for an element content type.
const ( UndefinedElementType ElementTypeVal = iota EmptyElementType AnyElementType MixedElementType ElementElementType )
type Entity ¶
type Entity struct {
// contains filtered or unexported fields
}
func (*Entity) AddContent ¶
func (*Entity) AddSibling ¶
func (*Entity) EntityType ¶
func (*Entity) MarkChecked ¶
func (e *Entity) MarkChecked()
func (Entity) Namespaces ¶
func (n Entity) Namespaces() []*Namespace
func (*Entity) SetNamespace ¶
func (*Entity) SetTreeDoc ¶
type EntityRef ¶
type EntityRef struct {
// contains filtered or unexported fields
}
func (*EntityRef) AddContent ¶
func (*EntityRef) AddSibling ¶
func (EntityRef) Namespaces ¶
func (n EntityRef) Namespaces() []*Namespace
func (*EntityRef) SetNamespace ¶
func (*EntityRef) SetTreeDoc ¶
type EntityType ¶
type EntityType int
const ( InternalGeneralEntity EntityType = iota + 1 ExternalGeneralParsedEntity ExternalGeneralUnparsedEntity InternalParameterEntity ExternalParameterEntity InternalPredefinedEntity )
type Enumeration ¶
type Enumeration []string
type ErrAttrNotFound ¶
type ErrAttrNotFound struct {
Token string
}
func (ErrAttrNotFound) Error ¶
func (e ErrAttrNotFound) Error() string
type ErrDTDDupToken ¶
type ErrDTDDupToken struct {
Name string
}
func (ErrDTDDupToken) Error ¶
func (e ErrDTDDupToken) Error() string
type ErrParseError ¶
func (ErrParseError) Error ¶
func (e ErrParseError) Error() string
type ErrUnimplemented ¶
type ErrUnimplemented struct {
// contains filtered or unexported fields
}
func (ErrUnimplemented) Error ¶
func (e ErrUnimplemented) Error() string
type LoadSubsetOption ¶
type LoadSubsetOption int
const ( DetectIDs LoadSubsetOption = 1<<iota + 1 CompleteAttrs SkipIDs )
func (LoadSubsetOption) IsSet ¶
func (p LoadSubsetOption) IsSet(n LoadSubsetOption) bool
func (*LoadSubsetOption) Set ¶
func (p *LoadSubsetOption) Set(n LoadSubsetOption)
type NamespaceContainer ¶
type NamespaceContainer interface {
Namespaces() []*Namespace
}
type Namespacer ¶
type Namespacer interface { Namespace() *Namespace Namespaces() []*Namespace Prefix() string URI() string LocalName() string }
Nemaspacer is an interface for things that has a namespace prefix and uri
type Node ¶
type Node interface { AddChild(Node) error AddContent([]byte) error AddSibling(Node) error Content() []byte FirstChild() Node LastChild() Node Name() string NextSibling() Node OwnerDocument() *Document Parent() Node PrevSibling() Node Replace(Node) SetNextSibling(Node) SetOwnerDocument(doc *Document) SetParent(Node) SetPrevSibling(Node) SetTreeDoc(doc *Document) Type() ElementType // contains filtered or unexported methods }
type ParseOption ¶
type ParseOption int
const ( ParseRecover ParseOption = 1 << iota /* recover on errors */ ParseNoEnt /* substitute entities */ ParseDTDLoad /* load the external subset */ ParseDTDAttr /* default DTD attributes */ ParseDTDValid /* validate with the DTD */ ParseNoError /* suppress error reports */ ParseNoWarning /* suppress warning reports */ ParsePedantic /* pedantic error reporting */ ParseNoBlanks /* remove blank nodes */ // gap here: ParseSAX1 is not implemented ParseXInclude ParseOption = 1<<iota + 10 /* Implement XInclude substitition */ ParseNoNet /* Forbid network access */ ParseNoDict /* Do not reuse the context dictionnary */ ParseNsClean /* remove redundant namespaces declarations */ ParseNoCDATA /* merge CDATA as text nodes */ ParseNoXIncNode /* do not generate XINCLUDE START/END nodes */ ParseCompact /* compact small text nodes; no modification of the tree allowed afterwards (will possibly crash if you try to modify the tree) */ // ParseOld10 is not implemented ParseNoBaseFix /* do not fixup XINCLUDE xml:base uris */ ParseHuge /* relax any hardcoded limit from the parser */ // ParseOldSAX is not implemented ParseIgnoreEnc ParseOption = 1<<iota + 21 /* ignore internal document encoding hint */ ParseBigLines ParseOption = 1 << 22 /* Store big lines numbers in text PSVI field */ )
Note: Many of these are totally unimplemented at this point
func (ParseOption) IsSet ¶
func (p ParseOption) IsSet(n ParseOption) bool
func (*ParseOption) Set ¶
func (p *ParseOption) Set(n ParseOption)
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) SetSAXHandler ¶
func (p *Parser) SetSAXHandler(s sax.SAX2Handler)
type ProcessingInstruction ¶
type ProcessingInstruction struct {
// contains filtered or unexported fields
}
func (*ProcessingInstruction) AddChild ¶
func (p *ProcessingInstruction) AddChild(cur Node) error
func (*ProcessingInstruction) AddContent ¶
func (p *ProcessingInstruction) AddContent(b []byte) error
func (*ProcessingInstruction) AddSibling ¶
func (p *ProcessingInstruction) AddSibling(cur Node) error
func (ProcessingInstruction) FirstChild ¶
func (n ProcessingInstruction) FirstChild() Node
func (ProcessingInstruction) NextSibling ¶
func (n ProcessingInstruction) NextSibling() Node
func (ProcessingInstruction) OwnerDocument ¶
func (n ProcessingInstruction) OwnerDocument() *Document
func (ProcessingInstruction) PrevSibling ¶
func (n ProcessingInstruction) PrevSibling() Node
func (*ProcessingInstruction) Replace ¶
func (p *ProcessingInstruction) Replace(cur Node)
func (*ProcessingInstruction) SetNextSibling ¶
func (n *ProcessingInstruction) SetNextSibling(cur Node)
func (*ProcessingInstruction) SetOwnerDocument ¶
func (n *ProcessingInstruction) SetOwnerDocument(doc *Document)
func (*ProcessingInstruction) SetPrevSibling ¶
func (n *ProcessingInstruction) SetPrevSibling(cur Node)
func (*ProcessingInstruction) SetTreeDoc ¶
func (p *ProcessingInstruction) SetTreeDoc(doc *Document)
func (*ProcessingInstruction) Type ¶
func (p *ProcessingInstruction) Type() ElementType
type SubstitutionType ¶
type SubstitutionType int
const ( SubstituteNone SubstitutionType = iota SubstituteRef SubstitutePERef SubstituteBoth )
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text is just a wrapper around Node so that we can use Go-ish type checks
func (*Text) AddContent ¶
func (*Text) AddSibling ¶
func (Text) Namespaces ¶
func (n Text) Namespaces() []*Namespace
func (*Text) SetNamespace ¶
func (*Text) SetTreeDoc ¶
type TreeBuilder ¶
type TreeBuilder struct { }
func NewTreeBuilder ¶
func NewTreeBuilder() *TreeBuilder
func (*TreeBuilder) AttributeDecl ¶
func (*TreeBuilder) CDataBlock ¶
func (t *TreeBuilder) CDataBlock(_ sax.Context, data []byte) error
func (*TreeBuilder) Characters ¶
func (t *TreeBuilder) Characters(ctxif sax.Context, data []byte) error
func (*TreeBuilder) ElementDecl ¶
func (t *TreeBuilder) ElementDecl(ctxif sax.Context, name string, typ int, content sax.ElementContent) error
func (*TreeBuilder) EndDocument ¶
func (t *TreeBuilder) EndDocument(ctxif sax.Context) error
func (*TreeBuilder) EndElementNS ¶
func (t *TreeBuilder) EndElementNS(ctxif sax.Context, localname, prefix, uri string) error
func (*TreeBuilder) EndEntity ¶
func (t *TreeBuilder) EndEntity(ctxif sax.Context, name string) error
func (*TreeBuilder) EntityDecl ¶
func (*TreeBuilder) Error ¶
func (t *TreeBuilder) Error(ctxif sax.Context, message string, args ...interface{}) error
func (*TreeBuilder) ExternalEntityDecl ¶
func (*TreeBuilder) ExternalSubset ¶
func (t *TreeBuilder) ExternalSubset(ctxif sax.Context, name, eid, uri string) error
func (*TreeBuilder) GetExternalSubset ¶
func (*TreeBuilder) GetParameterEntity ¶
func (*TreeBuilder) HasExternalSubset ¶
func (t *TreeBuilder) HasExternalSubset(ctxif sax.Context) (bool, error)
func (*TreeBuilder) HasInternalSubset ¶
func (t *TreeBuilder) HasInternalSubset(ctxif sax.Context) (bool, error)
func (*TreeBuilder) IgnorableWhitespace ¶
func (t *TreeBuilder) IgnorableWhitespace(ctxif sax.Context, content []byte) error
func (*TreeBuilder) InternalEntityDecl ¶
func (*TreeBuilder) InternalSubset ¶
func (t *TreeBuilder) InternalSubset(ctxif sax.Context, name, eid, uri string) error
func (*TreeBuilder) IsStandalone ¶
func (t *TreeBuilder) IsStandalone(ctxif sax.Context) (bool, error)
func (*TreeBuilder) NotationDecl ¶
func (*TreeBuilder) ProcessingInstruction ¶
func (t *TreeBuilder) ProcessingInstruction(ctxif sax.Context, target, data string) error
func (*TreeBuilder) Reference ¶
func (t *TreeBuilder) Reference(ctxif sax.Context, name string) error
func (*TreeBuilder) ResolveEntity ¶
func (t *TreeBuilder) ResolveEntity(ctxif sax.Context, publicID string, systemID string) (sax.ParseInput, error)
func (*TreeBuilder) SetDocumentLocator ¶
func (t *TreeBuilder) SetDocumentLocator(ctxif sax.Context, loc sax.DocumentLocator) error
func (*TreeBuilder) SkippedEntity ¶
func (t *TreeBuilder) SkippedEntity(ctxif sax.Context, name string) error
func (*TreeBuilder) StartDocument ¶
func (t *TreeBuilder) StartDocument(ctxif sax.Context) error
func (*TreeBuilder) StartElementNS ¶
func (*TreeBuilder) StartEntity ¶
func (t *TreeBuilder) StartEntity(ctxif sax.Context, name string) error
func (*TreeBuilder) UnparsedEntityDecl ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package encoding wraps around the various encoding stuff in golang.org/x/text/encoding.
|
Package encoding wraps around the various encoding stuff in golang.org/x/text/encoding. |
internal
|
|
WARNING: This file is generated by gencbsax.pl
|
WARNING: This file is generated by gencbsax.pl |