SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question XML-based Content Management System?

    Hi there,

    I'm about to develop a small content management system that will be driven by one (or several) XML files rather than a traditional database. The system will mainly be used to create and maintain small to medium sized corporate websites without any substantial e-commerce facilities.

    My main concern at the moment is speed. Since each webpage will be generated from an XML file, I wonder if this will be fast enough compared to traditional (database-driven) methods. Will the system be able to display a dynamic webpage fast enough when it has to read all the content from an XML file?

    What would be the best way to handle this?

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all, I hope you are considering separating the visual, "view" part of your pages (usually unchanging) from the more dynamic part and not generating each page in total from xml. Templating that uses precompiled data (such as Smarty) and caching should help a great deal.

    As far as the dynamic part, I too am interested in hearing if anyone has run across any studies concerning xml vs. rdbms data in this context. The obvious concern would be if too much data is stored within only a few xml files (or one file!) and the loading and parsing becomes an issue. I see config data and other small parsels as being an excellent choice for xml but what about medium size data storage or even large? Anyone? I see that there are indeed companies using xml only storage for CMS.

    -Thanks

  3. #3
    SitePoint Evangelist ikeo's Avatar
    Join Date
    Oct 2004
    Location
    Austin Texas
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It depends on
    1. How you read and write the XML
    2. How many records you have in the XML file.

    Using SAX as opposed to DOM is faster as it blasts right through and spits out the info. But DOM gives you more control over your data since it reads the entire file into memory and holds it there.

    I just implemented a small XML system in ASP.NET and I've been pleasantly surprised with the results. Remember XML isn't built to be a database so if your XML file starts getting really big then you will start to see the performance drop off badly. But for small records there isnt much of a difference (that I've seen anyway).


    Quote Originally Posted by PixelLover
    Hi there,

    I'm about to develop a small content management system that will be driven by one (or several) XML files rather than a traditional database. The system will mainly be used to create and maintain small to medium sized corporate websites without any substantial e-commerce facilities.

    My main concern at the moment is speed. Since each webpage will be generated from an XML file, I wonder if this will be fast enough compared to traditional (database-driven) methods. Will the system be able to display a dynamic webpage fast enough when it has to read all the content from an XML file?

    What would be the best way to handle this?

  4. #4
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Quote Originally Posted by ikeo
    It depends on
    1. How you read and write the XML
    2. How many records you have in the XML file.

    Using SAX as opposed to DOM is faster as it blasts right through and spits out the info. But DOM gives you more control over your data since it reads the entire file into memory and holds it there.

    I just implemented a small XML system in ASP.NET and I've been pleasantly surprised with the results. Remember XML isn't built to be a database so if your XML file starts getting really big then you will start to see the performance drop off badly. But for small records there isnt much of a difference (that I've seen anyway).
    Hey guys, thanks for your input.

    I agree, splitting the data into several XML files rather than a single one sounds more promising.
    I don't know much about DOM or SAX yet but I will do some serious reading on that in the next few weeks. What exactly is the difference anyway? And which of the two seems more suited to the task?

  5. #5
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    Quote Originally Posted by ikeo
    It depends on
    1. How you read and write the XML
    2. How many records you have in the XML file.
    Oops, totally forgot to answer that question.

    1.
    Right now I think it would be best to read the user input via HTML forms (online) which will then be converted into XML files via PHP. PHP could also be used to re-convert the XML into HTML (the final website), although some people suggested to me that XSLT (part of XML?) could do the job equally well or with even less programming work involved.

    2.
    The XML files will be kept reasonably small. Right now, I am thinking that each XML files should contain the content data for ONE webpage. Since the system is targetted at small to medium sized corporate websites, there won't be toooo many pages though, maybe up to 20...?

    I only just started to think about this seriously, and I'm trying to figure out a way to make it as simple as possible. Any input from you is appreciated!!

  6. #6
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The difference mostly between DOM and SAX is,

    DOM

    Document is loaded into DOM object, all at once - an important point to remember is your said document is something like 60Mb - The DOM requires a lot of memory therefore, but it's one advantage is that you can query the whole or part of the document easily, via the DOM it's self, or via XPATH for example.

    SAX

    The document isn't read into memory all at once, so you can stream the file for example - you can't with the DOM, and the document is parsed by start and end tags. For the task of just reading an XML file which requires no processing, then SAX is better.

    On the other hand, if you want to transform your XML use the DOM - although in saying that, there are libraries out there which will replicate (without the DOM I believe) your SAX fed document, to an XML tree, so you can transform it via an XSL-T document

    I've hardly ever used SAX myself, I'm a standards man so DOM gets my vote, but I feel more comfortable with the DOM though; I know what I'm doing with it, so your milage may vary.

  7. #7
    SitePoint Zealot _theworks's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A XML based CMS that uses XSLT for templates would be very nice..

    why not considere getting php5? php5 comes with a really handy extension called SimpleXML and it makes parsing XML with php a breeze.

    though using SimpleXML will make it harder if not impossible to use xslt for templating, you could just use Xhtml and Css for templating...


    example of using simple xml
    PHP Code:
    <?
    $xml 
    simplexml_load_file('file.xml');

    foreach(
    $xml->item as $item)
    {
        echo 
    $item->title;
        echo 
    $item->description;
        echo 
    $item->link;
    }
    ?>
    Edit; if you wanted to use XSLT, XSLTProcessor->transformToXML()
    would work great...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •