I’m receive mails wich has on the body an XML structure like this:
<?xml version="1.0" encoding="UTF-8"?>
senders.name@mydomain.com
<LASTNAME>Glenn</LASTNAME>
<FIRSTNAME>Tom</FIRSTNAME>
<MESSAGE>Some text</MESSAGE>
Now, i need a agent witch should open the doc (mail) get the body xml elemets, makes a lookup to the NAB (email(SENDER)) and write this to a new form (doc) on seperate fields.
the “Glenn” should be written to “doc.LASTNAME”.
Has anyone a code sample for me how to do this?
Thanks in advance
Volkan Senguel
Subject: Here are a couple of ways it could be done
I am assuming LotusScript here as the API…
You could use a NotesDOMParser to parse the XML into a tree. From there, use the NotesDOMxxx classes to naviagate the tree and pull out the information you need (e.g. NotesDOMElementNode.GetElementsByTagName and NotesDOMElementNode.NodeValue). Then use NotesDocument to set items to the parsed out values.
You could use NotesXSLTransformer to transform the XML into DXL. For example,
Glenn
would get transformed to
Glenn
To do so you would have to write an XSLT style sheet to do the transformation. There is a bit of a learning curve to XSLT. Then you could pipeline the result of that into a NotesDXLImporter using a DocumentImportOption of DXLIMPORTOPTION_CREATE to create new documents or DXLIMPORTOPTION_UPDATE_ELSE_CREATE to update existing documents (matched by UNID).
The first way is probably more straightforward but will require a little bit more LotusScript code. The second way is arguably more powerful and results in less LotusScript code, but you have to write an XSLT style sheet. There should be numerous examples of both in this forum and in the online help.