FSharp.Data.Xsd


Substitution Groups

XML Schema provides various extensibility mechanisms. The following example is a terse summary mixing substitution groups with abstract recursive definitions.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 
23: 
24: 
25: 
26: 
27: 
    type T = XmlProvider<Schema = """
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
          elementFormDefault="qualified" attributeFormDefault="unqualified">
	      <xs:element name="Formula" abstract="true"/>
	      <xs:element name="Prop" type="xs:string" substitutionGroup="Formula"/>
	      <xs:element name="And" substitutionGroup="Formula">
		    <xs:complexType>
			  <xs:sequence>
			    <xs:element ref="Formula" minOccurs="2" maxOccurs="2"/>
			  </xs:sequence>
		    </xs:complexType>
	      </xs:element>
        </xs:schema>""">

    let formula = T.Parse """
        <And>
            <Prop>p1</Prop>
            <And>
                <Prop>p2</Prop>
                <Prop>p3</Prop>
            </And>
        </And>
        """
    assert(formula.Props.[0] = "p1")
    assert(formula.Ands.[0].Props.[0] = "p2")
    assert(formula.Ands.[0].Props.[1] = "p3")
    

Substitution groups are like choices, and the type provider produces an optional property for each alternative.

Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Data

--------------------
namespace Microsoft.FSharp.Data
module Substitutions

from Substitutions
type T = XmlProvider<...>

Full name: Substitutions.Substitutions.T
type XmlProvider

Full name: FSharp.Data.XmlProvider


<summary>Typed representation of a XML file.</summary>
       <param name='Sample'>Location of a XML sample file or a string containing a sample XML document.</param>
       <param name='SampleIsList'>If true, the children of the root in the sample document represent individual samples for the inference.</param>
       <param name='Global'>If true, the inference unifies all XML elements with the same name.</param>
       <param name='Culture'>The culture used for parsing numbers and dates. Defaults to the invariant culture.</param>
       <param name='Encoding'>The encoding used to read the sample. You can specify either the character set name or the codepage number. Defaults to UTF8 for files, and to ISO-8859-1 the for HTTP requests, unless `charset` is specified in the `Content-Type` response header.</param>
       <param name='ResolutionFolder'>A directory that is used when resolving relative file references (at design time and in hosted execution).</param>
       <param name='EmbeddedResource'>When specified, the type provider first attempts to load the sample from the specified resource
          (e.g. 'MyCompany.MyAssembly, resource_name.xml'). This is useful when exposing types generated by the type provider.</param>
       <param name='InferTypesFromValues'>If true, turns on additional type inference from values.
          (e.g. type inference infers string values such as "123" as ints and values constrained to 0 and 1 as booleans. The XmlProvider also infers string values as JSON.)</param>
       <param name='Schema'>Location of a schema file or a string containing xsd.</param>
val formula : XmlProvider<...>.And

Full name: Substitutions.Substitutions.formula
XmlProvider<...>.Parse(text: string) : XmlProvider<...>.And


Parses the specified XML string
property XmlProvider<...>.And.Props: string []
property XmlProvider<...>.And.Ands: XmlProvider<...>.And []
Fork me on GitHub