xml

package
v0.0.0-...-827bfe2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package xml is part of the go-fastreport library, a pure Go port of FastReport .NET.

Package xml provides an XML data source for go-fastreport. It is the Go equivalent of FastReport.Data.XmlDataConnection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionStringBuilder

type ConnectionStringBuilder struct {
	// contains filtered or unexported fields
}

func NewConnectionStringBuilder

func NewConnectionStringBuilder(connectionString string) *ConnectionStringBuilder

func (*ConnectionStringBuilder) Build

func (b *ConnectionStringBuilder) Build() string

Build serialises the builder state to a connection string.

func (*ConnectionStringBuilder) Codepage

func (b *ConnectionStringBuilder) Codepage() int

func (*ConnectionStringBuilder) SetCodepage

func (b *ConnectionStringBuilder) SetCodepage(n int)

SetCodepage sets the code page number.

func (*ConnectionStringBuilder) SetXmlFile

func (b *ConnectionStringBuilder) SetXmlFile(v string)

SetXmlFile sets the path to the XML data file.

func (*ConnectionStringBuilder) SetXsdFile

func (b *ConnectionStringBuilder) SetXsdFile(v string)

SetXsdFile sets the path to the XSD schema file.

func (*ConnectionStringBuilder) XmlFile

func (b *ConnectionStringBuilder) XmlFile() string

func (*ConnectionStringBuilder) XsdFile

func (b *ConnectionStringBuilder) XsdFile() string

type XMLDataSource

type XMLDataSource struct {
	data.BaseDataSource
	// contains filtered or unexported fields
}

XMLDataSource is a DataSource backed by an XML file or string. It reads a list of repeating child elements and exposes their attributes and child text content as columns.

Configuration:

  • SetFilePath / SetXML — source of XML input
  • SetRootPath — slash-separated path to the repeating element container e.g. "Customers" finds <Customers> under the root element
  • SetRowElement — local name of each row element (default: first child tag)

Column values come from:

  1. Element attributes: <Item Name="Alice" Age="30"/>
  2. Child element text: <Item><Name>Alice</Name><Age>30</Age></Item>

func New

func New(name string) *XMLDataSource

New creates an XMLDataSource with the given name.

func (*XMLDataSource) FilePath

func (x *XMLDataSource) FilePath() string

FilePath returns the XML file path.

func (*XMLDataSource) Init

func (x *XMLDataSource) Init() error

Init reads and parses the XML, populating the row store.

func (*XMLDataSource) RootPath

func (x *XMLDataSource) RootPath() string

RootPath returns the root path.

func (*XMLDataSource) RowElement

func (x *XMLDataSource) RowElement() string

RowElement returns the configured row element name.

func (*XMLDataSource) SetFilePath

func (x *XMLDataSource) SetFilePath(path string)

SetFilePath sets the path to an XML file as the data source.

func (*XMLDataSource) SetRootPath

func (x *XMLDataSource) SetRootPath(path string)

SetRootPath sets a slash-separated path to the container element. e.g. "Customers" finds the first <Customers> child of the root. e.g. "Orders/Items" finds <Items> inside <Orders>.

func (*XMLDataSource) SetRowElement

func (x *XMLDataSource) SetRowElement(name string)

SetRowElement sets the local element name used to identify row elements. If empty, the first child element name under the container is used.

func (*XMLDataSource) SetXML

func (x *XMLDataSource) SetXML(s string)

SetXML sets a raw XML string as the data source.

func (*XMLDataSource) XML

func (x *XMLDataSource) XML() string

XML returns the raw XML string.

Jump to

Keyboard shortcuts

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