updating pages with XML- "forthcoming events info"

Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Feb 2005
Posts: 92
Reputation: NuGG is an unknown quantity at this point 
Solved Threads: 1
NuGG's Avatar
NuGG NuGG is offline Offline
Junior Poster in Training

updating pages with XML- "forthcoming events info"

 
0
  #1
Nov 2nd, 2006
I have multiple pages with the same information on them (forthcoming events information), and when that information needs to be changed i have to change every page which takes time. I was wondering if XML can be used to change the information on the pages by editing one central XML file, which will save me alot of time and hassle when updating the site. I have never done any work with XML before, however i have a good understanding of html and know a little javascript.

Please be aware that the information will have to be displayed in a html file. I would use asp and a database to do this, however my webhosting service will not alow the use of asp.

If anyone can give me a few tips on how this can be done it would be greatly appreciated.

Thanks for your time,

NuGG
Pubonwheels - Mobile Bar Services for the South West of England.
The Kings Head Inn - The Kings Head, Underhill, Coleford, Somerset, UK.
South West Ravers - Going out to all you jungle drum and bass ravers.
UFB Live Radio - Keep It Locked.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: updating pages with XML- "forthcoming events info"

 
0
  #2
Nov 27th, 2006
You should look into XML Stylesheet Language Transformations (XSLT for short).

http://www.w3.org/TR/xslt ...this is a good reference
http://www.w3schools.com/xsl/ ..and this is a good introduction

I would advise building the pages using an offline XSLT processor, as client side (browser) XSLT processors are at best; bad.

EDIT: Or, you could use the PHP XSLT module. IF it's installed on your server.

I make alot of pages using offline XSLT processors (Xalan + Xerces) to create static HTML pages - but they are command line tools, and you need to understand XSL to use them...

For learning, you can create XML files, link them to XSL stylesheets and test them in certain browsers (Internet Explorer and Firefox) bear in mind, that the browser is doing work that is conventionally regarded as a "server side job", and that has a number of implications, the biggest I guess is that some browsers (i.e. Opera) don't have XSLT processors, and search engines can't make head or tail of your pages.

If you need any help when you're using XSL (setup, nuances, etc) let me know, I've been using it for a while now; for pages that are too static to be considered dynamic and to dynamic to be considered static.
Last edited by MattEvans; Nov 27th, 2006 at 5:10 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,145
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: updating pages with XML- "forthcoming events info"

 
0
  #3
Dec 2nd, 2006
Do be advised that on the fly XSLT transformation can be very slow, unless you take care to cache the precompiled XSLT files between invocations.

I've done testing for that in the past.
I've actually written a system doing as Matt suggests in Java, using XSLT on a fairly large scale to process dynamically generated XML into html output (and some things into PDF using XSL:FO).

Without caching the compiled XSLT files between requests the request/response cycle was several orders of magnitude slower as compared to the situation after I had implemented such caching.
The compilation stage was that slow, the actual processing itself was extremely fast.

RSS, Web Services and SOAP Syntax (Toggle Plain Text)
  1. TransformerFactory tFactory = TransformerFactory.newInstance();
  2. // Get the XML input document and the stylesheet.
  3. Source xmlSource = new DOMSource(xmlInput);
  4. Source xslSource = new StreamSource(xslFile);
  5. // Generate the transformer.
  6. Transformer transformer = tFactory.newTransformer(xslSource);
  7. // Perform the transformation, sending the output to the response.
  8. transformer.transform(xmlSource, new StreamResult(out));

You will want to cache the Transformer here in some way and reuse it.
In the final version of that system I used a simple HashMap using the filename of the XSLT file as a key.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the RSS, Web Services and SOAP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC