readSchema             package:XMLSchema             R Documentation

_R_e_a_d _t_h_e _g_i_v_e_n _X_M_L _s_c_h_e_m_a _a_n_d _p_r_o_c_e_s_s _t_h_e _c_o_n_t_e_n_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     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.

_U_s_a_g_e:

     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)

_A_r_g_u_m_e_n_t_s:

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'.

_V_a_l_u_e:

     A list containing the elements.  If the schema contains other
     schema, the result is a SchemaCollection.

_A_u_t_h_o_r(_s):

     Duncan Temple Lang

_R_e_f_e_r_e_n_c_e_s:

     The XML schema specification at <URL:
     http://www.w3.org/XML/Schema>. A tutorial at <URL:
     http://www.w3schools.com/Schema/default.asp>. Book ``The
     definitive XML Schema'', Priscilla Walmsley, Prentice Hall.

_S_e_e _A_l_s_o:

     'processSchemaTypes' 'xmlParse'

_E_x_a_m_p_l_e_s:

      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")

