Domino 9 und frühere Versionen > ND7: Entwicklung

DXL originalgetreu importieren

<< < (2/4) > >>

Johnson:
Was mir übrigens dabei auch durch den Kopf geschossen ist: Ich könnte die dxl-Files auch direkt im Browser öffnen. Die sind dann jedoch nicht besonders gut lesbar. Hat jemand ein xslt-File, mit dem die Darstellung übersichtlicher wird, bzw. wie erstellt man selbst so ein xslt-File? Hab da leider von Tut und Blasen keine Ahnung.  :-\

flaite:
Kannst du mal so ein Beispiel-XML-File posten.
... und Aussagen dadrüber, wie das Endergebnis ungefähr aussehen soll.

Da ich xml/xpath Wochen habe und falls ein schmerzender Zahn sich nicht verschlimmert, finde ich möglicherweise Zeit, mich darum zu kümmern.
Mit Suchworten DXL XsltTransformer, dxl xslt findest du schon ein paar Treffer in google.

Johnson:
Sorry. Das File ist so groß. Das zu anonymisieren, dauert ne ganze Weile.

Ich habe mir noch einen Agenten im Domino Directory geschrieben, der Dokumente aus dem Domino Directory exportiert.


--- Code: ---Option Public
Option Declare


' ### constants ###

Private Const BIF_DONTGOBELOWDOMAIN = &H2
Private Const BIF_RETURNONLYFSDIRS = &H1
Private Const DLG_FOLDER_TITLE = "Wählen Sie eine Ordner"
Private Const MAX_PATH = 260


' ### user defined types ###

' BrowseInfo
Private Type BrowseInfo
    hOwner As Long
    pidlRoot As Long
    pszDisplayName As String
    lpszTitle As String
    ulFlags As Long
    lpfn As Long
    lParam As Long
    iImage As Long
End Type


' ### external functions ###


Declare Private Function apiGetActiveWindow Lib "user32" Alias "GetActiveWindow" () As Long    ' Retrieves the active window.
Declare Private Function apiSHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) As Long    ' This function displays a dialog box that allows a user to select a folder.
Declare Private Function apiSHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (Byval pidl As Long, Byval pszPath As String) As Long    ' This function converts an item identifier list to a file system path.

Sub Initialize
   
    Dim db As NotesDatabase
    Dim dc As NotesDocumentCollection
    Dim doc As NotesDocument
    Dim lng_counter As Long
    Dim nde As NotesDXLExporter
    Dim ns As NotesStream
    Dim s As NotesSession
    Dim str_filepath As String
    Dim str_path As String
    Dim uiws As NotesUIWorkspace
   
   
' ### initialize ###
   
    Set s = New NotesSession
    Set db = s.CurrentDatabase
   
   
' ### get the current or all selected documents ###
   
    Set dc = db.UnprocessedDocuments
    If dc.Count = 0 Then
        Print "No document selected!"
        Goto terminate
    End If
   
   
' ### choose the target directory ###
   
    str_path = DlgFolder
    If str_path = "" Then Goto terminate
   
   
' ### create dxl exporter ###
   
    Set nde = s.CreateDXLExporter
   
   
' ### run through all documents ###
   
    Set doc = dc.GetFirstDocument
    Do Until doc Is Nothing
       
        ' build the target filename
        str_filepath = str_path & "\" & doc.NoteID & ".dxl"
       
        ' open or create target file
        Set ns = s.CreateStream
        If ns.Open(str_filepath) = False Then
            Print "Could not open or create file " & str_filepath
            Goto nextdoc
        End If
        Call ns.Truncate
       
        ' set input and output for dxl exporter
        Call nde.SetInput(doc)
        Call nde.SetOutput(ns)
       
        ' export dxl
        Call nde.Process
       
        ' close target file
        Call ns.Close
       
nextdoc:
        lng_counter = lng_counter + 1
        Print lng_counter & " of " & dc.Count & " document(s) exported"
        Set doc = dc.GetNextDocument(doc)
    Loop
   
   
' ### terminate ###
   
terminate:
    Set doc = Nothing
    Set dc = Nothing
    Set db = Nothing
    Set s = Nothing
   
End Sub

Function DlgFolder As String
   
' Opens a Treeview control that displays the directories in a computer
   
    Dim lng_lpidl As Long
    Dim str_buffer As String
    Dim bi As BrowseInfo
   
   
' ### dialog ###
   
' set dialog properties
    bi.hOwner = apiGetActiveWindow
    bi.lpszTitle = DLG_FOLDER_TITLE
    bi.ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN
   
' show dialog
    lng_lpidl = apiSHBrowseForFolder(bi)
   
' translate id list
    If (lng_lpidl) Then
        str_buffer = Space(MAX_PATH)
        Call apiSHGetPathFromIDList(lng_lpidl, str_buffer)
        str_buffer = Left(str_buffer, Instr(str_buffer, Chr(0)) - 1)
        DlgFolder = str_buffer
    End If
   
   
' ### terminate ###
   
terminate:
   
End Function


--- Ende Code ---

Der Agent sollte auf ausgewählte Dokumente laufen.

Der einzigste Unterschied gegen über den Files im IBM_TECHINCAL_SUPPORT-Verzeichnis ist:

Agent:

--- Zitat ---<!DOCTYPE document SYSTEM 'xmlschemas/domino_7_0_2.dtd'>
<document xmlns='http://www.lotus.com/dxl' version='7.0' maintenanceversion='2.0'
 replicaid='C1256AEE00321D4B' form='Server'>
--- Ende Zitat ---

IBM_TECHINCAL_SUPPORT:

--- Zitat ---<!DOCTYPE note SYSTEM 'domino_6_5_5.dtd'>
<note class='document' xmlns='http://www.lotus.com/dxl' version='6.5' maintenanceversion='5.0' replicaid='C12570B3004DFDF2'>
--- Ende Zitat ---

m3:
NotesXSLTransformer - setting the DOCTYPE

flaite:
Hi,

soll ich jetzt irgendwas machen?
Also aus Dokumenten aus dem Names.nsf etwas darstellbares machen?

Gruß Axel

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln