aspose file tools*
The moose likes XML and Related Technologies and the fly likes Need Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Need Help" Watch "Need Help" New topic
Author

Need Help

Vivek Saxena
Ranch Hand

Joined: Apr 24, 2002
Posts: 58
Hi,
I am not new at javaracnh but this is first time (not last) I am trying to participate here in “XML’ thread. I have been looking into ‘XML’ since last two weeks and finally I decided that the best way to learn is go for the certification. Best place to start such thing is ‘Javaranch’ for sure.
I need little help from experts here. Still I am not very clear that how do we use XML and related technologies in real world? Or where do we use XML and related technologies in real world? How do we use XML and related technologies with database? I am sure that you can not build a very big enterprise application just based on XML, there should be some application of XML and related technologies with database in real world.
I am sure someone is going to help me with this stupid question. I would like to see some real world application ( as example or tutorial) where XML is being used with its all the related concept ( XSl, XSLT, Xpath, Xlink, DOM, SAX, DTD, XML Schema ).
Please don’t disregard this post just because my question is stupid. I am a new in the field of XML (you may assume that I am running late) but I think this will help me to understand things.
Thanks in advance.
Vivek
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
I use XML mainly for two classes of problem:
1. Application configuration - it is ever so much easier than loads of properties files if your configuration is at all complex. For an example, look at the way the Servlet API uses the web.xml file for configuration.
2. Data conversion - frequently XML is not the final form but it is handy to use as an intermediate that can be converted to many different forms. Example - questions for online exams,
Other examples include logging, content management, XML based publishing ala Cocoon, SOAP messaging.
Bill
Vivek Saxena
Ranch Hand

Joined: Apr 24, 2002
Posts: 58
Thanks for reply!
Still not very clear with my doubt. How do we use XML with a very larger database application?
Are we supposed to create a XML file from the output of database query, like a text file (putting strings together)?
Then use associated technologies on the XML file (DOM , SAX, XSLT, XPATH, XSLT ..) for the data representation or transportation?
And use the same XML file for data manipulation using DOM or SAX (like add more elements or delete or modify the values of XML elements). Finally use the updated DOM? Or XML? File to update database. ( but how?)
Please help me to understand the flow database from database to client and back from client to database using XML and related technologies.
NOTE: I AM JUST THINKING ABOUT A BIG ENTERPRISE APPLICATION WITH A VERY BIG BIG DATBASE.
I would appreciate.
thanks
Vivek Saxena
Ranch Hand

Joined: Apr 24, 2002
Posts: 58
Some thoughts/explanation would be appreciated. I know there are lots of experts who can answer/explain to me.
Still waiting!!
thanks
Vivek Saxena
Ranch Hand

Joined: Apr 24, 2002
Posts: 58
Hi,
I really am shocked, nobody came forward to help me. Probably this is my fault, I should have not asked such a simple/harder question. Moderator can close this thread, at least it won’t give a bad impression.
Anyway thanks for not helping!
Vivek
[ December 26, 2002: Message edited by: Vivek Saxena ]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Maybe the Christmas holiday isn't the best time to demand immediate responses.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Vivek, there is nothing wrong with you, it's just Christmas time, as Thomas said. Also, it can happen that there are not too many people around who would satisfy your requirements: experts in using XML with very large databases. I for one never used XML in such a mode and my expert status is very dubious also, but if you want an answer so badly, I'll try to theorize on your questions.
How do we use XML with a very larger database
application?

First, we do not have to. Maybe we do not! XML isn't particularly good format in aspect of performance, and this can matter if a database is very large...
Are we supposed to create a XML file from the output of database query, like a text file (putting strings together)?
Most of latest versions of RDMS can upload or unload data in XML format. If not, than we can write the results of queries in a text file, like you said.
Then use associated technologies on the XML file (DOM , SAX, XSLT, XPATH, XSLT ..) for the data representation or transportation?
For data transportation we do not need XML-related technologies, we would use network technologies (or burn CD and send it by usual mail ) For data representation, we can use XSLT, and the usage may vary from a simple single stylesheet, to the full-blown publishing framework. (There is a whole book about it: Cocoon 2 Programming: Web Publishing with XML and Java Or we could use DOM/SAX. But XML is not the only technology that can help with data representation, it's just recently most hyped technology.
And use the same XML file for data manipulation using DOM or SAX (like add more elements or delete or modify the values of XML elements). Finally use the updated DOM? Or XML? File to update database. ( but how?)
I am not sure I understand your scenario. Why would we unload data in XML format, make data manipulations in this format and then load data back? Why not to make all manipulations in database itself? This is much easier. If we received some data as an XML file, and we need to upload them into a database, then again, most vendors already provided their databases with such function. If not, then we would probably read an input file in a DOM, and then use JDBC and SQL to update database. You might find more detailed answer (like this one ) if you search our JDBC forum.


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Vivek Saxena
Ranch Hand

Joined: Apr 24, 2002
Posts: 58
Thanks Mapraputa,
Thanks for putting some time to reply. I really appreciated. Actually i was king of frustrated because I was trying to understand/learn something and I was sort of help. Anyway sorry...
I have some doubts ( in red) as per your answer.

How do we use XML with a very larger database
application?
First, we do not have to. Maybe we do not! XML isn't particularly good format in aspect of performance, and this can matter if a database is very large...
<font color=red>
#1 am I correct if I say XML is only for small application like web application?
#2 with database XML has performance issue?
</font>

Are we supposed to create a XML file from the output of database query, like a text file (putting strings together)?
Most of latest versions of RDMS can upload or unload data in XML format. If not, than we can write the results of queries in a text file, like you said.
<font color=red>
I learned something here. Most of the DBMS provides function to unload/load data in XML format. But? ..
# 1 how do I specify in what XML structure DBMS is going to load data from database?
# 2 basically is there a way we can specify DTD or XML schema to DBMS in order to get output according to that DTD or Schema?

</font>

Then use associated technologies on the XML file (DOM , SAX, XSLT, XPATH, XSLT ..) for the data representation or transportation?
For data transportation we do not need XML-related technologies, we would use network technologies (or burn CD and send it by usual mail ) For data representation, we can use XSLT, and the usage may vary from a simple single stylesheet, to the full-blown publishing framework. (There is a whole book about it: Cocoon 2 Programming: Web Publishing with XML and Java Or we could use DOM/SAX. But XML is not the only technology that can help with data representation, it's just recently most hyped technology.
<font color=red>
#1 By transportation I meant, how do we transfer data read from a XML file on server to the client application ( like webpage, or a applet..)
</font>

And use the same XML file for data manipulation using DOM or SAX (like add more elements or delete or modify the values of XML elements). Finally use the updated DOM? Or XML? File to update database. ( but how?)
I am not sure I understand your scenario. Why would we unload data in XML format, make data manipulations in this format and then load data back? Why not to make all manipulations in database itself? This is much easier. If we received some data as an XML file, and we need to upload them into a database, then again, most vendors already provided their databases with such function. If not, then we would probably read an input file in a DOM, and then use JDBC and SQL to update database. You might find more detailed answer (like this one ) if you search our JDBC forum.
<font color=red>
#1 I was thinking of something like that, you have list of employee retrieve from database in XML format, then create the DOM from that file then somehow( not sure how) display this list to user in client application, user can change some values for any of employee or may add a new employee. Internally we do this all manipulation in DOM then once use is done, update database from updated DOM with new/modified data.
</font>
I hope you/someone else would provide some comments here.
thanks
[ December 27, 2002: Message edited by: Vivek Saxena ]
[ December 27, 2002: Message edited by: Vivek Saxena ]
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
am I correct if I say XML is only for small application like web application?
with database XML has performance issue?

XML was initially created as "smarter" markup for Web pages than HTML. You can give your tags meaningful names, and search engines supposedly can perform better search. XML wasn't intended as a data format, much less for large databases. You can use it with very large databases -- on your own risk.
Certainly you are much safer with small applications. Like configuration files, Bill Brogden mentioned -- they aren’t too large, so you do not need to worry about performance. You see, when you add a tag for each and every your piece of data, overhead can be 400-500% (we had a nice discussion here). This is if an XML document is represented as a text file. Then, I read that DOM occupies 5-10 times more than an input text file. I would expect that with really large amounts of data performance will certainly be an issue.
how do I specify in what XML structure DBMS is going to load data from database?
Here is an example of modified SQL for SQL Server 2000 (from "Professional XML databases" book)
SELECT CustomerID, ContactName
FROM Customers
FOR XML RAW
And the names of XML elements are simply names of corresponding columns in a table. If you want a full control, then you use "explicit" mode, then you will have to provide names of elements and metadata. Syntax is like
SELECT Customer.CustomerID as [some name here]
...
FOR XML EXPLICIT
Another way of getting the output as XML is "XML views".
2 basically is there a way we can specify DTD or XML schema to DBMS in order to get output according to that DTD or Schema?
From what I read, you can use Schema for uploading data into SQL Server (search for "XML Bulk Load"). Not sure about output, even if you provide a Schema, you still need to explain which columns should map to which elements etc.
By transportation I meant, how do we transfer data read from a XML file on server to the client application ( like webpage, or a applet..)
If XML data are read into memory, then they shouldn't be different from any other kind of data. All usual protocols should work, like HTTP for web pages.
I was thinking of something like that, you have list of employee retrieve from database in XML format, then create the DOM from that file then somehow (not sure how) display this list to user in client application, user can change some values for any of employee or may add a new employee. Internally we do this all manipulation in DOM then once use is done, update database from updated DOM with new/modified data.
If we talk about large databases, then corrections will probably constitute a minor part of all data. Instead of bulk un/uploading, we could code only corrections as XML, and then read only these corrections and execute corresponding SQL commands. Something like
<add table="Customers" column="Last Name">
John Smith
</add>

But this is only if you are determined to use XML with a database (not sure why). Database people used to display data to users and accept corrections when there was no XML at all...
There is a good article about XML and databases:
http://www.rpbourret.com/xml/XMLAndDatabases.htm
- much better than what I can say
[ December 28, 2002: Message edited by: Mapraputa Is ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help