Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/XML-DOM-serialization/F-Sharp/xml-dom-serialization.fs
Normal file
17
Task/XML-DOM-serialization/F-Sharp/xml-dom-serialization.fs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
open System.Xml
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
let xd = new XmlDocument()
|
||||
// Create the required nodes:
|
||||
xd.AppendChild (xd.CreateXmlDeclaration("1.0", null, null)) |> ignore
|
||||
let root = xd.AppendChild (xd.CreateNode("element", "root", ""))
|
||||
let element = root.AppendChild (xd.CreateElement("element", "element", ""))
|
||||
element.AppendChild (xd.CreateTextNode("Some text here")) |> ignore
|
||||
// The same can be accomplished with:
|
||||
// xd.LoadXml("""<?xml version="1.0"?><root><element>Some text here</element></root>""")
|
||||
|
||||
let xw = new XmlTextWriter(System.Console.Out)
|
||||
xw.Formatting <- Formatting.Indented
|
||||
xd.WriteContentTo(xw)
|
||||
0
|
||||
Loading…
Add table
Add a link
Reference in a new issue