parse.Rd
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, ...
parseCSV(obj, verbose = FALSE) parseFile(sos, file, verbose = FALSE, ...) parseCategoryObservation(obj, sos, verbose = FALSE) parseComplexObservation(obj, sos, verbose = FALSE) parseComponent(obj, sos, verbose = FALSE) parseCompositePhenomenon(obj, sos, verbose = FALSE) parseCountObservation(obj, sos, verbose = FALSE) parseDataArray(obj, sos, verbose = FALSE) parseElementType(obj, sos, verbose = FALSE) parseEncoding(obj, sos, verbose = FALSE) parseEnvelope(obj, sos, namespaces = xml2::xml_ns(obj), 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) parseNoParsing(obj, sos) parseObservation(obj, sos, verbose = FALSE) parseObservationCollection(obj, sos, verbose) parseOM(obj, sos, verbose = FALSE) parseOwsException(obj, sos) parseOwsExceptionReport(obj, sos, verbose = FALSE) parseOwsOperation(obj, sos) parseOwsRange(obj) parseOwsServiceIdentification(obj, sos) parseOwsServiceProvider(obj, sos) parsePhenomenonProperty(obj, sos, 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, sos) parseTimeInstant(obj, sos) parseTimeInstantProperty(obj, sos) parseTimePeriod(obj, sos) parseTimePosition(obj, sos) parseTimeObject(obj, sos, verbose = FALSE) parseTruthObservation(obj, sos, verbose = FALSE) parseValues(values, fields, encoding, sos, verbose = FALSE) sosIsListFieldAvailable(listField) gmlGetReferencedNode(sos, doc, node, verbose = FALSE) gmlIsNodeReferenced(sos, node)
obj | The object to decode, normally objects of either |
---|---|
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. |
values | The values to be parsed in |
fields | Field information in |
file | Name of the file to be parsed in |
encoding | Encoding information in |
... | Additional arguments that are parsed to |
listField | Object checked to be of type |
doc | XML document. |
node | XML node. |
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!
Functions parsing time rely on the slot timeFormat
of SOS
objects.
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.
The parsing uses an internal cache to store within-document references to other nodes.
An objects of a specific class depending on the parsing method and the passed object, possibly even lists or named character vectors.
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!
# 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, sos = SOS_Test()) 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' #>#> 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"if (FALSE) { # 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]]) # list caches ls(get("sos4R_caches")) }