This is the third XML article in this mini series. Please take a look at Part One, which talks about the Script Library and Part Two, which talks about the export agent, if you have not already seen these.
The second agent I have written allows a user to import an XML file and replace all of the document fields with the values found in the XML document.
My code takes the first "Document" from the "Documents" tree and finds the <id> value, which is used as a key to find the document. With the <id>, I can find the document and then run through all of the fields in the XML and replace the values within the document. The field name is the same in the document as it is in the XML file, so no mapping is required in this example.
Showing posts with label XML. Show all posts
Showing posts with label XML. Show all posts
Friday, 1 April 2011
XML - Part Two - The Export
This is the second XML article in this mini series. Once you have created the script library in your database (Part One), you can create the first of the two agents.
The agent below allows a user to export the selected documents as XML. This creates an XML tree of "Documents", with each "Document" being a node. This code fixes the file destination to "C:\Temp\Document.xml", so you will have to change this to fit your requirements.
I use a view to handle the field names to export, as I do not want to export every field. My field configuration will be the subject of a further post. For now, think of it as a list of field names where there is one document per field.
The agent below allows a user to export the selected documents as XML. This creates an XML tree of "Documents", with each "Document" being a node. This code fixes the file destination to "C:\Temp\Document.xml", so you will have to change this to fit your requirements.
I use a view to handle the field names to export, as I do not want to export every field. My field configuration will be the subject of a further post. For now, think of it as a list of field names where there is one document per field.
XML - Part One - The Script Library
I am going to write a three part post on how to handle the importing and exporting of XML files into Lotus Notes.
Recently, I had a requirement to export a number of documents to XML. The file would then be read into a customers helpdesk, which was not Lotus Notes based.
I have exported to XML before and have kept a Script Library in my "black box" for this very purpose. I did not write the script library, but I will share the code here.
Recently, I had a requirement to export a number of documents to XML. The file would then be read into a customers helpdesk, which was not Lotus Notes based.
I have exported to XML before and have kept a Script Library in my "black box" for this very purpose. I did not write the script library, but I will share the code here.
Subscribe to:
Posts (Atom)