Forum Moderators: open

Message Too Old, No Replies

Including XML in HTML Documents

How to transport data

         

ahamilton9

1:38 am on Jun 21, 2006 (gmt 0)

10+ Year Member



I have a Shoutcast radio station which is automatically managed by the software and outputs an xml file with current data and log information. One of the parts tells if the DJ end of the server is running by a 1 or 0 true/false statement. Now lets say I have an HTML coded webpage (which I could easily change to XHTML if necessary.), is it possible and if so how: (1) Do I allow the page to find the XML document (2) Post the information for this tage (called <serverstatus>) (3) Make it show up as UP or DOWN on the page instead of 1 or 0. I know its alot but any help would be GREATLY appreciated since I don't have much experience in XML.

choster

3:51 pm on Jun 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Off the top of my head, there are several ways to mix HTML and XML content in a web page:

1) import and manipulate the XML using Javascript. A web search on AJAX and XMLHTTPRequest will turn up many examples.

2) implementing an XML data island. Like XMLHTTPRequest this is a Microsoft technology which has been extended to other platforms, see [developer.mozilla.org...] for example.

3) use a Flash object to read the XML and display it. I have no experience with using Flash in this way.

Changing your HTML document to XHTML only helps you if you serve it with an XML MIME type, i.e. application/xml+xhtml or at least text/xml. Doing so will cause Internet Explorer to choke, however, rendering the page (no pun intended) largely useless.

ahamilton9

4:35 pm on Jun 21, 2006 (gmt 0)

10+ Year Member



I have simple blog from blogger.com. In the page formatting code, there are XML tags like <$BlogTitle$> which I know understand is a way for them to use the same template for everyone and just link them to their personal account. (So <$BlogTitle$> actually shows up as their blog's title) Problem is, they don't show the link to your XML document in the formatting text (probably so people dont mess it up and then go crying that their page doesnt work). Now that im building a new site which has a radio feed on it, I want to have a Server: Down/Up part on it so people will know it its their computers fault for not playing or if the stream is actually not active. Ive found the XML document output by the station server software and it has a tag <serverstatus>1/0</serverstatus>, 1 being on, 0 being off (duh.) Now how do I link this document to my XHTML page (I do know it has to XHTML) and is it possible to make it show up as Down/Up instead of 1 or 0 and would that require a CGI or Javascript to work? Thanks for your help in advance.

ahamilton9

4:04 am on Jun 22, 2006 (gmt 0)

10+ Year Member



Ignore the above message... its basically the same question. Sorry, I thought I was making a new thread but I guess not. Well thanks any for the help. Only problem is I don' understand this: What the hell is the use of XHTML if it can't be used to display XML data? I mean you would think you could use <link>, find the document and then use the <$-----$> tags to diplay the info but no. If anyone still knows an easier way, or possibly has a javascript file that will retrieve the xml and allow me to SOMEHOW display, I thank you.

choster

2:10 pm on Jun 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What the hell is the use of XHTML if it can't be used to display XML data?

XHTML is a kind of XML, and can be extended to display other kinds of XML (see [w3.org...] ). However, you're right that browser support is sketchy and XHTML is improperly used by many, if not most people who use it. Thus [webmasterworld.com...] .

I mean you would think you could use <link>, find the document and then use the <$-----$> tags to diplay the info but no. If anyone still knows an easier way, or possibly has a javascript file that will retrieve the xml and allow me to SOMEHOW display

Are you talking about the RSS feed? There's a whole forum devoted to RSS [webmasterworld.com].

[edited by: encyclo at 4:52 pm (utc) on June 22, 2006]
[edit reason] fixed formatting [/edit]