The functions decode a given XML object to an R representation, which can be an object of a specific class, a list, a named character vector, …

parseFile(sos, file, verbose = FALSE, ...)
parseCSV(obj, verbose = FALSE)
parseNoParsing(obj)
parseCategoryObservation(obj, sos, verbose = FALSE)
parseComplexObservation(obj, sos, verbose = FALSE)
parseComponent(obj, verbose = FALSE)
parseCompositePhenomenon(obj, verbose = FALSE)
parseCountObservation(obj, sos, verbose = FALSE)
parseDataArray(obj, sos, verbose = FALSE)
parseElementType(obj, sos, verbose = FALSE)
parseEncoding(obj, sos, verbose = FALSE)
parseFeatureCollection(obj, sos)
parseField(obj, sos, verbose = FALSE)
parseFOI(obj, sos, verbose = FALSE)
parseGeometryObservation(obj, sos, verbose = FALSE)
parseMeasure(obj)
parseMeasurement(obj, sos, verbose = FALSE)
parseObservation(obj, sos, verbose = FALSE)
parseObservationCollection(obj, sos, verbose)
parseOM(obj, sos, verbose = FALSE)
parseOwsException(obj)
parseOwsExceptionReport(obj, verbose = FALSE)
parseOwsOperation(obj, namespaces = SosAllNamespaces())
parseOwsRange(obj)
parseOwsServiceIdentification(obj, namespaces = SosAllNamespaces())
parseOwsServiceProvider(obj)
parsePhenomenonProperty(obj, verbose = FALSE)
parsePoint(obj, sos)
parsePosition(obj, sos)
parseResult(obj, sos, verbose = FALSE)
parseSamplingPoint(obj, sos)
parseSensorML(obj, sos, verbose = FALSE)
parseSosCapabilities(obj, sos)
parseSosFilter_Capabilities(obj, sos)
parseSosObservationOffering(obj, sos)
parseTemporalObservation(obj, sos, verbose = FALSE)
parseTextBlock(obj)
parseTimeGeometricPrimitiveFromParent(obj, format)
parseTimeInstant(obj, format)
parseTimeInstantProperty(obj, format)
parseTimePeriod(obj, format)
parseTimePosition(obj, format)
parseTimeObject(obj, format, timeObjectMap = list(), verbose = FALSE)
parseTruthObservation(obj, sos, verbose = FALSE)
parseValues(values, fields, encoding, sos, verbose = FALSE)

Arguments

obj

The object to decode, normally objects of either xml_document.

sos

An object of class SOS-class, which may be utilized/required by some parsing functions to access other parsing functions or encoding information.

verbose

A boolean value indication whether information is printed out to the console during the process - potentially a lot of output!

namespaces

A vector of namespace prefixes and definitions to use.

format

A character string defining the time format to be used in strptime.

values

The values to be parsed in parseValues(...).

fields

Field information in parseValues(...), a named list.

file

Name of the file to be parsed in sosParse(...).

encoding

Encoding information in parseValues(...), an object of class SweTextBlock.

timeObjectMap

A named list of time objects passed on during parsing (name is the id) to resolve in-document references.

...

Additional arguments that are parsed to xmlParse(...) in sosParse(...).

Details

The naming of the functions follow the following rule: parse[optional: namespace prefix][name of the XML element to be parsed]

Not all parsing function that have a SOS object or verbose in their signature, but few actually use it at this points of development. Some of the parsing functions are exchangeable when creating a new SOS connection. Please see the examples!

parseOM is a special function in the respect that it matches sub parsing function depending on an objects xmlName from the list of the given SOS's parsing functions.

parseNoParsing is a convenience function that directly returns the object without any changes.

sosParse allows parsing of files for all elements that have a parsers registered with the given SOS.

Value

An objects of a specific class depending on the parsing method and the passed object, possibly even lists or named character vectors.

Warning

Functions might result in error if parsed an object of the wrong type, because that is normally not checked.

Some of the functions are placeholders for future implementations!

See also

Examples

# parsing a XML string to an exception report object er.doc <- xml2::read_xml(paste0("<ows:ExceptionReport xmlns:ows=\"http://www.opengis.net/ows/1.1\"", " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" version=\"1.0.0\"", " xsi:schemaLocation=\"http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd\">", "<ows:Exception exceptionCode=\"VersionNegotiationFailed\" locator=\"AcceptVersions\">", "<ows:ExceptionText>The parameter 'AcceptVersions' does not contain the version", " of this SOS: '1.0.0'</ows:ExceptionText></ows:Exception></ows:ExceptionReport>")) er.parsed <- parseOwsExceptionReport(er.doc) print(er.parsed)
#> Object of class OwsExceptionReport; version: 1.0.0; lang: NA; #> 1 exception(s) (code @ locator : text): #> VersionNegotiationFailed @ AcceptVersions : #> The parameter 'AcceptVersions' does not contain the version of this SOS: '1.0.0' #>
str(er.parsed)
#> Formal class 'OwsExceptionReport' [package "sos4R"] with 3 slots #> ..@ version : chr "1.0.0" #> ..@ lang : chr NA #> ..@ exceptions:List of 1 #> .. ..$ :Formal class 'OwsException' [package "sos4R"] with 3 slots #> .. .. .. ..@ exceptionCode: chr "VersionNegotiationFailed" #> .. .. .. ..@ exceptionText: chr "The parameter 'AcceptVersions' does not contain the version of this SOS: '1.0.0'" #> .. .. .. ..@ locator : chr "AcceptVersions"
# NOT RUN { # save and re-parse an observation from file obsId <- getObservationById(sos = mySOS, observationId = "o_3508493", saveOriginal = TRUE) .files <- list.files(getwd()) .startWithO_ <- .files %in% grep("o_", .files, value=TRUE) .observationFiles <- subset(.files, .startWithO_) obsId <- parseFile(sos = mySOS, file = .observationFiles[[1]]) # }