AntaniXml


AntaniXml

AntaniXml Namespace

TypeDescription
CustomGenerators
IXmlElementGenerator

Random generator of xml elements based on a schema definition

Schema

This is the public API of AntaniXml. It provides random generators for global elements defined in the given Xml Schema.

ModuleDescription
AtomicGenerators

This module provides generators for simple (atomic) data types. Generation of random values is mainly based on FsCheck generators. Each simple datatype is mapped to a suitable CLR type (e.g. xs:int to System.Int32, xs:integer to System.Numerics.BigInteger...) for which an FsCheck generator already exists or can be easily built.

ConstrainedGenerators

This module provides support for simple types featuring multiple facets. For example when a simple type has both a Length facet and a pattern.

Customization
FacetBasedGenerators

This module provides generators supporting the facets defined in XML schema.

LexicalMappings

This module contains whitespace handling and also parse and format functions for simple datatypes. In W3C terms, parse is a map from the lexical space to the value space of a given datatype. Usually we implement it relying on System.XmlConvert. The format function instead maps values to lexical representations. It returns a string list because the same value may have multiple representations (e.g. a plus sign may optionally prefix a number). Note: this module is not complete yet, furthermore its design may change in future versions.

XmlGenerator

This is where elements and types (simple and complex) defined in a schema are mapped to random generators. Complex generators are composed using FsCheck combinators.

XsdDomain

This module provides types to represent a schema. F# data types like discriminated unions allow for very clear definitions. The W3C XML Schema specification http://www.w3.org/XML/Schema is rich and complex, so this module provides a simplified view. Nevertheless, we cover a few specific (and sometimes tricky) concepts, like nillable values, fixed values, union and list for simple types, whitespace handling etc.

XsdFactory

This module is in charge of parsing xsd and creating models according to XsdDomain data types. Parsing xsd is a complex task, and for this we rely on the .NET BCL library (namespace System.Xml.Schema). Converting the Schema Object Model (SOM) provided by the BCL library into our own simpler model allows decoupling of parsing xsd and building generators.

Fork me on GitHub