Created
June 24, 2020 18:48
-
-
Save bohdanszymanik/38d98c113cc0a0cbb67c32265c50c832 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (* | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Questionnaire type="referee"> | |
| <Section id="referee" label="Your details"> | |
| <Section id="identity" label="Identity"> | |
| <Input id="name" label="Referee name"> | |
| <Input id="firstName" label="First name">Douglas</Input> | |
| <Input id="middleName" label="Middle name">Neil</Input> | |
| <Input id="surname" label="Surname">Adams</Input> | |
| </Input> | |
| <Input id="dateOfBirth" label="Date of birth">2008-09-29</Input> | |
| <Input id="gender" label="Gender">MALE</Input> | |
| <Input id="countryOfBirth" label="Country of birth">UK</Input> | |
| </Section> | |
| <Section id="contact" label="Contact"> | |
| <Input id="phoneNumbers" label="Phone numbers"> | |
| <Input id="workPhoneNumber" label="Work phone number">0123456</Input> | |
| <Input id="homePhoneNumber" label="Home phone number">0126543</Input> | |
| </Input> | |
| </Section> | |
| </Section> | |
| </Questionnaire> | |
| *) | |
| open System.Xml | |
| type Id = Id of string | |
| type Label = Label of string | |
| type Input = | |
| | Id * Label * Value of string | |
| | Input list | |
| type Section = | |
| | Section list | |
| | Id * Label * Input list | |
| type Questionnaire = Section list | |
| let extractQuestionnaire (doc: XmlDocument) = | |
| [for node in doc.ChildNodes do | |
| if node.Name = "Section" then | |
| yield (Section [ for child in node.ChildNodes -> extractSection(child) ] )] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment