For years I have used a simple technique to transfer data between applications. One application appends a pipe-delimited string to a file, one line is one record. The file name and data structure are well-known. On the other end, the importing application attempts to rename this well-known file name to a new name, then acts on the contents. In this way, the exporting app can open a text file in append mode whenever it needs to write, and the importing app only does something when the file is successfully renamed (i.e. not open by the exporting app). Usually this data transfer is between my app and a competitor's app, so the data structure is always a source of trouble. I'd love to have a 'contract' - a dtd. Guess what I'm wondering is how do I accomplish something similar with well-formed xml? If the exporting app just appends, there can never be an open/close document tag, and the xml is illegal. Just fishing for ideas, any input is appreciated. Michael
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11862
posted
0
My approach to this problem is to cheat. In my questionnaire servlet I leave off the opening and closing tags when recording the results as XML in a file. Then you can use two approaches 1. - you can grab a "snapshot" of the file by copying the contents to a new file WITH the opening document information and analyze the snapshot. This has the advantage of allowing the exporting app to continue. 2. (should work but I have not actually tried it) - Create a custom InputReader that supplies the start tags, then reads the file and supplies that data, then supplies the end tag. Bill
Dear William, Thanks for the info. I think I'll try #1. Thanks again, Michael BTW, I was lucky enough to win one of your XML/JSP books. Thanks! [This message has been edited by Michael Hildner (edited July 05, 2001).]