Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/XML-Output/F-Sharp/xml-output.fs
Normal file
22
Task/XML-Output/F-Sharp/xml-output.fs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#light
|
||||
|
||||
open System.Xml
|
||||
type Character = {name : string; comment : string }
|
||||
|
||||
let data = [
|
||||
{ name = "April"; comment = "Bubbly: I'm > Tam and <= Emily"}
|
||||
{ name = "Tam O'Shanter"; comment = "Burns: \"When chapman billies leave the street ...\""}
|
||||
{ name = "Emily"; comment = "Short & shrift"} ]
|
||||
|
||||
let doxml (characters : Character list) =
|
||||
let doc = new XmlDocument()
|
||||
let root = doc.CreateElement("CharacterRemarks")
|
||||
doc.AppendChild root |> ignore
|
||||
Seq.iter (fun who ->
|
||||
let node = doc.CreateElement("Character")
|
||||
node.SetAttribute("name", who.name)
|
||||
doc.CreateTextNode(who.comment)
|
||||
|> node.AppendChild |> ignore
|
||||
root.AppendChild node |> ignore
|
||||
) characters
|
||||
doc.OuterXml
|
||||
Loading…
Add table
Add a link
Reference in a new issue