xmlparser

package
v0.0.0-...-9f630e6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UCUMData

type UCUMData struct {
	Units []Unit
	XML   XMLRoot
}

func Parse

func Parse(reader io.Reader) UCUMData

type Unit

type Unit struct {
	Code string
	// FullCode is a code with a prefix.
	FullCode  string
	Kind      string
	Metric    bool
	Magnitude *big.Rat
}

type XMLBaseUnit

type XMLBaseUnit struct {
	XMLConcept
	Property string `xml:"property"`
	Dim      rune   `xml:"dim"`
}

type XMLConcept

type XMLConcept struct {
	Code        string   `xml:"Code,attr"`
	CodeUC      string   `xml:"CODE,attr"`
	Name        []string `xml:"name"`
	PrintSymbol string   `xml:"printSymbol"`
}

type XMLFunction

type XMLFunction struct {
	Name  string  `xml:"name,attr"`
	Value float64 `xml:"value,attr"`
	Unit  string  `xml:"Unit,attr"`
}

type XMLPrefix

type XMLPrefix struct {
	XMLConcept
	Value XMLValue `xml:"value"`
}

type XMLRoot

type XMLRoot struct {
	Version      string        `xml:"version,attr"`
	Revision     string        `xml:"revision,attr"`
	RevisionDate string        `xml:"revision-date,attr"`
	Prefixes     []XMLPrefix   `xml:"prefix"`
	BaseUnits    []XMLBaseUnit `xml:"base-unit"`
	Units        []XMLUnit     `xml:"unit"`
}

type XMLUnit

type XMLUnit struct {
	XMLConcept
	Class       string   `xml:"class,attr"`
	IsSpecial   string   `xml:"isSpecial,attr"`
	IsArbitrary string   `xml:"isArbitrary,attr"`
	Metric      string   `xml:"isMetric,attr"`
	Property    string   `xml:"property"`
	Value       XMLValue `xml:"value"`
}

type XMLValue

type XMLValue struct {
	Unit     string      `xml:"Unit,attr"`
	Value    *big.Rat    `xml:"value,attr"`
	Function XMLFunction `xml:"function"`
}

func (*XMLValue) IsFunctional

func (v *XMLValue) IsFunctional() bool

Jump to

Keyboard shortcuts

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