XML: pros and cons

Z

Zhou Lei

Hi friends I'm a newbie learning XSLT to transform an XML to some other
documents. Now I have some questions, anyone could give me some suggestions
on them?

1. If we save our documents in XML rules and these files should be published
on Internet through WWW, what we can benefit from the XML files? And what
are the drawbacks (is it too complex or time-consuming because we have to
define a new set of XML elements to save the documents, and write the XSLT
to transform them to XHTML)? Is it more convenient to use XHTML+CSS?

2. The transformation from XML to XHTML using XSLT can be completed on
server side (such as cocoon) or client side. I know transformation on client
side can bring some compatibility problems because older web browers cannot
recognise and complete the transformation. But on the other hand,
transformation on server side may consume the server resources. Are there
any other advantages/disadvantages for the transformation on
server-side/client-side and what are they?

3. During the learning process, I touched some small exercises on the DTD to
define the XML elements, and I found it sufficient to describe the XML tree
structure and I don't know why we introduced a new Schema to replace DTD.
What are the advantages of using Schema, besides it is written in XML? And
where can I find the Schema is more powerful and flexible than DTD?

Thank you all,

Regards,
 
M

Mukul Gandhi

Zhou Lei said:
1. If we save our documents in XML rules and these files should be published
on Internet through WWW, what we can benefit from the XML files? And what
are the drawbacks (is it too complex or time-consuming because we have to
define a new set of XML elements to save the documents, and write the XSLT
to transform them to XHTML)? Is it more convenient to use XHTML+CSS?
In HTML you can directly specify presentation(like bold text,
hyperlinks etc..) along with data. If your objective is just to
publish information on web, I feel HTML is a good choice. You can
easily create HTML in popular HTML editors and serve it via a standard
web server. Publishing content via HTML has no transformation overhead
(which XSLT has). But if you are getting XML generated by some
application and need to show it on web, then definitely you have to
transform it into HTML. This you can do using CSS or XSLT. CSS would
allow you to add advanced presentation to HTML (but would not provide
advanced transformation capability as XSLT does). XSLT would allow you
to perform advanced transformation/filtering/calculations on XML. You
can apply XSLT on the server side or client side. The server side
approach will be ideal if your goal is to cater to all the browsers.
As not all browsers support XSLT in the same way. You may even combine
CSS and XSLT (both on server as well as client side). The choice will
depend upon exact requirement..
2. The transformation from XML to XHTML using XSLT can be completed on
server side (such as cocoon) or client side. I know transformation on client
side can bring some compatibility problems because older web browers cannot
recognise and complete the transformation. But on the other hand,
transformation on server side may consume the server resources. Are there
any other advantages/disadvantages for the transformation on
server-side/client-side and what are they?
The XSLT transformation on server side is advantageous if you need to
cater to all browsers (as server will send only HTML to the browsers).
If your need to cater to maximum clients is of utmost importance, then
you have to bear the transformation overhead! But today server
platforms are quite powerful, so I feel it should not be problem.. The
advantage of XSLT processing on client side would be benificial,
because it will relieve the server from transformation overhead (Also
you will not need to install any additional software like XSLT
processor, JVM etc.. You can just place XML and XSLT files on web
server, and they will be served to client over standard HTTP protocol,
where transformation will be performed)
3. During the learning process, I touched some small exercises on the DTD to
define the XML elements, and I found it sufficient to describe the XML tree
structure and I don't know why we introduced a new Schema to replace DTD.
What are the advantages of using Schema, besides it is written in XML? And
where can I find the Schema is more powerful and flexible than DTD?
XML Schema is definitely more advantageous than DTD. You can specify
more constraints on XML using Schema than DTD. It provides useful data
type system, which allows you to specify data types on XML elements..
Data typing is quite useful, as it helps to eliminate bugs at a very
early stage of application development.. DTD has a very restricted
type system.. Having meta-data about XML in XML format(i.e. XML
Schema) has various other advantages.. You can manipulate XML Schema
using standard XML parsers, and can do XSLT transformations on them..

I think I have only mentioned few of the points!

Regards,
Mukul
 
Z

Zhou Lei

Mukul Gandhi said:
In HTML you can directly specify presentation(like bold text,
hyperlinks etc..) along with data. If your objective is just to
publish information on web, I feel HTML is a good choice. You can
easily create HTML in popular HTML editors and serve it via a standard
web server. Publishing content via HTML has no transformation overhead
(which XSLT has). But if you are getting XML generated by some
application and need to show it on web, then definitely you have to
transform it into HTML. This you can do using CSS or XSLT. CSS would
allow you to add advanced presentation to HTML (but would not provide
advanced transformation capability as XSLT does). XSLT would allow you
to perform advanced transformation/filtering/calculations on XML. You
can apply XSLT on the server side or client side. The server side
approach will be ideal if your goal is to cater to all the browsers.
As not all browsers support XSLT in the same way. You may even combine
CSS and XSLT (both on server as well as client side). The choice will
depend upon exact requirement..

The XSLT transformation on server side is advantageous if you need to
cater to all browsers (as server will send only HTML to the browsers).
If your need to cater to maximum clients is of utmost importance, then
you have to bear the transformation overhead! But today server
platforms are quite powerful, so I feel it should not be problem.. The
advantage of XSLT processing on client side would be benificial,
because it will relieve the server from transformation overhead (Also
you will not need to install any additional software like XSLT
processor, JVM etc.. You can just place XML and XSLT files on web
server, and they will be served to client over standard HTTP protocol,
where transformation will be performed)

XML Schema is definitely more advantageous than DTD. You can specify
more constraints on XML using Schema than DTD. It provides useful data
type system, which allows you to specify data types on XML elements..
Data typing is quite useful, as it helps to eliminate bugs at a very
early stage of application development.. DTD has a very restricted
type system.. Having meta-data about XML in XML format(i.e. XML
Schema) has various other advantages.. You can manipulate XML Schema
using standard XML parsers, and can do XSLT transformations on them..

I think I have only mentioned few of the points!

Regards,
Mukul

Thanks for your reply, I think I will continue to learn Schema...
 

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

Forum statistics

Threads
473,999
Messages
2,570,246
Members
46,839
Latest member
MartinaBur

Latest Threads

Top