ex18

command
v0.0.0-...-6fe4f4e Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 4 Imported by: 0

README

Exercise 7.18 (P215)

Using the token-based decoder API, write a program that will read an arbitrary XML document and construct a tree of generic nodes that represents it. Nodes are of two kinds: CharData nodes represent text strings, and Element nodes represent named elements and their attributes. Each element node has a slice of child nodes.

You may find the following declarations helpful.

    import "encoding/xml"
    type Node interface{} // CharData or *Element
    type CharData string
    type Element struct {
        Type     xml.Name
        Attr     []xml.Attr
        Children []node
    }

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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