jk2addict has asked for the wisdom of the Perl Monks concerning the following question:
Good day/night to all. I need to get some advice on how to best deal with reading and writing to possibly unknown XML files.
On my current project, I will be reading and writing 'job request' type information from a queue(s). Sometimes, reading the request is enough, but sometimes they may/will be re-submitted to another queue. At other times, a fresh request will be generated and submitted to a queue for the first time.
In the spirit of flexibility, I'm trying to keep a 'request' and it's destination format as abstract as possible via OOP. A request my live in a text file, it may live in an XML file, a binary file, etc. And it may start life as a text file, and end life as an XML file. That part is pretty straight forward.
Now, down to the XML type of request itself. I can easily verify an XML request is in proper form by validating via a DTD In fact, different requests could have different DTDs. Again, nothing exciting there. Now my question comes down to writing a request. How can I use a DTD to write an XML file given a hash structure of data? I've seen a couple of XML::*Write* modules on CPAN. But nothing clicked in my brain pan in terms of 'That's how to do it'.
Is writing using/through a DTD doc possible, or even reasonable? Would it be better to standardize on one XML doc format, and use XSL/XSLT instead to transform foreign XML requests into and out of the base request DTD format?
I forgot to mention, the queues are also abstracted. A queue may be a directory, a database, a POP3 account, MQueue, etc.
-=Chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Use XSL
by cebrown (Pilgrim) on Aug 28, 2002 at 22:42 UTC | |
by jk2addict (Chaplain) on Aug 29, 2002 at 01:43 UTC | |
|
Re: XML, DTD, and Abstraction of a Data File
by grantm (Parson) on Aug 28, 2002 at 22:41 UTC |