package rdfloader

import "github.com/spdx/gordf/rdfloader/xmlreader"

Index

Constants

const WHITESPACE uint64 = 1<<'\t' | 1<<'\n' | 1<<'\r' | 1<<' '

Types

type Attribute

type Attribute struct {
	Name       string
	SchemaName string
	Value      string
}

An attribute is of the form schemaName:tagName="value" which exists inside an opening tag. For example:- If the opening tag is:

	<rdf:RDF
		xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    	xmlns:doap="http://usefulinc.com/ns/doap#">

Attributes are given by :-

  1. SchemaName=xmlns, Name=rdf, Value=http://www.w3.org/1999/02/22-rdf-syntax-ns#
  2. SchemaName=xmlns, Name=doap, Value=http://usefulinc.com/ns/doap#

type Block

type Block struct {
	// A block is a valid sub-xml.
	// for example:
	// 		1. <tag />
	// 		2. <tag attr="attr" />
	//      3. <tag> value </tag>
	//      4. <parent> <child> value </child> </parent>
	OpeningTag Tag
	Value      string
	Children   []*Block
}

type Pair

type Pair struct {
	First  interface{}
	Second interface{}
}

type Tag

type Tag struct {
	SchemaName string
	Name       string
	Attrs      []Attribute
}

type XMLReader

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

func XMLReaderFromFileObject

func XMLReaderFromFileObject(fileObject *bufio.Reader) XMLReader

func XMLReaderFromFilePath

func XMLReaderFromFilePath(filePath string) (xmlReader XMLReader, err error)

func (*XMLReader) CloseFileObj

func (xmlReader *XMLReader) CloseFileObj()

func (*XMLReader) Read

func (xmlReader *XMLReader) Read() (rootBlock Block, err error)

Source Files

readerUtils.go xmlreader.go

Version
v0.0.0-20250128162952-000978ccd6fb (latest)
Published
Jan 28, 2025
Platform
linux/amd64
Imports
6 packages
Last checked
3 weeks ago

Tools for package owners.