package xml
import "github.com/jphsd/xml"
Package xml contains functions which wrap encoding/xml.Decoder in the standard library.
Index ¶
Types ¶
type Element ¶
type Element struct { Type TT // Node or Content Name xml.Name // Node name Attributes map[string]string // Node attributes Content xml.CharData // CDATA content Parent *Element // Parent node Children []*Element // List of child nodes and contents for this node }
Element is used to form the tree structure of the Document Object Model.
func (*Element) Copy ¶
Copy returns a deep copy of this element and its children.
type TT ¶
type TT int
TT represents the element type.
type XMLDecoder ¶
type XMLDecoder struct { Decoder *xml.Decoder StartElement func(token xml.StartElement) error EndElement func(token xml.EndElement) error CharData func(token xml.CharData) error Comment func(token xml.Comment) error ProcInst func(token xml.ProcInst) error Directive func(token xml.Directive) error }
XMLDecoder is a wrapper around xml.Decoder and holds the functions to be called when tokens are encountered. Functions that are left as nil are skipped by Process().
func NewXMLDecoder ¶
func NewXMLDecoder(r io.Reader) *XMLDecoder
NewXMLDecoder creates a new XMLDecoder that will read from the supplied io.Reader.
func (*XMLDecoder) BuildDOM ¶
func (d *XMLDecoder) BuildDOM() (*Element, error)
BuildDOM inserts its own functions into the decoder in order to build the Domain Object Model.
func (*XMLDecoder) Process ¶
func (d *XMLDecoder) Process() error
Process performs the tokenization of the reader data and calls the user supplied functions.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
svg |
- Version
- v0.0.0-20240110053338-c96282f4e145 (latest)
- Published
- Jan 10, 2024
- Platform
- linux/amd64
- Imports
- 2 packages
- Last checked
- now –
Tools for package owners.