0

I am building my personal web site and I want to store my course notes on it. My course notes are currently on paper so I will be typing them up. I am thinking about storing each of my courses in its own XML file with a structure that goes like: The dashes represent tags, disregard the numbers.

COURSE1.XML
-Title  -Topic 1
        - Sub Topic 1.1
            - Multimedia link
            - Code link
            - Actual Text
        - Sub Topic 1.2             
                    ...
        - Topic 2           
             ...

My website idea is if user clicks on course 1 link then my program will go find that XML parse it and display its contents.

My Requirements:
    - Must be able to display on web sites

    - Parsing should be fast

    - In the future I might do other things so I want something that is flexible.

Is using XML for this a good design decision? Or can I do better? If XML is a good design decision: Should I stay with my current design of 1 XML per-course or have a folder for a course and have 1 XML for each topic? Other than XML, what other options do I have?

Hopefully this isn't too subjective...

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

2

Building your own web framework solution is incredibly hard. Producing something that is visually pleasing as well as validates html standards is a tremendous amount of work from scratch.

What you desire is called a CMS or Content Management System. This will allow you to concentrate on your content and not the document format in which it will be stored on the server. Most CMS use databases (such as PostgreSQL or MySQL) to store their contents and not files located on the filesystem.

Furthermore, you state that you will be using the intrinsic architecture of XML documents. XML documents doesn't have any predefined hierarchy logical for document formatting. This will require defining a structure for your documents, which will be quite easy to forget or bypass, resulting in incoherent documents. You are better of using a language that is already done for these kind of documents (such as Markdown, Restructuredtext, etc.). Most of these languages will be able to produce html and pdf documents using their converters.

To begin with something simple, you should start with some wiki software (for example these ones) which may give you the flexibility you need.

Another solution would be to use documentation building software such as Sphinx which will build you an entire website from restructuredtext sources. Many other documentation generators are available, you should check them out.

Least but not last, an full-fledged web CMS using either WYSIWYG tools (Typo3 or Joomla) or frameworks (wordpress, Django, Ruby on Rails, etc.) will allow you to produce websites relatively easily.

If you really want to implement your own website framework / CMS, bear in mind that you will need to create a model-view-controller-like system. This can be made from scratch using a front-end system to display HTML (like bootstrap) or handle templates (like Jinja2 ) as the view, a database system or raw files (i.e. XML) as the model and a controller gluing the previous two together in a programming language that can be executed by a web server (via CGI or another better way dependent on the language you use) such as nginx, apache, lighttpd or the like.

Soravux
  • 9,653
  • 2
  • 27
  • 25