|
-
November 24th, 2004, 09:23 AM
#1
XML + Webshop
Hi!
I've heard that xml is good and that I should use it. But what should I use xml for? What can I do with xml?
I'm going to make a webshop in php. How can I use xml here? What should be saved in a database (MySQL) and what should be saved in a xml document?
As you can see I'm really new on this. I want to know what to use xml for. How to use it, etc etc.
How do I use php with xml?
Please give me some examples.
Thanx in advance.
-
November 24th, 2004, 01:56 PM
#2
Re: XML + Webshop
 Originally Posted by Danii
I've heard that xml is good and that I should use it. But what should I use xml for? What can I do with xml?
Well the primary purpose of XML is to store data in a, presentation and context independent manner. The situation where XML is most usefull, is when you need to display the same data in multiple formats.
 Originally Posted by Danii
I'm going to make a webshop in php. How can I use xml here? What should be saved in a database (MySQL) and what should be saved in a xml document?
With a WebShop, both XML and an SQL database would be good candidates for storing product information. Basic information like height, weight, warrenty, And a host of other device specific data could be stored either in an SQL table, containing a field for each type of information. Or in XML files perhaps looking something like this
Code:
<product id="0001" name="Troll">
<description>A live troll</description>
<height inches="35" cm="100"/>
<weight lbs="50" kg="25"/>
<warrenty>3 Years</Warrenty>
<diet>Mostly chewed up little kids</diet>
...
</product>
The main drawback with an SQL table in this case, would probably be that the product table might have to hold more than a hundred fields containing all kinds of imformation, most of which are only relevant for a small subset of your products (assuming that you are selling a wide varaity of products). It's doable but perhaps not very pretty.
And if you won't be selling more than perhaps a few hundred different products, using XML files to store the data, should be quite workable.
For keeping track of all your sales, an SQL database is probably the better choice. A sales table might only contain 5-10 fields, while the number of records might grow to many many thousands over time. Few XML engines work well with large datasets.
 Originally Posted by Danii
How do I use php with xml?
There are XML libraries for PHP these are documented at http://www.php.net/manual/en/
Last edited by khp; November 24th, 2004 at 02:10 PM.
The biggest problem encountered while trying to design a system that was completely foolproof,
was, that people tended to underestimate the ingenuity of complete fools.
Douglas Adams
-
November 25th, 2004, 07:06 AM
#3
Re: XML + Webshop
Thank you for the reply 
If I'm going to add or change som info, is it easy with xml? Also if I want to delete something.
When I'm going to read from a xml file. Is it possible just to read the price only where the price is for example > 100$ ?
Thanx again.
-
November 25th, 2004, 09:43 AM
#4
Re: XML + Webshop
 Originally Posted by Danii
If I'm going to add or change som info, is it easy with xml? Also if I want to delete something.
Yes, you can edit your xml files either manually using a text editor. Or you can use a highlevel interface like DOM to edit your XML files programatically. I don't have much experience with PHP's XML libraries, so I can't tell you how good PHP's support for this is.
 Originally Posted by Danii
When I'm going to read from a xml file. Is it possible just to read the price only where the price is for example > 100$ ?
Yes of course.
The biggest problem encountered while trying to design a system that was completely foolproof,
was, that people tended to underestimate the ingenuity of complete fools.
Douglas Adams
-
November 25th, 2004, 12:47 PM
#5
Re: XML + Webshop
Thank you khp. You clared up some questions. I'll try making the whole site in xml. It will be a challange but it's not imposible
-
November 28th, 2004, 11:35 AM
#6
Re: XML + Webshop
Hi again.
I have one last question. What is XSL, XSLT and RSS?
Thank you in advance
-
November 28th, 2004, 02:43 PM
#7
Re: XML + Webshop
 Originally Posted by Danii
Hi again.
I have one last question. What is XSL, XSLT and RSS?
XSL is short for Extensible Stylesheet Language. Originally concieved to be used as a strylesheet language for creating Xml Formatting Objects pages, from arbitary XML files. But Formatting Objects never really became a popular document format. So XSLT (XSL Transformations) which can be used to transform any XML file to another XML file or a plain text file, was created as spinoff from XSL of old, now commonly reffered to as XSL-FO. These days when people talk of XSL and XSLT, they are generally talking about XSLT.
http://www.w3.org/TR/xslt
RSS (RDF Site Summary) Is a format for attaching metadata (data about data) to XML documents.
http://web.resource.org/rss/1.0/spec
Last edited by khp; November 28th, 2004 at 04:19 PM.
The biggest problem encountered while trying to design a system that was completely foolproof,
was, that people tended to underestimate the ingenuity of complete fools.
Douglas Adams
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|