Forum Moderators: coopster

Message Too Old, No Replies

XML how?

         

bleak26

9:21 am on Apr 18, 2006 (gmt 0)

10+ Year Member



Hi, I am at a turning point where I wish to start using XML in my web pages. I use MySQL and PHP5, and I would like to query my database and return XML which I can then use in my Dynamic pages. I have learnt about the structure of XML, and done some Client-side XSLT transforms. I have found the excellent, simpleXML library and can see that it's a good way to manipulate the XML. But I have several large questions, which I need to find answers to, in order to proceed, so I thought of you guys at Webmasterworld and hoped you could help.

I have to add articles to my website and I would like to store them in a flexible, efficient manner that allows me to dixplay them in part or in whole in various areas of the site.

So, here's my questions:-

1: Is it possible to get MySQL to return XML from a query?

1a: Is it my best option to store my data as XML or as plain data and extract as XML?

1b: What is the best way to do this?

2: Can a page contain just bits of XSLT, rather than be an XSLT page?

3: Do I query my database and incorporate the XML results into a page the same way I would usually echo a variable, or do I somehow query to create a separate XML document, and state it as the source for an XSLT page?

3a: What's the best method to do this?

4: Is there a good method for breaking down text documents into XML without manually asdding a tag to every title, paragraph etc etc.

5: Is there any logic in storing articles as XML files instead of in the database?

henry0

4:31 pm on Apr 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry no answers but a question :)

Could you outline the advantages gained by using XML & PHP
Mostly why using XML? Because....

thank you

bleak26

5:30 pm on Apr 18, 2006 (gmt 0)

10+ Year Member



I am using XML for this project because I want to adopt a flexible storage method where I could easily access any element of the documents, and also because I wanted to learn it.

bleak26

5:36 pm on Apr 18, 2006 (gmt 0)

10+ Year Member



If my first post seemed long. It was not because I want huge long answers, or anyone to do the work for me, I just need pointers to the technology and a little advice.

gettopreacherman

8:31 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



1: Is it possible to get MySQL to return XML from a query?

1a: Is it my best option to store my data as XML or as plain data and extract as XML?

1b: What is the best way to do this?

****************************************
it's not that difficult...you build the xml file on the fly with php. You simply echo or print in the content of the query into the xml file and when it is read, it's xml...no need to make the data different in the db.
****************************************

2: Can a page contain just bits of XSLT, rather than be an XSLT page?

****************************************
I don't believe so, usually an XSLT is like a template file, you use all of it or none of it...try googling exit xslt for html or something similar.
****************************************

3: Do I query my database and incorporate the XML results into a page the same way I would usually echo a variable, or do I somehow query to create a separate XML document, and state it as the source for an XSLT page?

3a: What's the best method to do this?

****************************************
Think of XSLT like CSS, you tell it where to get stylized and it will do it. echo in the contents and make sure in the header you tell where you want the style to come from.
****************************************

4: Is there a good method for breaking down text documents into XML without manually asdding a tag to every title, paragraph etc etc.

****************************************
Throw it in a db with headers of the information and then echo them into a dynamically generated xml file.
****************************************

5: Is there any logic in storing articles as XML files instead of in the database?

****************************************
There isn't a need to...XML is a way for companies to or businesses or web servers to "Speak" the same language. You can have your data however you like, just when you call it from your database it's in that format, XML...
****************************************

Hope this helps!

gettopreacherman

8:32 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



Henry,

Advantages to XML, it's standardized and if you wanted to you could create a web service that allows you to access the information within your database in a standard method...quicker, effecient and lots o businesses won't work with you if you don't have one...

henry0

10:17 pm on Apr 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



gettopreacherman,
Thanks; guess it might be time to look at it!
At least to really appraise its benefits.

Unfortunately there is only 8 640 000,00 seconds
in a day :)

gettopreacherman

2:35 am on Apr 20, 2006 (gmt 0)

10+ Year Member



ROFL...tell me about it...I wish I had an extra 1,000,000 to spare...

bleak26

5:30 pm on Apr 20, 2006 (gmt 0)

10+ Year Member



thank you very much, getto you're a star. I was worried it may have been looking like an essay question. now I shall get to building my CMS with glee(ish)

once again thanks