readSchema | 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 parsed
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 = FALSE, verbose = FALSE,
namespaces = c(ws = "http://schemas.xmlsoap.org/wsdl/",
xs = "http://www.w3.org/2001/XMLSchema"),
followImports = TRUE, followIncludes = followImports,
asNode = is(filename, "XMLInternalNode") &&
(is(filename, "AsIs") || xmlName(filename) == "schema"),
checkCircularTypes = TRUE, ...)
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
|
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 |
namespaces |
a character vector giving the |
followImports,followIncludes |
see |
asNode |
a logical value that specifies whether the
|
... |
additional parameters that are passed on to |
checkCircularTypes |
a logical value that controls whether we check for circular references in the defitions of data types, e.g. where type B has a field of type A and type A has a field of type B or perhaps more indirectly via a separate type C. |
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.
processSchemaTypes
xmlParse
f = system.file("samples", "egquery.xsd", package = "XMLSchema")
x = readSchema(f, createConverters = FALSE)
names(x)
sapply(x, class)
dir = system.file("samples", package = "XMLSchema")
files = list.files(dir, pattern = "\\.xsd$", full.names = TRUE)
els = lapply(files, function(x) {
print(x)
readSchema(x, createConverters = FALSE, verbose = TRUE)
})
sapply(els, length)
sapply(els, names)
library(RCurl)
if(url.exists("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl"))
z = readSchema("http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.