Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diff ¶ added in v1.0.1
type Diff struct {
Path string // The XPath where the difference was found
LeftValue string // Value in the left XMLMap (empty if path doesn't exist)
RightValue string // Value in the right XMLMap (empty if path doesn't exist)
Type DiffType // Type of difference
}
Diff represents a difference between two XMLMaps
type DiffType ¶ added in v1.0.1
type DiffType int
DiffType indicates the type of difference between XMLMaps
type Option ¶
type Option func(*ParseOptions)
Option is a function that configures ParseOptions
func WithNamespaces ¶
WithNamespaces returns an Option that enables namespace prefix inclusion
func WithValueTransform ¶
WithValueTransform returns an Option that sets a function to transform values during parsing
type ParseOptions ¶
type ParseOptions struct {
// IncludeNamespaces controls whether namespace prefixes should be included in element and attribute names
IncludeNamespaces bool
// ValueTransform is a function that transforms each value during parsing
ValueTransform func(string) string
}
ParseOptions configures how XML should be parsed
func DefaultParseOptions ¶
func DefaultParseOptions() *ParseOptions
DefaultParseOptions returns the default parsing options
type XMLMap ¶
XMLMap represents a map of XPath expressions to their values
func ParseToMap ¶
ParseToMap parses XML from the reader and returns a map of XPath expressions to values. It accepts optional configuration through Option functions. The resulting map contains XPath expressions as keys and their corresponding values. For elements with attributes, the attribute paths are prefixed with "@". For repeated elements, indices are added to the path (e.g., /root/item[1], /root/item[2]).
func (XMLMap) Diffs ¶ added in v1.0.1
Diffs returns a list of differences between two XMLMaps It compares exact paths and values, considering element order
func (XMLMap) DiffsIgnoreOrder ¶ added in v1.0.1
DiffsIgnoreOrder returns a list of differences between two XMLMaps, ignoring element order
func (XMLMap) EqualIgnoreOrder ¶
EqualIgnoreOrder returns true if two XMLMaps are equal ignoring the order of elements