XML DOM Parser

Hello!

I create from an XML File, an DOM Tree.

Can I save this DOM Tree back to an XML File?

Subject: XML DOM Parser

Yes, use the .Serialize() method of the NotesDOMParser class. Check the Designer help for details.

Subject: RE: XML DOM Parser

My Code:Sub Initialize

Dim view As NotesView

Dim session As New NotesSession

Dim item As NotesItem

Dim domparser As NotesDOMParser

REM Open xml file named after current database

Dim Istream As NotesStream

Set Istream = session.CreateStream

filename = "c:\dxltest\test.xml"

If Not Istream.Open(filename) Then

	Messagebox "Cannot open " & filename,, "Error"

	Exit Sub

End If



Dim Ostream As NotesStream

Set Ostream = session.CreateStream

Call Ostream.Truncate



Set domParser=session.CreateDOMParser(IStream,Ostream)

domParser.Process

Call domparser.Serialize()



Dim doc As NotesDocument

Dim db As NotesDatabase



Set db = session.CurrentDatabase

Dim node As notesdomnode

Set node = domparser.Document

REM Export document as DXL

Dim importer As NotesDXLImporter

Set importer = session.CreateDXLImporter(domparser, db)



Call importer.Process

End Sub

I want to export an document into XML, then parse this document and import the result into Notes.

This is an example to import an XML file into Notes, but he makes error!

Error:“The Process method can be applied only the first XML processor in an XML pipeline, not in the middle or at the end”

Why?

Subject: RE: XML DOM Parser

Because you are pipelining from one XML processor to another you can only initiate the process method once. This will initiate it for all processors in the pipeline. After you have set up each XML processor call the process method for the first processor you created.

Also do a search for ‘pipelining’ in the Designer Help file for more information.