|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I'm a relatively seasoned web developer. I've developed everything from personal homepages in HTML, to complex web apps in ASP and PHP.
I've heard a lot lately about XML, and I've even read through some of the XML articles on devshed. However, the biggest question I have is 'Why should I learn XML?' From what I've gathered so far, XML isn't a language like HTML or PHP... it deals more with the organization of data, which is great. But how could it benefit what I already do, or better yet... what could it allow me to do that I might not, or cannot do in any other language? I've looked for answers, but probably the best way to find out is to ask people who use it. What do people commonly use XML for? Thank You, - coredumped. |
|
#2
|
|||
|
|||
|
coredumped,
XML is used exactly for what you said, organizing data. Or more specifically, formatting data. It provides a means for formatting input data and enforcing what ever types of rules you would like to apply to that input data. I use it for a web based questionaire. We present a questionnaire to our customers to gather input data for on-site installations. Asking things like how many nodes, IP addresses, ethernet addresses, etc. This questionaire changes from project to project, and its a real pain in the *** having to completely redo a web page once a month. So what I did is to design a questionnaire input format in XML and a parser/presentation program in Javascript. Then all I have to do is redo the questionnaire input file and thats it, a new questionnaire. Javascript has some powerfull XML methods, that easily allow you to parse the input file. So the two together provide a powerfull way to display data with using a flexible input data file. I haven't looked into it yet, but I imagine you can do the same with PHP. Good luck. Brady |
|
#3
|
||||
|
||||
|
quite nice reply, Johnson
Now as complimentray to above, I just ought to say that probably one the major advantages of xml is that it is platform-software independent. That is you can write one xml file and then parse it in pretty much everything you could ever want. XML is also nice to share information inbetween defferent clients or servers without much hassling. And even though you will still be using any of basic languages to output data, it is __way__ easier to describe it with xml. Answering your question: Yes, you could live without it, but the amout of work and time it can save you is tremedous and it is not very smart decision not to be able to work with XML. Speaking of php, oh yes we do have large variety of functions connected to xml, so you can easily combine those two.
__________________
And you know I mean that. |
|
#4
|
|||
|
|||
|
Managing data
One thing that coredumped has assumed is that its system would only want to communicate with itself. He has been working with close systems.
If you had to design a system which had to communicate with an existing one, how would you like to do it? Let's say, your PHP system has to get the stock quotes from another server. The other server is a NT, and you are using Linux. The stock server company can give you a NT version of its client software, but not a Linux one. Oh, as it's using its propietary format, you'll have to code something to communicate with its server. And you'll be in fact programming a client. The stock server changes its structure to offer also the web address of the companies in the stock. Well, go, rewrite the client and so on. If you were communicating using XML, you'll have these benefits: - You can easily write a client app, and visually debug it. - You can desing an standard but not close communication protocol. - You can use all the XML libs in order to save you work. - As it's text, it's cross-plattform. - You can always discard upgrades from your client. I was thinking the same, but when I had to manage data among various servers, I saw the benefits of using XML.
__________________
Thrasher 'Y se ahogaron los dooos No eran duros pa pagar, cuñaaoo !!' El vagamundo - El risitas y su cuñao |
|
#5
|
|||
|
|||
|
As far as I am concenrd XML is the only way to publish a database on the web. The ease of extracting the info and searching for the info after it has been published is reason enough to use XML.
|
|
#6
|
||||
|
||||
|
Quote:
Well if by database you mean *sql's/oracle/odbc then that is not correct: you can easily work with pretty much all db's from php, perl, c, and I think asp. |
|
#7
|
|||
|
|||
|
I know there are a lot of ways to work with dbs what I meant to say was that XML provides a very 'readable' and simple syntax for retreiving data from a db and by its nature (tags corresponding to actual names) provides an even simpler way of searching for them when for example the web page is published.
My point is I think it is easier to work with XML if you intend to publish dbs. |
|
#8
|
|||
|
|||
|
listen, in few words
YOU DO NOT NEED XML! ok ? ![]() No really, you may need XML someday if you have to organize your data. ex: I have a DB and I want to take what I have in the DB and give it to others without giving them access to the DB. So what I do, I have a xml.php that generates an XML file of my entire DB, so it organizes my data and sends it to the user. Then all they do is use my or their own parser to put the data back in their own database or print it on the screen or whatever they want to do. if you do not plan on doing such things then just keep going with your life, don't complicate it for nothing. take care. |
|
#9
|
|||
|
|||
|
More XML
That's a good use of XML, but think about it a little more.
You want to send your database to another person in such a way. But you also have to send half of the tables to another, half of the fields to another, and so on. If your data is not confidential, I mean, that you can show your entire database to anyone without worrying about what would they do with the data, you can send them the same file, and each of them will parse it differently, but retrieving the data they want. Not only for databases. Think about the RDFs of various sites, like Slashdot and Devshed. You can download the full articles and later parse and get only the headers. There's a lot of ways to get profit of XML. But I have to say that the use of making web pages only from XML and CSS is crazy. You'll never get what you want, it's not designed for a good presentation, so if you want to use XML to skip HTML, forget it. |
|
#10
|
||||
|
||||
|
I just have few very simple questions and small comments (I hope it comes out that way), In an attempt understand why employers and tech heads and journie's reasons for praising it:
Q1. In all the who-ha around XML and its variants (everyone praising it and all), does anyone actualy know how to use it for an e-Commerce site? Q2. What ever happened to HTML's so called XML Based replacement "XHTML" (Which is yet another technology ringing in our ears that is barely used by anyone)? Comment: I have noticed a rising number job listings asking for people who know this over-rated technology that nobody seems to be able to explain how to use in real world solutions, or atleast to same degree as you can with DHTML + PHP4 + MySQL. Most tutorials provide you with little or zero knowledge on how to use it effectively for real world applications such as e-Commerce and Info sites. Judging from what I have read in tutorials... this is its basic use: [ User Request ] ---> [ PHP Page ] ---> [ DB ] ---> [ PHP Page ] ---> [ XML Data Formating Template ] ---> [ PHP Page ] ---> [ HTML ] ---> [ USER BROWSER ] Isn't it easyer just to build the solution in PHP use a HTML template without XML... God Bless Scott
__________________
deepspring - "Netscape 4 users are like lemmings... You can't help but laugh when one falls off a cliff" Last edited by deepspring : October 16th, 2001 at 04:50 AM. |
|
#11
|
|||
|
|||
|
Use
I think that the real use of XML can be as follows:
[ User Request ] -> [ Apache server A] -> [ PHP page ] -> [ IIS server B ] -> -> [ ASP page (B) ] -> [ XML data retrieval (B) ] -> [ PHP page (A) ] -> -> [ HTML formatting ] -> [ Browser ] It is intended for having one server (A) gathering information from another server (B) and giving it with its own format to the user. The problem is that you think locally. If you need data from another server, and you don't have access to its database, you can not get "on the fly" the php arrays of data from the other server, and you have to serialize it before you can access to it. And this way you can avoid the problem of cross-plattform data. You are right when you say that using PHP with MySql to generate HTML is easier and with better performance, but it does not apply when you are building distributed sites. A1. You can use it to send the address of your client to your store and make them send the product to him. A2. Forget it, master DHTML. |
|
#12
|
||||
|
||||
|
Thankyou.. you have answered some of my questions and concerns.
(Relating to A1.) So how would I implement such a thing in a PHP + MySQL driven site?? ![]() God Bless Scott P.S, yes I am only a blonde in my spare time ![]() Last edited by deepspring : October 16th, 2001 at 10:13 AM. |
|
#13
|
|||
|
|||
|
XML?
I've read through all the postings here and all are valid points. But if you just want to access a DB why not use whats around and works? If you needed to produce multi tiered web apps which use many databases and the such why not use Java and its derivatives such as JSP?
Some of the examples given here for using XML is to get site content off a site where you don't have database rights! Isn't this illegal as surly if you had the permission of the site owner to take the content you'd be granted access to his database? I'm sorry if my points are wrong, I am the first to acknowledge there is much I still have to learn about web tech, but if you don't ask.... ![]()
__________________
Humble Seeker The longest journey starts with the smallest step, and knowledge is the longest journey of all. |
|
#14
|
|||
|
|||
|
Humble Seeker,
>Some of the examples given here for using XML is to get site content off a site where you don't have database rights! Isn't this illegal as surly if you had the permission of the site owner to take the content you'd be granted access to his database? Ever tried to get a connection from Perl script (using DBI) to an MS-SQL server ! Takes a whole lot of work, even have to recomplile Perl using SyBase libraries... The server was available to us, just that the bridge between NT and Linux was not easy. Event ODBC was not an obvious choice... So much trouble that we decided to keep an NT box running ActivePerl in order to have easy access to the MS ODBC engine. I wanted a total switch to Linux/Apache, but this glitch postponed everything. The MS SQL db was used by national apps that where not under our control. We had access to the db, the problem resided in the PLATFORM difference. I did not know that XML could have solved that. I'll keep that in mind ! Thanks all ! ![]() |
|
#15
|
|||
|
|||
|
Humble Seeker,
I think that you are missing the point. As an example (not real): I am the Technical Manager of ISellDVD.com. I have a typical website which sells DVD. Let's see the steps: 1.- The user connects and gets the list of DVDs. 2.- He selects one from MY database and asks to buy it (Matrix). 3.- In MY database I know that I have sold out all existences of that particular DVD (Matrix). But I don't want to loose the customer, so I ask to my Columbia distributor if he has any copy. 4.- If he has got any copy, I ask him to include 2 Matrix copies in his list of DVDs to be sent to ISellDVD.com. At the end of the week I'll receive them. 5.- I update my database adding in the stock ordered field 2 more copies of Matrix, and indicating that one has been sold. 6.- The next customer asking for Matrix will ask MY database to see if there are available copies. I'll agree him, as I have an extra copy ordered yet. I include him in the orders list. OK, let's see the point. Do you think that Columbia would agree me to access to its database freely? Am I stealing something? I only have to ask them for stock, and order them to give me some products. They can give me an interface to interact with its database, not a truly access. One way could be XML. Let's see. This is the request sent to sells.columbia.com:45567 Code:
<xml>
<order from="ISellDVD.com">
<dvd>
<name>Matrix</name>
<number_copies>2</number_copies>
</dvd>
</order>
</xml>
And the answer could be Code:
<xml>
<order id="#76213452">
<status>Accepted</status>
<dvd>
<name>Matrix</name>
<number_copies>2</number_copies>
<special_gift>Movie poster</special_gift>
</dvd>
</order>
</xml>
As you can see, implementing such a mechanism is not difficult, it's efficient and it's multiplattform, human readable, ... See that the answer has a field called <special_gift>. You do not even have to know about it, you'll parse the XML correctly and gather the info you want. If it has been extended, you do not have to worry about it. Can you show me this example using JSP ? |