coerceArgumentCode: Create R code to coerce an R value to a value appropriate for...

coerceArgumentCodeR Documentation

Create R code to coerce an R value to a value appropriate for an XML Schema type

Description

This function is used to generate an R expression/command that will coerce an R value to another R value that corresponds to an XML schema type. The resulting value can then be serialized to XML, e.g. in a Web service (e.g. SSOAP) request

This function is used when programmatically generating R functions to interface to Web services and other facilities which involve serializing R values from users to XML.

Usage

coerceArgumentCode(id, type)

Arguments

id

the name of the variable to be coerced

type

the SchemaType-class describing the XML schema type expected.

Value

A string or R expression giving the R command to convert id.

Author(s)

Duncan Temple Lang

Examples

  tt = SchemaType("int", nsuri = "http://www.w3.org/2001/XMLSchema", obj = new("PrimitiveSchemaType"))
  coerceArgumentCode("x", tt)

  tt = SchemaType("string", nsuri = "http://www.w3.org/2001/XMLSchema", obj = new("PrimitiveSchemaType"))
  coerceArgumentCode("x", tt)

  tt = SchemaType("Hybrid", nsuri = "http://www.w3.org/2001/XMLSchema", obj = new("SchemaType"))
  coerceArgumentCode("x", tt)

omegahat/XMLSchema documentation built on Jan. 17, 2024, 7:08 p.m.