Hi,
i try to create a XML DOM Tree with data of some documents and serialize the tree to a file. I’m really stuck, perhaps you can help me out. I am not able to create a file. There’s nothing on my c: drive after the operation. Looks like I’m completely on the wrong way.
Here is my code. Thanks for any hints or advice.
Thomas
Sub Initialize
Dim se As New NotesSession
Dim domparser As NotesDOMParser
Dim domdoc As NotesDOMDocumentNode
Dim stream As NotesStream
Dim node1 As NotesDOMElementNode
Dim node2 As NotesDOMElementNode
'Create DOMParser and add some nodes
Set domParser=se.CreateDOMParser
Set domdoc = domparser.Document.CreateDocumentNode
Set node1 = domdoc.CreateElementNode("Test")
Set node2 = domdoc.CreateElementNode("Hallo")
Call domdoc.appendChild(node1)
Call node1.appendChild(node2)
'Serialize DOMTree
Set stream = se.CreateStream
If Stream.Open( "c:\Text.xml" ) Then
Call stream.Truncate
Call domparser.SetOutput(stream)
Call domparser.serialize()
Call stream.close()
End If
End Sub
.lotusscript { font-family: sans-serif; font-size: 9pt; color: black; } .ls-comment { color: green; } .ls-quote { color: black; } .ls-datatype { color: black; } .ls-operator { color: blue; } .ls-keyword { color: blue; } .ls-statement { color: blue; } .ls-function { color: blue; } .ls-class { color: black; } .ls-constant { color: purple; }Sub Initialize Dim se As New NotesSession Dim domparser As NotesDOMParser Dim domdoc As NotesDOMDocumentNode Dim stream As NotesStream Dim node1 As NotesDOMElementNode Dim node2 As NotesDOMElementNode 'Create DOMParser and add some nodes Set domParser=se.CreateDOMParser Set domdoc = domparser.Document.CreateDocumentNode Set node1 = domdoc.CreateElementNode("Test") Set node2 = domdoc.CreateElementNode("Hallo") Call domdoc.appendChild(node1) Call node1.appendChild(node2) 'Serialize DOMTree Set stream = se.CreateStream If Stream.Open( "c:\Text.xml" ) Then Call stream.Truncate Call domparser.SetOutput(stream) Call domparser.serialize() Call stream.close() End If End Sub
provided by Julian Robichaux at nsftools.com.