Jump to content

Brief Xml Related Questions


Recommended Posts

Hi everyone,


I recently encountered something online that provides XML feeds for people to parse so as to display the information on their site. Which is really exciting for me, because previously I'd never encountered an actual implimentation of XML. I know it's very popular nowadays, but unfortunately never done anything with it.


So my question is, do my domains support XML? I'm sure they do, but thought I'd ask anyways. I think you need to save the appropriate page as .xml, correct? Which is somewhat of a problem, since all my pages are .php as I use PHP prolifically. Any way to combine the two or are they completely mutually exclusive? I know how I can make that work, at least (include() the XML file into my other pages that I want to display it on).


Also, does anyone know of any good beginners tutorials for XML? If not I'll just do a search myself, no biggie. =)


Thanks for any help you can offer.

Link to comment
Share on other sites

inserting XML calls, functions and parsing into your PHP text should be little or no different than adding javascript. There may be some limitations to what you can do, per the link provided by Robert.


One of the really nice things about XML is that you can open it in a standard IE 5+ browser in the raw, loading from your local drive, and it will tell you immediately where your errors are. No need to wait until it is on the server just to find out you messed up.


It really is not a difficult language and is rather human friendly, where most web languages so far have been more machine friendly.

Another great pair of sites for learning are www.xml.com and www.xml.org (go figure, huh)... these sites provide a veritable smorgasboard of links to articles and such regarding XML in the real world.

Since we are all on Apache servers here, take a look at h*ttp://xml.apache.org/ for some good tips and tricks.

And find some good samples here:



... I had to go through a lot of XML stuff when i started working with a new product a couple of years ago... when XML was just coming in to fashion. Most of it was to display OPC Server data and machine control archives through a web interface, though.

By the way... I googled XML, and all of these pages came up in the first 2 pages :D



Link to comment
Share on other sites

Are you talking about an RSS feed? If so, this information may help:



There are some modules for PostNuke that will parse them automatically. These are written in PHP, so you should easily be able to understand them and derive what you need from them.


Usually straight XML is displayed through the use of a stylesheet, but if you already know PHP I would download some code to do it for you or just write a PHP parser yourself. If it is an RSS feed then just search Google for RSS and you should find something.



Link to comment
Share on other sites

I think it's just an XML file, not an RSS feed.


Okay, so if I have this correctly... to display the information you can either use CSS (which would require I display the whole page, right? Which I don't want to do... I want to pull certain bits out of it), or I can use PHP functions to parse it.


I'll go look up the PHP functions right now, maybe I can get this working without too much trouble. =D

Link to comment
Share on other sites

Oops... When I said "stylesheet" I meant an XSL style sheet. Not CSS. XSL will allow you to parse it however you want. HOWEVER you must be able to link the XSL to the XML. This can be tricky (or a pain in the rear) if you aren't the one creating the XML or you do not know your target platform. I have a lot of experience with XML reporting, but fortunately I know my target browser is always going to be IE 6. If I can help anymore please let me know.



Link to comment
Share on other sites

Well, I found a script on the web that did what I needed it to do (create an array tree structure based on the XML), and from there I'm fine. It was a pain to find a script, apparently people on the web don't really know how to include instructions (and contrary to popular belief, it's not easy to figure out when you have a class with five different functions and nothing takes what you think it should - and I'm a programmer!). Hopefully someday, maybe this summer, I'll be able to sit down and write my own script to parse it, but right now I just don't have the time. (Speaking of time, I really need to go study on my midterm... eek.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...