|Home | Travaux STAF | STAF14 - Report for exercise 7 - XML first steps||STAF-E|
Creating an XML file for work pages of STAF students, was an idea I came out after one year at this diploma.
When I heard the advantages of XML, I thought that it could be a nice idea to use it for the work pages considering how boring is to change the work page in HTML every time a student wants to put a new exercise and how crazy Daniel :) becomes by all the different formats that each student uses for his work page.
So, I decided to do:
Technical details - problems
Scripts are written in PHP3.0.8, always through GNU Emacs 19.34.1, and search is being done by the LDAP server at TECFA.
DTD: I wish I had a good book for learning more about XML and DTD,
but unfortunately all good books from the library of CERN were borrowed
for this period :(
So, I just searched the web and resources at TECFA to learn the basics. I know that the DTD I came out is not the best, and that there are a lot more that I could have put into, but this would complicate things for the parsing and mapping, so I avoided it.
For example, I could have put also the report, split in tags that would describe it totally in order not to need the student to write it on it's own format. An overall mark should also be included.
But my biggest problem was (and still is) that I don't have validation for my emacs, I tried to use the validation service @ TECFA but I didn't succed to validate my file...
Parsing: I find parsing XML with PHP quite primitive. And in a way, this is normal considering how new is XML. But still, the documentation in PHP's manual is limited and there are not many details. I had to play a lot by putting debugging variables to be printed here and there to find out how "startElement", "endElement" and "characterData" work.
Mapping to HTML: The problem with mapping was that I had somehow to
know exactly the depth I was inside the XML tags, in order not to confuse
tags with the same name inside different nesting. For this reason, I
thought of a function that creates a string ($stack) containing the
current path of tags found. Even if it's not so stylish, it works and
considering I had to finish also my project staf18 (no much time left :)
I kept it as it is.
I have to say that it took me quite a lot of time trying to make the presentation of the data as ergonomic as possible, but the limits of the parser were always obstacles on my way...
LDAP server: Finding the basic commands for LDAP was really easy and I quickly wrote the script for searching the server, but still I don't know how I can get more details for each person other than "dn", e.g first-name, family-name, etc. I have to speak with Daniel for this soon...
As a conclusion, this time, it was a good opportunity to study PHP in
depth after having a prior experience during the second period of this year.
References - Bibliography - Sites
Last modified 18/06/99
|Back to Travaux page|