PDA

View Full Version : HTML to XML




GhostDZ9
Nov 5, 2010, 02:08 PM
Hey guys,

I'm creating a news update part to my CMS and I was wondering is it possible to have users enter there information into an html form, the info that they entered is then translated into an XML document which can later be parsed using jQuery and displayed on the site?

if there is a way to do this can you please let me know?



elppa
Nov 5, 2010, 02:46 PM
Yes. You can do that. Just take the user input and convert it into a valid xml document. How you go about this exactly will depend on the server side technology you are using, although most languages have a library (often built in) with good support for xml parsing/writing.

GhostDZ9
Nov 5, 2010, 03:01 PM
what I meant by that was can it be done automatically? if so how do i do this?

lucidmedia
Nov 5, 2010, 03:26 PM
what I meant by that was can it be done automatically? if so how do i do this?

elppa actually answered your question as far as it can be answered given the information you have provided. How you go about this is dependent on your server-side technologies...

For example, if you can use PHP on your server, google "PHP, save as XML" and you will find a handful of tutorials. The link below looked pretty good:

http://www.dynamicdrive.com/forums/showthread.php?t=14165

you already mentioned JQuery. You can also use that to format and prepare your XML, then save it via PHP.

Of course, if you have a CMS already, why are you saving files to disk? It would be better to use your CMS's API and save this content into a database table.

GhostDZ9
Nov 5, 2010, 03:37 PM
I am programming my own CMS, I'm doing this all using local host on mac, I'm aware of how to do via PHP but i was just wondering if you can do it from html to XML directly without having to use PHP

Ride9650
Nov 5, 2010, 04:38 PM
I am programming my own CMS, I'm doing this all using local host on mac, I'm aware of how to do via PHP but i was just wondering if you can do it from html to XML directly without having to use PHP

no..well technically yes, you don't have to use php, BUT you do have to process it somehow.

Though it doesn't return xml, the closest thing to automatic processing is probably using PHP's json_encode function.

GhostDZ9
Nov 8, 2010, 09:50 AM
Alright thanks thats what i wanted to know