• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

xml, data transfer and appending

 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:
 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic