We have
FromDom
and
ToXML
instance generated for us. That's because
we instructed xml-isogen to generate them using the ParserAndGenerator noun. You can specify
also Parser or Generator if you want only one of them.

The _xpEmail field is optional; that's because we prefixed it with ? modifier.
Here is the list of possible modifiers that affect types:

Modifier

Description

Generated Type

!

required

a

?

optional

Maybe a

*

repeated

[a]

+

nonempty

NonEmpty a

Supported types

Fields in a record may have any types as long as they are instances of Eq, Show,
NFData, FromDom (for the parser) and ToXml (for the generator). Remember
though that TemplateHaskell requires types to be available before they are used
in a splice.

You can omit field types altogether, in that case the type will be assumed to be a
capitalized field name with an Xml prefix.
It's your responsibility to make sure that type exists.
Example:

You can model this with an "append content" modifier ^. It will instruct
xml-isogen to append content of the field as it is, without wrapping it
into an XML element. For our case it may look like this:

Nillable types

Sometimes optional element in XML are encoded using nil="true" attribute instead of
omitting the element. (The nil attribute comes from http://www.w3.org/2001/XMLSchema-instance namespace). With xml-isogen you handle it using the Nillable type: