| readSchema {XMLSchema} | R Documentation |
This is the top-level function for reading an XML schema.
It takes the name of the file to read or an already parse
XML document (e.g. via xmlParse or
xmlTreeParse) and
processes the nodes in the document to create R-level
descriptions of the schema's contents.
The function can be given a WSDL document (Web Service Language Description) used for describing SOAP servers. It then extracts the types node and uses that.
readSchema(filename, createConverters = TRUE, verbose = FALSE,
namespaces = c(ws = "http://schemas.xmlsoap.org/wsdl/",
xs = "http://www.w3.org/2001/XMLSchema"),
followImports = TRUE, followIncludes = followImports)
filename |
the name of the XML document containing the schema or a previously
parsed XML document. If this is a character string, it is passed to
parseSchemaDoc and on to xmlParse.
This allows the value to be the name of a file, the contents of a file, a compressed file or a
URL, including a "GET" URL, i.e. a URL with parameters specified via ? and separated
by &. |
createConverters |
a logical value indicating whether, for each type in the schema, to create the functions that convert an XML node to a corresponding R object. |
verbose |
a logical value indicating whether to emit information about
the element currently being processed. This is passed to processSchemaTypes. |
namespaces |
a character vector giving the prefix = URI
pairs for namespaces to be used in searching the XML document
for a schema types node. |
followImports,followIncludes |
see parseSchemaDoc. |
A list containing the elements. If the schema contains other schema, the result is a SchemaCollection.
Duncan Temple Lang
The XML schema specification at http://www.w3.org/XML/Schema. A tutorial at http://www.w3schools.com/Schema/default.asp. Book ``The definitive XML Schema'', Priscilla Walmsley, Prentice Hall.
f = system.file("samples", "egquery.xsd", package = "XMLSchema")
x = readSchema(f, createConverters = FALSE)
names(x)
sapply(x, class)
sapply(x, slot, "count")
dir = system.file("samples", package = "XMLSchema")
files = list.files(dir, pattern = "\\.xsd$", full.names = TRUE)
els = lapply(files, readSchema, createConverters = FALSE, verbose = TRUE, followImports = FALSE)
sapply(els, length)
sapply(els, names)
z = readSchema("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl")