Xml: Whats the point?

C

Colum

Hi,
I am a complete newcommer to XML.
I am planning to build a website with html, interacting with an Oracle db
through Jsp. I want to use Xml, mainly because Ive heard about the kind of
OO approach it takes, but I cant see how it would be beneficial. Could
someone tell me what it the point of seperating content from presentation,
surely content is stored in the database?? Also, are there such things as
forms in XML, or what is the solution for XML sites that wish to use forms,
do you write some of the site in XML and the forms part in HTML
Thanks
 
I

Iain

One of the problems with getting to grips with XML is that it does very
little or nearly everything depending on how you look at it. Very little
"it's just a data description languague" through to 'the core technology of
the future internet (mainly IMHO because everyone's jumped on the bandwagon
so there are LOTS of tools and peripheral standards - something which was
markedly lacking in previous data description languages [such as ASN.1]).

The sort of answer I would expect to give to your question (and I'm not
quite an XML devotee either though I've mad a fair amount of use of it)
would go like this.

The point of any multiple tier archtecture is to all changes at any point
(extending / reformatting the database, changing the layout) without
(necessarily) having to consider the effects on the other tiers. This is
especially true when dealing with multiple source and multiple consumers
(e.g. your database tables are used by many applications supported by
different programmers). In this case you may wish to make a change to the
data layouts - possibly a major one and be confident that it will not break
the other programmers code. If you have an intermediate layer (business
object / XML data representation) then you can do this relatively safely.

With a description language like XML you can add data without breaking the
'code' which accesses it (removing data may be another matter, of course).

The other point to XML technologies (IMHO) is that they allow declarative
rather than procedural programming.

In the case of your example, you would emit an XML document from your
database (which can be a single database operation) and then transform it
into the look and feel you want (an HTML page) with XSLT. With XSLT (once
you've learned it) you can make major changes to the presentation without
writing a line of code - something (generally) not true of JSP and it's
competitors.

you can of course embed form objects in the transformed XML so yes you can
do forms.

Is it worth it? If you have a simple application you have to get out the
door and you already know the technologies, don't bother.

If your application may grow more complex or you may have to share data with
other programs / pages, or if you just like learning new things, then givbe
it a go.

Iain

In fact you may not need jsp at all!
 
B

Bob Foster

I'm not a complete newcomer. XML does not add significant value to a
conventional website, i.e., one that serves humans through browser, though
needlessly processing XML can add significant overhead.

When XML was getting started, people had the odd notion that websites would
serve XML "content" that would be dynamically converted to presentation form
when humans wanted to look at it. You can actually do this with some
browsers by including an <?xml-stylesheet PI at the start of your document
and letting the browser transform the document to HTML. Unfortunately for
this idea, eye candy matters and it's quite difficult to get an equivalent
quality presentation by this method, compared to simply transmitting HTML in
the first place. The extra level of indirection makes most web designers
throw up. Then, you will find browsers that won't do the transform for you,
so you will have to do the transform on your website, adding lots of
overhead. But the true rub comes when you discover you don't have any actual
clients for the "content" - just people who want to view your pretty
website.

The above has all the earmarks of a Bad Idea. If you, for some reason, want
to allow people to get at your content without picking through your
presentation, e.g., you provide the daily weather forecast for your area,
provide it as a separate service. IOW, separate presentation from content by
serving them separately. The only kind of XML-based service you can find
clients for today, unless you want to write and distribute your own clients,
are called Web Services.

There are such things as forms in XML - XForms - but most browsers don't
support them.

Oh, and the Semantic Web? Last time it phoned in, I couldn't hear it.

Bob Foster
 
G

GIMME

The point of XML is that if you make everything service you
create a web service, then it can be shared by other applications
inside your organization. And code can be reused.
 
P

Patrick TJ McPhee

% The point of XML is that if you make everything service you
% create a web service, then it can be shared by other applications
% inside your organization. And code can be reused.

Of course, that's the point of every development in computer science
for the past 30-odd years. We're sure to have a winner some day.
 
G

GIMME

XML is different in that it isn't code that is reused, function
results are reused.

A lot of what happened in the past referred platform portability ...
Reusing the same code on different platforms.
 
P

Patrick TJ McPhee

% XML is different in that it isn't code that is reused, function
% results are reused.
% A lot of what happened in the past referred platform portability ...
% Reusing the same code on different platforms.

I was joking in my first reply, but to be serious, nearly every
development in computer science since the advent of structured
programming _has_ been touted as a way to increase the amount of code
which can be re-used either in future versions of the same program or in
other programs. Some of these have addressed cross-platform portability,
but I wouldn't say it's been a big concern -- to make a gross
generalisation, CS has mostly worried about software efficiency
(algorithms) and programming efficiency (aka re-use). A tremendous
amount of code has been thrown away in the effort to adopt new
technologies which facilitate code re-use.

So, sure, XML is different, and all the 0% code re-use we get as
we throw away old applications and old communications protocols
will be offset by the 110% code re-use we'll get in the future,
but I wouldn't be inclined to list this as a big feature, myself.
 
T

Tad McClellan

Patrick TJ McPhee said:
% XML is different in that it isn't code that is reused, function
% results are reused.
% A lot of what happened in the past referred platform portability ...
% Reusing the same code on different platforms.

I was joking in my first reply, but to be serious, nearly every
development in computer science since the advent of structured
programming _has_ been touted as a way to increase the amount of code
which can be re-used


But what does that have to do with XML?

XML is not code. XML is data.
 
P

Patrick TJ McPhee

[...]

% But what does that have to do with XML?
%
% XML is not code. XML is data.

Hey, I didn't bring up code re-use. Someone else suggested that use
of XML (in services particularly) will result in code re-use. I simply
pointed out that the same thing has been said of almost everything
that's happened in CS for a long time. Imagining I had a point, it would
be that you shouldn't imagine that using technology X will lead to
code re-use, no matter what technology X happens to be.
 
G

GIMME

Think Web Services ...

You can marshall and unmarshall data many different ways ...

CORBA/EDI is a solution ...

XML is a solution ...

And within XML you can use SOAP or publish EJBs through a web
server, or role your own.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top