Set inputStr = ses.Createstream()
If Not inputStr.Open(Environ("TEMP") & "\" & "Import.xml") Then
Error 5500, "Не найден файл: " & Environ("TEMP") & "\" & "Import.xml"
End If
If inputStr.Bytes = 0 Then
Print DESIGN & " Empty file Import.xml"
GoTo endh
End If
Set DOM = ses.Createdomparser(inputStr)
Call dom.Process()
Dim docNode As NotesDOMDocumentNode
Dim docElem As NotesDOMElementNode
Dim child As NotesDOMNode
Dim child2 As NotesDOMNode
Dim nextSubl As NotesDOMNode
Dim nextSubl2 As NotesDOMNode
Dim itChild As NotesDOMNode
Dim result As String
Print DESIGN & " Создаем/обновляем документы."
Set docNode = DOM.Document
If Not docNode.IsNull Then
Set docElem = docNOde.Documentelement
Set child = docElem.Firstchild
Set nextSubl = child.Nextsibling
While Not nextSubl.Isnull
Set child2 = nextSubl.Firstchild
Set nextSubl2 = child2.Nextsibling 'guid
result = ""
While Not nextSubl2.Isnull
Set itChild = nextSubl2.Firstchild
If Not itChild.Isnull then
Select Case (nextSubl2.Nodename)
Case "DisplayName":
If InStr(itChild.Nodevalue,{,})>0 then
FieldsList("FullName")=FullTrim(StrLeft(itChild.Nodevalue,{,}) & " " &StrRight(itChild.Nodevalue,{,}))
Else
FieldsList("FullName")=itChild.Nodevalue
End if
Case "LastName":
FieldsList("LastName")=itChild.Nodevalue
Case "GivenName":
FieldsList("FirstName")=itChild.Nodevalue
Case "Company":
FieldsList("CompanyName")=itChild.Nodevalue
Case "SMTPAddress":
FieldsList("MailAddress")=itChild.Nodevalue
FieldsList("InternetAddress")=itChild.Nodevalue
Case Else:
End Select
End If
Set nextSubl2 = nextSubl2.Nextsibling
Set nextSubl2 = nextSubl2.Nextsibling
Wend
' Создание документа
Set doc = view.Getdocumentbykey(FieldsList("MailAddress"), true)
If Doc Is Nothing Then
Set doc = db.Createdocument()
Call doc.Replaceitemvalue("Form", "Person")
Call doc.Replaceitemvalue("Type", "Person")
Call doc.Replaceitemvalue("ImportDoc", "Import")
End If
ForAll x In FieldsList
Call doc.Replaceitemvalue(ListTag(x), x)
End ForAll
Call doc.Save(true,false)
FieldsList("FullName")=""
FieldsList("LastName")=""
FieldsList("FirstName")=""
FieldsList("CompanyName")=""
FieldsList("MailAddress")=""
FieldsList("InternetAddress")=""
Set nextSubl = nextSubl.Nextsibling
Set nextSubl = nextSubl.Nextsibling
Wend
End If