Hi,
I'm currently developing web apps using WebSphere, and I would like to know your opinions regarding Java and XML.
I know I can access XML data using DOM or SAX implementation. I've made a couple of programs that will read some config info from XML files, and they end up working well.
The thing is, in my opinion, it's still "too hard" to properly code an XML parser, that can input data safely and error-free, with a proper data validation. When I say parser, I mean the final program that just needs the data, since DOM or SAX are in fact the parsers of the file structure. Also, one will end up with a program code that is too much dependant of that specific XML structure, and a pain to start something new.
So, if I want to create a config file, I'll make an XML file structure and then need to make some coding to read and validate input from it. Since it's a new XML file, structure will probably end being different from any other structure made before, so code has to be vastly adapted to that new reality, which will bring up the problem of re-testing the code.
The way I see it, I can blindly read XML data into the program. Since it can contain config file, or data safely created by other program, I could read it on a go. But I feel that it isn't the way of doing it ... so I always do some checkup of data, to allow for error free programs, ie, programs that do not crash, instead generate a log entry informing the admin that config data isn't correct, and cannot proceed.
Also I could define a DTD that will make some validations, but probably that DTD will be accessed through the web (like some XML files I saw on some 3rd party packages). If I don't have access to the DTD, then I'll be totaly blind when putting data into the XML without any errors.
I have not much experience with XML, and maybe this thread ends up beeing just a way of dumping my thoughts, but I would also like to here the opinions of you guys out there that have much more experience with XML, and the way you do things so that XML can be truly explored to it's maximum potential.
Thanks.
I'm currently developing web apps using WebSphere, and I would like to know your opinions regarding Java and XML.
I know I can access XML data using DOM or SAX implementation. I've made a couple of programs that will read some config info from XML files, and they end up working well.
The thing is, in my opinion, it's still "too hard" to properly code an XML parser, that can input data safely and error-free, with a proper data validation. When I say parser, I mean the final program that just needs the data, since DOM or SAX are in fact the parsers of the file structure. Also, one will end up with a program code that is too much dependant of that specific XML structure, and a pain to start something new.
So, if I want to create a config file, I'll make an XML file structure and then need to make some coding to read and validate input from it. Since it's a new XML file, structure will probably end being different from any other structure made before, so code has to be vastly adapted to that new reality, which will bring up the problem of re-testing the code.
The way I see it, I can blindly read XML data into the program. Since it can contain config file, or data safely created by other program, I could read it on a go. But I feel that it isn't the way of doing it ... so I always do some checkup of data, to allow for error free programs, ie, programs that do not crash, instead generate a log entry informing the admin that config data isn't correct, and cannot proceed.
Also I could define a DTD that will make some validations, but probably that DTD will be accessed through the web (like some XML files I saw on some 3rd party packages). If I don't have access to the DTD, then I'll be totaly blind when putting data into the XML without any errors.
I have not much experience with XML, and maybe this thread ends up beeing just a way of dumping my thoughts, but I would also like to here the opinions of you guys out there that have much more experience with XML, and the way you do things so that XML can be truly explored to it's maximum potential.
Thanks.