Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*StreamExtractConverter) error
func AttributePrefix ¶
Attributes are flattened to become regular members of the converted json object. The supplied prefix will be added to the attribute name for visibility.
func ContentToken ¶
When attribtues become regular members of the converted json the xml's original value (innertext) needs a key. This token will be used for that - defaults to "value" in accordance with PESC json.
func ObjectsToExtract ¶
You must specify the objects/xml Types to be extracted and converted from the stream
func ProgressBar ¶
Pass the size of the stream to be read in order to display a progress-bar streamSize of 0 will mean no progress-bar displayed
Default is no progress bar
func SampleSize ¶
Working with big files it can be useful to limit output to a few examples, this sets how many objects will be output from the converter set size to 0 (default) for no restrictions
type Result ¶
Captures output from the converter Name: the class/type/object name of the converted entity Json: the generated json from the converter
type StreamExtractConverter ¶
type StreamExtractConverter struct {
// contains filtered or unexported fields
}
Reads from an xml stream (typically a file), extracts selected object types and converts them to xml. Steam() exposes a channel on which results are published as the stream is parsed
func NewStreamExtractConverter ¶
func NewStreamExtractConverter(r io.Reader, opts ...Option) (*StreamExtractConverter, error)
Initilaises the extractor with the stream to read and the data objects of interest
func (*StreamExtractConverter) Stream ¶
func (sec *StreamExtractConverter) Stream() chan Result
Invokes the parsing and converting of the input stream, and channel can be ranged over to collect json blob results