Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: def76b9c82
Fetching contributors…

Cannot retrieve contributors at this time

4930 lines (4098 sloc) 283.386 kb
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">
<meta name=Originator content="Microsoft Word 11">
<link rel=File-List href="erlsom_bestanden/filelist.xml">
<link rel=Edit-Time-Data href="erlsom_bestanden/editdata.mso">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Erlsom</title>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="metricconverter"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="PlaceType"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="PlaceName"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="Street"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
name="address"/>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:DisplayBackgroundShape/>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:HyphenationZone>21</w:HyphenationZone>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
</w:LatentStyles>
</xml><![endif]--><!--[if !mso]><object
classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";}
h1
{margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:1;
font-size:16.0pt;
font-family:Arial;}
h2
{margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
mso-pagination:widow-orphan;
page-break-after:avoid;
mso-outline-level:2;
font-size:14.0pt;
font-family:Arial;
font-style:italic;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:11.0pt;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";}
p.MsoFootnoteText, li.MsoFootnoteText, div.MsoFootnoteText
{margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";}
p.MsoCaption, li.MsoCaption, div.MsoCaption
{margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";
font-weight:bold;}
span.MsoFootnoteReference
{vertical-align:super;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
{margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
text-align:center;
mso-pagination:widow-orphan;
font-size:16.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";
font-weight:bold;}
a:link, span.MsoHyperlink
{color:#0000CC;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
code
{font-family:"Courier New";
mso-ascii-font-family:"Courier New";
mso-fareast-font-family:"Times New Roman";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";}
p.copyright, li.copyright, div.copyright
{mso-style-name:copyright;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";}
span.code
{mso-style-name:code;
font-family:"Courier New";
mso-ascii-font-family:"Courier New";
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";}
span.SpellE
{mso-style-name:"";
mso-spl-e:yes;}
span.GramE
{mso-style-name:"";
mso-gram-e:yes;}
@page Section1
{size:595.3pt 841.9pt;
margin:70.9pt 70.9pt 70.9pt 70.9pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
/* List Definitions */
@list l0
{mso-list-id:1249509769;
mso-list-type:hybrid;
mso-list-template-ids:-466814868 1652719882 68354051 68354053 68354049 68354051 68354053 68354049 68354051 68354053;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Arial;
mso-fareast-font-family:"Times New Roman";}
@list l0:level2
{mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level3
{mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level4
{mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level5
{mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level6
{mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level7
{mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level8
{mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
@list l0:level9
{mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:Standaardtabel;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
</style>
<![endif]--><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="3074"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1"/>
</o:shapelayout></xml><![endif]-->
</head>
<body lang=NL link="#0000CC" vlink=purple style='tab-interval:35.4pt'>
<div class=Section1>
<p class=MsoTitle><span class=SpellE><span lang=EN-US style='mso-ansi-language:
EN-US'>Erlsom</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoTitle><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008875"><span
lang=EN-US style='mso-ansi-language:EN-US'>Introduction</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 1</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#example_xml"><span
lang=EN-US style='mso-ansi-language:EN-US'>Example XML document</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 8</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#sax_mode"><span lang=EN-US
style='mso-ansi-language:EN-US'>SAX Mode</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'> 8</span></a></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#sax_events"><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>SAX Events</span><span
lang=NO-BOK style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
NO-BOK;text-decoration:none;text-underline:none'>. 8</span></a></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#dom_mode"><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>Simple DOM Mode</span><span
lang=NO-BOK style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
NO-BOK;text-decoration:none;text-underline:none'> 8</span></a></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#data_binder_mode"><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>Data Binder Mode</span><span
lang=NO-BOK style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
NO-BOK;text-decoration:none;text-underline:none'> 8</span></a></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008877"><span
lang=EN-US style='mso-ansi-language:EN-US'>Installation</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 7</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008878"><span
lang=EN-US style='mso-ansi-language:EN-US'>Examples</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 7</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008881"><span
lang=EN-US style='mso-ansi-language:EN-US'>Character encoding</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 9</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008882"><span
lang=EN-US style='mso-ansi-language:EN-US'>Creation of atoms</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 10</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008883"><span
lang=EN-US style='mso-ansi-language:EN-US'>Limitations</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 10</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc181008884"><span
lang=EN-US style='mso-ansi-language:EN-US'>XML Schema elements</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 10</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc2><span class=MsoHyperlink><a href="#_Toc181008885"><span
lang=EN-US style='mso-ansi-language:EN-US'>XML Schema Attributes</span><span
lang=EN-GB style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:
EN-GB;text-decoration:none;text-underline:none'>. 12</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008886"><span
lang=EN-US style='mso-ansi-language:EN-US'>Reference</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'>. 12</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoToc1><span class=MsoHyperlink><a href="#_Toc181008887"><span
lang=EN-US style='mso-ansi-language:EN-US'>Author</span><span lang=EN-GB
style='color:windowtext;display:none;mso-hide:all;mso-ansi-language:EN-GB;
text-decoration:none;text-underline:none'> 18</span></a></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<h1><a name="_Toc181008875"><span lang=EN-US style='mso-ansi-language:EN-US'>Introduction</span></a><span
style='mso-bookmark:_Toc181008875'></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></h1>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>This is the
documentation for <span class=SpellE>Erlsom</span> v. 1.2.1. <span
class=SpellE>Erlsom</span> is a set of functions to parse (and generate) XML
documents.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span class=SpellE><span lang=EN-US style='mso-ansi-language:
EN-US'>Erlsom</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
can be used in a couple of very different modes:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>as
a SAX parser. <br>
This is a more or less standardized model (see </span><a
href="http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html"><span
lang=EN-GB style='mso-ansi-language:EN-GB'>http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html</span></a><span
lang=EN-US style='mso-ansi-language:EN-US'>) for parsing XML. Every time the
parser has processed a meaningful part of the XML document (such as a start
tag)<span class=GramE>,</span> it will tell your application about this. The
application can process this information – potentially in parallel – while the
parser continues to parse the rest of the document. The SAX parser will allow
you to efficiently parse XML documents of arbitrary size, but it may take some
time to get used to it. If you invest some effort, you may find that it fits
very well with the <span class=SpellE>Erlang</span> programming model –
personally I have always been very happy about my choice to use a SAX parser as
the basis for the rest of <span class=SpellE>Erlsom</span>. You will find a
couple of examples how the SAX parser can be used below.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>As
a simple sort of DOM parser. <br>
<span class=SpellE>Erlsom</span> can translate your XML to the ‘simple form’
that is used by <span class=SpellE>Xmerl</span>. This is a form that is easy to
understand, but you have to search your way through the output to get to the
information that you need. Section … provides an example.<span
style='mso-spacerun:yes'>  </span>(Note: in the examples directory you will
also find an example that translates the XML to the more complex output format
that is produced by <span class=SpellE>Xmerl</span>. On this output you can use
the <span class=SpellE>Xpath</span> functions that come with <span
class=SpellE>Xmerl</span> – but I haven’t tested this extensively).<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>As
a ‘data binder’ <br>
<span class=SpellE>Erlsom</span> can translate the XML document to an <span
class=SpellE>Erlang</span> data structure that corresponds to an XML Schema. It
has the advantage over the SAX parser that it validates the XML document, and
that you know exactly what the layout of the output will be. This makes it easy
to access the elements that you need in a very direct way. <span class=GramE>Section<span
style='mso-spacerun:yes'>  </span>…</span> gives more information. (See <a
href="http://www.rpbourret.com/xml/XMLDataBinding.htm">http://www.rpbourret.com/xml/XMLDataBinding.htm</a>
for a general description of XML data binding.)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>For all
modes the following applies:<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>If
the document is too big to fit into memory, or if the document arrives in some
kind of data stream, it can be passed to the parser in blocks of arbitrary
size.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>The
parser can work directly on binaries. There is no need to transform binaries to
lists before passing the data to <span class=SpellE>Erlsom</span>. Using binaries
as input has a positive effect on the memory usage and on the speed (provided
that you are using <span class=SpellE>Erlang</span> 12B or later – if you are
using an older <span class=SpellE>Erlang</span> version the speed will be
better if you transform binaries to lists). The binaries can be latin-1, utf-8
or utf-16 encoded. <o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l0 level1 lfo2;
tab-stops:list 36.0pt'><![if !supportLists]><span lang=EN-US style='mso-fareast-font-family:
Arial;mso-ansi-language:EN-US'><span style='mso-list:Ignore'>-<span
style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span lang=EN-US style='mso-ansi-language:EN-US'>The
parser has an option to produce output in binary form (only the character data:
names of elements and attributes are always strings). This may be convenient if
you want to minimize the memory usage, and/or if you need the result in binary
format for further processing. Note that it will slow down the parser slightly.
If you select this option the encoding of the result will be utf-8
(irrespective of the encoding of the input document).<span
style='mso-spacerun:yes'>  </span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<h2><span lang=EN-US style='mso-ansi-language:EN-US'>Example XML document</span><a
name="#example_xml"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h2>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Unless
otherwise indicated, the examples in the next sections will use the following,
very simple XML document as input:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;<span class=SpellE>foo</span> <span
class=SpellE>attr</span>=&quot;<span class=SpellE>baz</span>&quot;&gt;&lt;bar&gt;x&lt;/bar&gt;&lt;bar&gt;y&lt;/bar&gt;&lt;/<span
class=SpellE>foo</span>&gt;</span></span><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p></o:p></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'>This document is stored in a file called “<span class=SpellE>minimal.xml</span>”,
and read into a variable called Xml by the following commands in the shell:<o:p></o:p></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>1&gt; {ok, Xml} = <span
class=SpellE>file:read_<span class=GramE>file</span></span><span class=GramE>(</span>&quot;<span
class=SpellE>minimal.xml</span>&quot;).<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,&lt;</span>&lt;&quot;&lt;<span
class=SpellE>foo</span> <span class=SpellE>attr</span>=\&quot;<span
class=SpellE>baz</span>\&quot;&gt;&lt;bar&gt;x&lt;/bar&gt;&lt;bar&gt;y&lt;/bar&gt;&lt;/<span
class=SpellE>foo</span>&gt;\r\n&quot;&gt;&gt;}<o:p></o:p></span></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'>The following, corresponding XSD (“<span class=SpellE>minimal.xsd</span>”)
is used in the first example for the data binder:<o:p></o:p></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=GramE><span
class=code><span lang=DE style='mso-ansi-language:DE'>&lt;?<span class=SpellE>xml</span></span></span></span><span
class=code><span lang=DE style='mso-ansi-language:DE'> version=&quot;1.0&quot;
encoding=&quot;UTF-8&quot;?&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'>&lt;<span class=SpellE>xsd:schema</span>
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>    </span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>foo</span>&quot; type=&quot;<span class=SpellE>foo_type</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>foo_type</span>&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'>           
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;bar&quot; <o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>                          </span>type=&quot;<span
class=SpellE>xsd<span class=GramE>:string</span></span>&quot; <span
class=SpellE>maxOccurs</span>=&quot;unbounded&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:attribute</span></span> name=&quot;<span class=SpellE>attr</span>&quot;
type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;/<span class=SpellE>xsd<span
class=GramE>:schema</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='tab-stops:229.5pt'><span lang=EN-GB style='mso-ansi-language:
EN-US'><span style='mso-spacerun:yes'> </span></span><span lang=EN-US
style='mso-ansi-language:EN-US'><o:p></o:p></span></p>
<h1><a name="sax_mode"><span lang=EN-US style='mso-ansi-language:EN-US'>SAX
Mode</span></a><span style='mso-bookmark:sax_mode'></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The example
below shows how the example XML (see above) can be processed using the SAX
parser:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>2&gt; <span class=SpellE>erlsom<span
class=GramE>:parse</span>_sax</span>(Xml, [], fun(Event, Acc) -&gt; <span
class=SpellE>io:format</span>(&quot;~<span class=SpellE>p~n</span>&quot;,
[Event]), Acc end).<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>startDocument</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>startElement</span><span
class=GramE>,[</span>],&quot;<span class=SpellE>foo</span>&quot;,[],[{<span
class=SpellE>attribute,&quot;attr</span>&quot;,[],[],&quot;<span class=SpellE>baz</span>&quot;}]}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>startElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[],[]}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>characters,&quot;x</span>&quot;}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>endElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[]}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>startElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[],[]}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>characters,&quot;y</span>&quot;}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>endElement</span><span
class=GramE>,[</span>],&quot;bar&quot;,[]}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{<span class=SpellE>endElement</span><span
class=GramE>,[</span>],&quot;<span class=SpellE>foo</span>&quot;,[]}<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>endDocument</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,[</span>],&quot;\r\n&quot;}<o:p></o:p></span></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The
function <span class=SpellE>erlsom<span class=GramE>:parse</span>_sax</span>
takes as its arguments: the XML document, an accumulator value and an ‘event
processing function’. This function will process the parts of the XML documents
that have been parsed. In this example, this function simply prints these
events.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The next
example does something slightly more meaningful: it counts the number of times
the “bar” element occurs in the XML document. Ok, maybe not very useful, but at
least this example will produce a result, not only side effects.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>3&gt; <span class=SpellE>CountBar</span>
= <span class=GramE>fun(</span>Event, Acc) -&gt; case Event of {<span
class=SpellE>startElement</span>, _, &quot;bar&quot;, _, _} -&gt; Acc + 1; _
-&gt; Acc end <span class=SpellE>end</span>.<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>#Fun&lt;erl_eval.12.113037538&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>4&gt; <span class=SpellE>erlsom<span
class=GramE>:parse</span>_sax</span>(Xml, 0, <span class=SpellE>CountBar</span>).<span
style='mso-spacerun:yes'>                                         </span><o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,2</span>,&quot;\r\n&quot;}<o:p></o:p></span></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>To describe
it in a rather formal way: <span class=SpellE>parse_<span class=GramE>sax</span></span><span
class=GramE>(</span>Xml, Acc0, Fun) calls Fun(Event, <span class=SpellE>AccIn</span>)
on successive ‘XML events’ that result from parsing Xml, starting with <span
class=SpellE>AccIn</span> == Acc0. Fun/2 must return a new accumulator which is
passed to the next call. The function returns {ok, <span class=SpellE>AccOut</span>,
Tail}, where <span class=SpellE>AccOut</span> is the final value of the
accumulator and Tail the list of characters that follow after the last tag of
the XML document. In this example <span class=SpellE>AccOut</span> == 2, since
the tag occurs twice.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>(Notice how
similar this is to <span class=SpellE>lists<span class=GramE>:foldl</span></span>(Fun,
Acc0, <span class=SpellE>Sax_events</span>), assuming that <span class=SpellE>Sax_events</span>
is the list of Sax events – I more or less copied this description from the
documentation of the lists module.)<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>It may
still not be very clear to you how this SAX parser can be used to produce
useful results. There are some additional examples in the examples directory of
the <span class=SpellE>Erlsom</span> distribution. If you are still not
convinced you can try to decipher the source code for the ‘data <span
class=SpellE>mapper</span>’ mode (<span class=SpellE>erlsom_parse.erl</span>) –
this was also built on top of the SAX parser.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<h2><span lang=EN-US style='mso-ansi-language:EN-US'>SAX Events</span><a
name="#sax_events"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h2>
<p class=MsoNormal><span class=SpellE><i><span lang=EN-US style='mso-ansi-language:
EN-US'>startDocument</span></i></span><i><span lang=EN-US style='mso-ansi-language:
EN-US'><o:p></o:p></span></i></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'><span
style='mso-tab-count:1'>            </span></span></i><span lang=EN-US
style='mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span class=SpellE><i><span lang=EN-US style='mso-ansi-language:
EN-US'>endDocument</span></i></span><i><span lang=EN-US style='mso-ansi-language:
EN-US'> </span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Will NOT be sent out in case of an error</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>startPrefixMapping</span>, Prefix, URI}</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Begin the scope of a prefix - URI namespace
mapping</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Will be sent immediately before the
corresponding <span class=SpellE>startElement</span> event.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>endPrefixMapping</span>, Prefix}</span></i><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>End the scope of a prefix - URI namespace
mapping</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Will be sent immediately before the
corresponding <span class=SpellE>endElement</span> event.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>startElement</span>, Uri, <span class=SpellE>LocalName</span>,
Prefix, [Attributes]}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>The beginning of an element.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>There will be a corresponding <span
class=SpellE>endElement</span> (even when the element is</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>empty).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>All three name components will be provided.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>[Attributes] is a list of attribute records,
see <span class=SpellE>sax.hrl</span>.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Namespace attributes (<span class=SpellE><span
class=GramE>xmlns</span></span><span class=GramE>:</span>*) will not be
reported.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>There will be NO attribute values for defaulted
attributes!</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>Providing 'Prefix' in stead of 'Qualified name'
is probably not quite</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>in line with the SAX spec, but it appears to be
more convenient.</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>endElement</span>, Uri, <span class=SpellE>LocalName</span>,
Prefix}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>The end of an element.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{characters,
Characters}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>Character data.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>All character data will be in one chunk, except
if there is a </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>CDATA section included inside a
character section.</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
In that case</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>there will be separate events for the
characters before the CDATA, the</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>CDATA section and the characters
following it (if any, of course).</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>ignorableWhitespace</span>, Characters}</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>If a character data section (as it would be
reported by the 'characters'</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US
style='mso-ansi-language:EN-US'>event, see above) consists ONLY of whitespace,
it will be </span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:35.4pt'><span class=GramE><span
lang=EN-US style='mso-ansi-language:EN-US'>reported as <span class=SpellE>ignorableWhitespace</span>.</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>processingInstruction</span>, Target, Data}</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{error,
Description}</span></i><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span></i><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><i><span lang=EN-US style='mso-ansi-language:EN-US'>{<span
class=SpellE>internalError</span>, Description}</span></i><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<h1><span lang=EN-US style='mso-ansi-language:EN-US'>Simple DOM Mode</span><a
name="#dom_mode"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>This mode
translates the XML document to a generic data structure. It doesn’t really
follow the DOM standard, but in stead it provides a very simple format. In
fact, it is very similar to format that is defined as the ‘simple-form’ in the <span
class=SpellE>Xmerl</span> documentation.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>An example
will probably be sufficient to explain it:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>erlsom<span
class=GramE>:simple</span>_form</span></span></span><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>(Xml).<span
style='mso-spacerun:yes'>        </span><o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,{</span>&quot;<span
class=SpellE>foo</span>&quot;,<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>[{&quot;<span class=SpellE>attr&quot;,&quot;baz</span>&quot;}],<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>[{&quot;bar&quot;<span class=GramE>,[</span>],[&quot;x&quot;]},{&quot;bar&quot;,[],[&quot;y&quot;]}]},<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&quot;\r\n&quot;}<o:p></o:p></span></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Result = {ok,
Element, Tail}, where Element = {Tag, Attributes, Content}, Tag is a string
(there is an option that allows you to format Tag differently, see the
reference section below), Attributes = [{<span class=SpellE>AttributeName</span>,
Value}], and Content is a list of Elements and/or strings.<o:p></o:p></span></p>
<h1><span lang=EN-US style='mso-ansi-language:EN-US'>Data Binder Mode</span><a
name="#data_binder_mode"></a><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></h1>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>In this
mode, <span class=SpellE>Erlsom</span> parses XML documents that are associated
with an XSD (or Schema). It checks whether the XML document conforms to the
Schema, and it translates the document to an <span class=SpellE>Erlang</span>
structure that is based on the types defined in the Schema. This section tries
to explain the relation between the Schema and the <span class=SpellE>Erlang</span>
data structure that is produced by <span class=SpellE>Erlsom</span>.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span class=GramE><span lang=EN-GB style='mso-ansi-language:
EN-GB'>First a quick example using the same XML that was used for the other
modes.</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'> Before we
can parse the document we need to ‘compile’ the XML Schema (similar to how you
might compile a regular expression). <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>10&gt; {ok, Model} = <span
class=SpellE>erlsom<span class=GramE>:compile</span>_xsd_file</span>(&quot;<span
class=SpellE>minimal.xsd</span>&quot;).<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,{</span>model,[{<span
class=SpellE>typ</span>…<o:p></o:p></span></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Now you can
use this compiled model:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>11&gt; {ok, Result, _} = <span
class=SpellE>erlsom<span class=GramE>:scan</span></span>(Xml, Model).<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{ok<span class=GramE>,{</span><span
class=SpellE>foo_type</span>,[],&quot;<span class=SpellE>baz</span>&quot;,[&quot;<span
class=SpellE>x&quot;,&quot;y</span>&quot;]},&quot;\r\n&quot;}<o:p></o:p></span></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Assuming
that you have defined a suitable record #<span class=SpellE>foo_<span
class=GramE>type</span></span><span class=GramE>{</span>} (<span class=SpellE>erlsom:write_xsd_hrl_file</span>()
can do it for you), you can use in your program (won’t work in the shell):<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>BarValues</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'> = <span
class=SpellE>Result#foo_type.bar</span>,<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=SpellE><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'>AttrValue</span></span></span><span
class=code><span lang=EN-GB style='mso-ansi-language:EN-GB'> = <span
class=SpellE>Result#foo_type.attr</span>,</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>Nice and
compact, as you see, but it may need more explanation. </span><span lang=EN-US
style='mso-ansi-language:EN-US'>I will use a more complex example from the XML
Schema<span class=GramE>&nbsp; Primer</span> (XML Schema Part 0: Primer Second
Edition) [Primer]. It can be found here: http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/<a
name="_ftnref1"></a><a href="#_ftn1" title=""><span style='mso-bookmark:_ftnref1'><span
class=MsoFootnoteReference>[1]</span></span><span style='mso-bookmark:_ftnref1'></span></a><span
style='mso-bookmark:_ftnref1'></span>. Sections that have been copied from this
document are contained in a blue box.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=DE
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
DE'>&lt;<span class=SpellE>xsd:schema</span>
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;</span><span lang=DE
style='mso-ansi-language:DE'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=DE
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
DE'>&nbsp;</span><span lang=DE style='mso-ansi-language:DE'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=DE
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
DE'>&nbsp; </span><span lang=EN style='font-size:10.0pt;font-family:"Courier New";
color:black;mso-ansi-language:EN'>&lt;<span class=SpellE>xsd<span class=GramE>:annotation</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:documentation</span></span>
<span class=SpellE>xml:lang</span>=&quot;en&quot;&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp; Purchase order schema for Example.com.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &nbsp;Copyright 2000 Example.com. All rights reserved.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:documentation</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:annotation</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>purchaseOrder</span>&quot; type=&quot;<span
class=SpellE>PurchaseOrderType</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;comment&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>PurchaseOrderType</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>shipTo</span>&quot; type=&quot;<span
class=SpellE>USAddress</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>billTo</span>&quot; type=&quot;<span
class=SpellE>USAddress</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
ref=&quot;comment&quot; <span class=SpellE>minOccurs</span>=&quot;0&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;items&quot;&nbsp; type=&quot;Items&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:attribute</span></span>
name=&quot;<span class=SpellE>orderDate</span>&quot; type=&quot;<span
class=SpellE>xsd:date</span>&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>USAddress</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;name&quot;&nbsp;&nbsp; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;street&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;city&quot;&nbsp;&nbsp; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;state&quot;&nbsp; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;zip&quot;&nbsp;&nbsp;&nbsp; type=&quot;<span class=SpellE>xsd:decimal</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:attribute</span></span>
name=&quot;country&quot; type=&quot;<span class=SpellE>xsd:NMTOKEN</span>&quot;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
fixed=&quot;US&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;Items&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;item&quot; <span class=SpellE>minOccurs</span>=&quot;0&quot; <span
class=SpellE>maxOccurs</span>=&quot;unbounded&quot;&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>productName</span>&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;quantity&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;<span class=SpellE>xsd<span class=GramE>:restriction</span></span>
base=&quot;<span class=SpellE>xsd:positiveInteger</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;<span class=SpellE>xsd<span class=GramE>:maxExclusive</span></span>
value=&quot;100&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/<span class=SpellE>xsd<span class=GramE>:restriction</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span
class=SpellE>xsd<span class=GramE>:element</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>USPrice</span>&quot;&nbsp; type=&quot;<span class=SpellE>xsd:decimal</span>&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span>
ref=&quot;comment&quot;&nbsp;&nbsp; <span class=SpellE>minOccurs</span>=&quot;0&quot;/&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:element</span></span> name=&quot;<span
class=SpellE>shipDate</span>&quot; type=&quot;<span class=SpellE>xsd:date</span>&quot;
<span class=SpellE>minOccurs</span>=&quot;0&quot;/&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span
class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span
class=SpellE>xsd<span class=GramE>:attribute</span></span> name=&quot;<span
class=SpellE>partNum</span>&quot; type=&quot;SKU&quot;
use=&quot;required&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span
class=GramE>:element</span></span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; <span class=GramE>&lt;!--</span> Stock Keeping Unit, a code for
identifying products --&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>
name=&quot;SKU&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>xsd<span class=GramE>:restriction</span></span>
base=&quot;<span class=SpellE>xsd:string</span>&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&lt;<span class=SpellE>xsd<span class=GramE>:pattern</span></span>
value=&quot;\d{3}-[A-Z]{2}&quot;/&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:restriction</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp; &lt;/<span class=SpellE>xsd<span class=GramE>:simpleType</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&lt;/<span class=SpellE>xsd<span class=GramE>:schema</span></span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 1:
<span class=SpellE>po.xsd</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>This XSD
can be processed by <span class=SpellE>Erlsom</span>: the compiler accepts it,
and the parser can parse instances (XML documents) that conform to this schema.
</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Like the
Primer, I will use </span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>po.xml</span></span></span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN-US'> </span><span lang=EN-GB style='mso-ansi-language:EN-GB'>as an example
XML document. <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span
class=GramE><span lang=EN style='font-size:10.0pt;font-family:"Courier New";
color:black;mso-ansi-language:EN'>&lt;?xml</span></span><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'> version=&quot;1.0&quot;?&gt;</span><a name=po.xml></a><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&lt;<span class=SpellE>purchaseOrder</span> <span class=SpellE>orderDate</span>=&quot;1999-10-20&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;<span class=SpellE>shipTo</span>
country=&quot;US&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;Alice Smith&lt;/name&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;street&gt;<st1:Street w:st="on"><st1:address
w:st="on">123 Maple Street</st1:address></st1:Street>&lt;/street&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&lt;city&gt;<st1:place w:st="on"><st1:PlaceName
w:st="on">Mill</st1:PlaceName> <st1:PlaceType w:st="on">Valley</st1:PlaceType></st1:place>&lt;/city&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;state&gt;CA&lt;/state&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;zip&gt;90952&lt;/zip&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;/<span class=SpellE>shipTo</span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;<span class=SpellE>billTo</span>
country=&quot;US&quot;&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;name&gt;Robert Smith&lt;/name&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;street&gt;<st1:Street w:st="on"><st1:address
w:st="on">8 Oak Avenue</st1:address></st1:Street>&lt;/street&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;city&gt;<st1:place w:st="on"><st1:PlaceName
w:st="on">Old</st1:PlaceName> <st1:PlaceType w:st="on">Town</st1:PlaceType></st1:place>&lt;/city&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;state&gt;PA&lt;/state&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;zip&gt;95819&lt;/zip&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;/<span class=SpellE>billTo</span>&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;comment&gt;Hurry, my lawn is going wild&lt;<span
class=GramE>!/</span>comment&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;items&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;item <span class=SpellE>partNum</span>=&quot;872-AA&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>productName</span>&gt;Lawnmower&lt;/<span
class=SpellE>productName</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;quantity&gt;1&lt;/quantity&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>USPrice</span>&gt;148.95&lt;/<span
class=SpellE>USPrice</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;comment&gt;Confirm
this is electric&lt;/comment&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/item&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;item <span class=SpellE>partNum</span>=&quot;926-AA&quot;&gt;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>productName</span>&gt;Baby
Monitor&lt;/<span class=SpellE>productName</span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;quantity&gt;1&lt;/quantity&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>USPrice</span>&gt;39.98&lt;/<span
class=SpellE>USPrice</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<span class=SpellE>shipDate</span>&gt;1999-05-21&lt;/<span
class=SpellE>shipDate</span>&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/item&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&nbsp;&nbsp; &lt;/items&gt;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:12.0pt;background:#D5DEE3'><span lang=EN
style='font-size:10.0pt;font-family:"Courier New";color:black;mso-ansi-language:
EN'>&lt;/<span class=SpellE>purchaseOrder</span>&gt;</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 2:
<span class=SpellE>po.xml</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>Translating
</span><span class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>po.xml</span></span></span><span lang=EN-US style='mso-ansi-language:
EN-US'> using </span><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>erlsom<span class=GramE>:scan</span>/2 </span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'>will result in:<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>{'<span class=SpellE>PurchaseOrderType</span>'<span
class=GramE>,[</span>],</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1999-10-20&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>USAddress</span>'<span class=GramE>,[</span>],</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;US&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Alice
Smith&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:Street w:st="on"><st1:address w:st="on">123 Maple Street</st1:address></st1:Street>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:place w:st="on"><st1:PlaceName w:st="on">Mill</st1:PlaceName> <st1:PlaceType
w:st="on">Valley</st1:PlaceType></st1:place>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;CA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;90952&quot;},</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>USAddress</span>'<span class=GramE>,[</span>],</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;US&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Robert Smith&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:Street w:st="on"><st1:address w:st="on">8 Oak Avenue</st1:address></st1:Street>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;<st1:place w:st="on"><st1:PlaceName w:st="on">Old</st1:PlaceName> <st1:PlaceType
w:st="on">Town</st1:PlaceType></st1:place>&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;PA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;95819&quot;},</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Hurry, my lawn is going wild!<span class=GramE>&quot;,</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'Items'<span class=GramE>,[</span>],</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[{'Items/item',</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[],</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;872-AA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;Lawnmower&quot;,</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;148.95&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Confirm this is electric&quot;,</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
undefined},</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{'Items/item',</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[],</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;926-AA&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;Baby Monitor&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;39.98&quot;,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
undefined,</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;1999-05-21&quot;}]}}</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 3:
output for <span class=SpellE>po.xml</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The output
can be interpreted as a structure built from <span class=SpellE>Erlang</span>
records. The definition of these records can either be generated by erlsom<span
class=GramE>:write</span>_xsd_hrl_file/3, or you can define them yourself (or a
combination: you can run <span class=SpellE>write_xsd_hrl_file</span> and
change a few fieldnames and add some defaults). For example of the record
definitions might be:</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span><span
class=SpellE>purchaseOrderType</span>, {<span class=SpellE>anyAttribs</span>, <span
class=SpellE>shipTo</span>, <span class=SpellE>billTo</span>, comment, items}).</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span>‘<span
class=SpellE>USAddress</span>’, {<span class=SpellE>anyAttribs</span>, country,
name, city, state, zip}).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span>‘Items’, {<span
class=SpellE>anyAttribs</span>, <span class=SpellE>listOfItem</span>}).</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-US
style='mso-ansi-language:EN-US'>-<span class=GramE>record(</span>‘Items/item’,
{<span class=SpellE>anyAttribs</span>, <span class=SpellE>partNum</span>, <span
class=SpellE>productName</span>, quantity, ‘<span class=SpellE>USPrice</span>’,
comment, <span class=SpellE>shipDate</span>}).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 4:
possible record definitions for <span class=SpellE>po.xsd</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>As can be
seen from the example:</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='mso-ansi-language:EN-US'>attributes are included
in the records as the first elements (</span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>country</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'>, </span><span class=SpellE><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>partNum</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>)</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='mso-ansi-language:EN-US'>elements that are
optional (</span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>minOccurs</span></span></span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>=&quot;0&quot;</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>) for which no value is provided get
the value </span><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>undefined</span></span><span lang=EN-US style='mso-ansi-language:EN-US'>
(</span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>comment</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>, </span><span class=SpellE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>shipDate</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>).</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='mso-ansi-language:EN-US'>elements that can occur
more than once (</span><span class=SpellE><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>maxOccurs</span></span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> &gt; 0 or </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>unbounded</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>) are translated to a list (</span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>listOfItem</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>).<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='mso-ansi-language:EN-US'>-</span><span lang=EN-US
style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-GB style='mso-ansi-language:EN-GB'>every record has ‘<span
class=SpellE>anyAttribs</span>’ as its first element. If the Schema allows ‘<span
class=SpellE>anyAttributes</span>’, and if these are present in the XML
document, then the values will be found here (as a list of attribute-value
pairs) <o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>It should
be noted that there is quite a bit of information in </span><span class=SpellE><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>po.xsd</span></span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> that is not used by <span
class=SpellE>erlsom</span>:</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>Only in a limited number of
situations does <span class=SpellE>erlsom</span> do type checking and
translation: only if an element is defined as integer, <span class=SpellE>int</span>,
<span class=SpellE>boolean</span> or <span class=SpellE>QName</span> without
any further restrictions or extensions. The ‘quantity’ element doesn’t meet
these conditions, since (a) it is a <span class=SpellE>positiveInteger</span>,
and (b) it is restricted. A value for the </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>quantity</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> element of </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>Ten</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> or </span><span class=code><span lang=EN-US
style='mso-ansi-language:EN-US'>-1</span></span><span lang=EN-US
style='mso-ansi-language:EN-US'> would not result in an error or warning, and
the string value is not translated to an <span class=SpellE>Erlang</span>
integer. This also applies for the user defined <span class=SpellE>simpleTypes</span>,
like </span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>SKU</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'> in the example.</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>The </span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>fixed</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'> attribute is ignored. If there would have been
another value than </span><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>US</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'> in </span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>po.xml</span></span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>, this would have been accepted
without warning or error.<o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>The annotation is ignored
(obviously).</span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>In </span><span
lang=EN-GB style='mso-ansi-language:EN-GB'>example <st1:metricconverter
ProductID="5 a" w:st="on">5<span lang=EN-US style='mso-ansi-language:EN-US'> a</span></st1:metricconverter><span
lang=EN-US style='mso-ansi-language:EN-US'> number of additional features <span
class=GramE>is</span> illustrated:</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>elements that belong to a namespace
are prefixed in the result. The prefix is determined by a parameter of the
function that compiles the XSD.</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>anonymous types (in the example: </span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>spouse</span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>) get a name that include the
‘path’, in order to avoid name conflicts.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='margin-left:36.0pt;text-indent:-18.0pt'><span
lang=EN-US style='font-family:"Times New Roman";mso-ansi-language:EN-US'>-</span><span
lang=EN-US style='font-size:7.0pt;font-family:"Times New Roman";mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
lang=EN-US style='mso-ansi-language:EN-US'>types (‘records’) are created for
choices – the type indicates which alternative was selected (the record </span><span
class=SpellE><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>b<span
class=GramE>:personType</span></span></span></span><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>-hobby </span></span><span
lang=EN-US style='mso-ansi-language:EN-US'>shows that “Mowing the lawn” is a
hobby, not a profession). </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'>&lt;?<span class=SpellE>xml</span>
version=&quot;1.0&quot;?&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'>&lt;<span class=SpellE>xsd:schema</span>
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>           
</span>targetNamespace=&quot;http://www.example.org&quot;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>           
</span>xmlns=&quot;http://www.example.org&quot;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span lang=DE
style='mso-ansi-language:DE'><span style='mso-spacerun:yes'>            </span><span
class=SpellE>elementFormDefault=&quot;qualified</span>&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;person&quot; type=&quot;<span class=SpellE>personType</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'
</span>&lt;<span class=SpellE>xsd<span class=GramE>:complexType</span></span>
name=&quot;<span class=SpellE>personType</span>&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>    
</span>&lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> an
element with an attribute --&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name = &quot;id&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span>&lt;<span class=SpellE>xsd<span
class=GramE>:simpleContent</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>xsd<span class=GramE>:extension</span></span>
base = &quot;<span class=SpellE>xsd:string</span>&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>xsd<span class=GramE>:attribute</span></span>
name = &quot;type&quot; type = &quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span><span
style='mso-spacerun:yes'>  </span><span class=GramE>&lt;!--</span> allow other
attributes--&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>xsd<span class=GramE>:anyAttribute</span></span>
namespace=&quot;##other&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span><span
style='mso-spacerun:yes'>  </span>&lt;/<span class=SpellE>xsd<span class=GramE>:extension</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>          </span><span
style='mso-spacerun:yes'> </span>&lt;/<span class=SpellE>xsd<span class=GramE>:simpleContent</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:element</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> choice
--&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:choice</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name=&quot;profession&quot; type=&quot;<span
class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name=&quot;hobby&quot; type=&quot;<span
class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:choice</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> group --&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:group</span></span><span style='mso-spacerun:yes'
</span>ref=&quot;name&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span><span class=GramE>&lt;!--</span> local
type --&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span> name=&quot;spouse&quot; <span class=SpellE>xsi:nillable</span>=&quot;true&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span>&lt;<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span><span style='mso-spacerun:yes'
</span>name=&quot;name&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>             </span>&lt;<span class=SpellE>xsd<span
class=GramE>:element</span></span><span style='mso-spacerun:yes'
</span>name=&quot;age&quot; type=&quot;<span class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>           </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>         </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>       </span>&lt;/<span class=SpellE>xsd<span
class=GramE>:element</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:complexType</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'
</span>&lt;<span class=SpellE>xsd<span class=GramE>:group</span></span>
name=&quot;name&quot;&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>     
</span><span class=GramE>&lt;!--</span> <span class=SpellE>nillable</span>
element --&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>     
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>firstName</span>&quot; <o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>                   </span>type=&quot;<span
class=SpellE>xsd<span class=GramE>:string</span></span>&quot; <span
class=SpellE>nillable</span>=&quot;true&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>     
</span>&lt;<span class=SpellE>xsd<span class=GramE>:element</span></span>
name=&quot;<span class=SpellE>lastName</span>&quot; type=&quot;<span
class=SpellE>xsd:string</span>&quot;/&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'>   
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:sequence</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><span style='mso-spacerun:yes'
</span>&lt;/<span class=SpellE>xsd<span class=GramE>:group</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&lt;/<span class=SpellE>xsd<span
class=GramE>:schema</span></span>&gt;<o:p></o:p></span></span></p>
<p class=MsoCaption><a name="_Ref125695678"><span lang=EN-GB style='mso-ansi-language:
EN-GB'>example </span></a><span lang=EN-GB style='mso-ansi-language:EN-GB'>5: <span
class=SpellE>misc.xsd</span>: namespace, choice, group<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&lt;?xml
version=&quot;1.0&quot;?&gt;</span></span><span lang=NO-BOK style='mso-ansi-language:
NO-BOK'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&lt;person
xmlns=&quot;http://www.example.org&quot;&gt;</span></span><span lang=NO-BOK
style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp; &lt;id
type=&quot;passport&quot;&gt;123&lt;/id&gt;</span></span><span lang=NO-BOK
style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp; </span></span><span
class=code><span lang=EN-US style='mso-ansi-language:EN-US'>&lt;hobby&gt;mowing
the lawn&lt;/hobby&gt;</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;<span class=SpellE>firstName</span>&gt;Jan&lt;/<span
class=SpellE>firstName</span>&gt;</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;<span class=SpellE>lastName</span>&gt;<span
class=SpellE>Pietersen</span>&lt;/<span class=SpellE>lastName</span>&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;spouse&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;name&gt;Jet <span class=SpellE>Pietersen</span>&lt;/name&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;age&gt;33&lt;/age&gt;</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&nbsp; &lt;/spouse&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-US style='mso-ansi-language:EN-US'>&lt;/person&gt;</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 6:
<span class=SpellE>misc.xml</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>The XSD can
be compiled by the command </span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&gt; {ok, Model} = <span class=SpellE>erlsom<span class=GramE>:compile</span>_xsd_file</span>(“<span
class=SpellE>misc.xsd</span>”, </span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
[{prefix, </span></span><span class=code><span lang=EN-GB style='mso-ansi-language:
EN-GB'>“b”}]).</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span class=code><span lang=EN-GB style='mso-ansi-language:
EN-GB'>&nbsp;</span></span><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>After that
the XML can be parsed using the command </span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>&gt; {ok, Out, Rest} = <span class=SpellE>erlsom<span class=GramE>:scan</span>_file</span>(“<span
class=SpellE>misc_example.xml</span>”, Model). </span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";
mso-ansi-language:EN-US'>&nbsp;</span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span class=code><span lang=EN-US style='mso-ansi-language:
EN-US'>Out</span></span><span lang=EN-US style='font-family:"Courier New";
mso-ansi-language:EN-US'> </span><span lang=EN-US style='mso-ansi-language:
EN-US'>is the output shown below, and</span><span lang=EN-US style='font-family:
"Courier New";mso-ansi-language:EN-US'> <span class=code>Rest</span> </span><span
lang=EN-US style='mso-ansi-language:EN-US'>is a string of the characters that
may follow after the end tag of the XML.</span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='mso-ansi-language:EN-US'>&nbsp;&nbsp;</span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>{'b:personType',[],</span></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'b:personType/id',[], &quot;passport&quot;,&quot;123&quot;},</span></span><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=NO-BOK style='mso-ansi-language:NO-BOK'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span><span class=code><span lang=EN-US style='mso-ansi-language:EN-US'>{'<span
class=SpellE>b<span class=GramE>:personType</span></span>-hobby',[],
&quot;mowing the lawn&quot;},</span></span><span lang=EN-GB style='mso-ansi-language:
EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>b<span class=GramE>:name</span></span><span class=GramE>'</span>,[],
&quot;<span class=SpellE>Jan&quot;,&quot;Pietersen</span>&quot;},</span></span><span
lang=EN-GB style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=code><span
lang=EN-GB style='mso-ansi-language:EN-GB'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{'<span class=SpellE>b<span class=GramE>:personType</span></span>/spouse',[],
&quot;Jet Pietersen&quot;,&quot;33&quot;}}</span></span><span lang=EN-GB
style='mso-ansi-language:EN-GB'><o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 7:
output for <span class=SpellE>misc.xml</span><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'>To show
some additional features, have a look at the result of parsing misc_2.xml.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span class=GramE><span
lang=EN-GB style='font-family:"Courier New";mso-ansi-language:EN-GB'>&lt;?xml</span></span><span
lang=EN-GB style='font-family:"Courier New";mso-ansi-language:EN-GB'>
version=&quot;1.0&quot;?&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'>&lt;person <span
class=SpellE>xmlns</span>=&quot;http://www.example.org&quot; <o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>        </span><span class=SpellE>xmlns:xsi</span>=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>        </span><span class=SpellE>xmlns<span
class=GramE>:passport</span></span>=&quot;<span class=SpellE>some_uri</span>&quot;&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;id type=&quot;passport&quot; <span
class=SpellE>passport<span class=GramE>:issued</span></span>=&quot;2011&quot;&gt;123&lt;/id&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;hobby&gt;mowing the lawn&lt;/hobby&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>firstName</span> <span
class=SpellE>xsi<span class=GramE>:nil</span></span>=&quot;true&quot;/&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;<span class=SpellE>lastName</span>&gt;<span
class=SpellE>Pietersen</span>&lt;/<span class=SpellE>lastName</span>&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>  </span>&lt;spouse <span class=SpellE>xsi<span
class=GramE>:nil</span></span>=&quot;true&quot;&gt;&lt;/spouse&gt;<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'>&lt;/person&gt;<o:p></o:p></span></p>
<p class=MsoCaption><span lang=EN-GB style='mso-ansi-language:EN-GB'>example 8:
misc_2.xml<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p>&nbsp;</o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'>{'<span class=SpellE>b<span
class=GramE>:personType</span></span><span class=GramE>'</span>,<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>   </span>[],<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><span lang=EN-GB
style='font-family:"Courier New";mso-ansi-language:EN-GB'><span
style='mso-spacerun:yes'>   </span>{'<span class=SpellE>b<span class=GramE>:personType</span></span>/id',<o:p></o:p></span></p>
<p class=MsoNormal style='background:#FFFF99'><<