-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathXMLUtils.fsx
More file actions
40 lines (28 loc) · 1 KB
/
XMLUtils.fsx
File metadata and controls
40 lines (28 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
open System
// Método para processar arquivos xml
let processarXml (namespaces: (string*string) list) (arquivo: string) processamento =
let xml = Xml.XmlDocument()
xml.Load(arquivo)
let xnm = Xml.XmlNamespaceManager(xml.NameTable)
for ns in namespaces do
xnm.AddNamespace((fst ns), (snd ns))
let selectNodes xpath =
seq {
for node in xml.SelectNodes(xpath, xnm) do
yield node, xnm
}
processamento selectNodes
xml.Save(arquivo)
// Método para ler arquivos xml
let lerXml<'a> (namespaces: (string*string) list) (arquivo: string) processamento : 'a =
let xml = Xml.XmlDocument()
xml.Load(arquivo)
let xnm = Xml.XmlNamespaceManager(xml.NameTable)
for ns in namespaces do
xnm.AddNamespace((fst ns), (snd ns))
let selectNodes xpath =
seq {
for node in xml.SelectNodes(xpath, xnm) do
yield node, xnm
}
processamento selectNodes