File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes xml, data transfer and appending Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "xml, data transfer and appending" Watch "xml, data transfer and appending" New topic
Author

xml, data transfer and appending

Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
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
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

------------------
author of:


Java Resources at www.wbrogden.com
Michael Hildner
Ranch Hand

Joined: Oct 13, 2000
Posts: 297
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).]
 
IntelliJ Java IDE
 
subject: xml, data transfer and appending
 
Threads others viewed
serverless database
Hardcoding vs. Flexibility
Writing XML?
Regarding java I/O
Can't write Context element properly
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture