xml

package module
Version: v0.0.0-...-7dceff5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: BSD-2-Clause Imports: 2 Imported by: 0

README

XML

GoDoc Chat License

An experimental XML library in Go.

To use it in your project, import it like so:

import mellium.im/xml

If you'd like to contribute to the project, see CONTRIBUTING.md.

License

The package may be used under the terms of the BSD 2-Clause License a copy of which may be found in the file "LICENSE".

Unless you explicitly state otherwise, any contribution submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

Documentation

Overview

Package xml contains experimental XML functionality.

This package may be deprecated or removed at any time.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Split

func Split(data []byte, atEOF bool) (advance int, token []byte, err error)

Split is a bufio.SplitFunc that splits on XML tokens.

Example

Use a Scanner to split a byte stream on possible XML tokens.

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"

	"mellium.im/xml"
)

func main() {
	scanner := bufio.NewScanner(strings.NewReader(`<root>
  <foo test="split me"/>
</root>`))
	scanner.Split(xml.Split)
	for scanner.Scan() {
		fmt.Printf("%q ", scanner.Text())
	}
	if err := scanner.Err(); err != nil {
		fmt.Fprintln(os.Stderr, "shouldn't see an error scanning a string")
	}
}
Output:

"<root>" "\n  " "<foo test=\"split me\"/>" "\n" "</root>"

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to