superkaramba, categories, XML

Peter Bienstman <[email protected]> Wed, 22 Oct 2003 21:23:23 +0200
Newsgroups gmane.comp.tools.memaid.devel
Organization Ghent University
Message-ID <[email protected]>
Hi all,

The current CVS version of the superkaramba widget bypasses 
elements.bin/elements.xml and stores everything in an XML data format. It 
also has a category field per element.

In superkaramba/util there is converter script to import old files. E.g. to 
combine two old databases into one xml file with different categories, just 
do:

  python convert.py math/elements.txt math elements.xml
  python convert.py -append bio/elements.txt bio elements.xml

TODO: 

- write my own category-aware adding and editing dialogs. Previously I used 
KMemaid for that, but KMemaid doesn't know about categories.
- add code to activate/deactivate categories.

There is some runtime overhead because Dave doesn't want categories in the 
core, so I have to do some extra book-keeping. What would really help a lot 
(short of implementing categories in the core ;-) ), is a trivial change to 
the core: just add a 'note' string to each element:

struct elem {
        u_short tm_t_rpt;
        char *q, *a;
        char* note;
        ...
}

The core doesn't have to do anything with this field, not even write or save 
it to file. It's just a place where a front-end can park any information it 
wants to attach to an element.

I also attach the dtd I used. It's based on earlier discussions on this list. 
Based on suggestions from the mailing list, I've also tried to shorten the 
names a bit where possible. Any feedback is more than welcome ;-)

Peter

memaid.dtd:

<?xml version="1.0"?>
 <!DOCTYPE memaid [
  <!ELEMENT memaid (category, element)>
  <!ELEMENT category (name)>
  <!ELEMENT name (#PCDATA)>
  <!ELEMENT elem (cat, Q, A)>
  <!ELEMENT cat (#PCDATA)>
  <!ELEMENT Q (#PCDATA)>
  <!ELEMENT A (#PCDATA)>
  <!ATTLIST memaid time_of_start cdata "">
  <!ATTLIST category scheduled cdata ""
                     drill_badly_known cdata "">
  <!ATTLIST elem time_to_rep cdata ""
                 real_last_ivl cdata ""
                 last_ivl cdata ""
                 cur_ivl cdata ""
                 reps cdata ""
                 grade cdata "">
 ]>
 <memaid time_of_start="1063124281">
  <category scheduled="1" drill_badly_known="0">
   <name>
   <![CDATA[<h1>This is the category</h1>]]>
   </name>
  </category>
  <elem time_to_rep="36" last_ivl="6" real_last_ivl="8" cur_ivl="1"
  reps="1" grade ="0">
   <cat>
    <![CDATA[<h1>This is the category</h1>]]>
   </cat>
   <Q>
    <![CDATA[<h1>This is the question</h1>]]>
   </Q>
   <A>
    <![CDATA[<h1>This is the answer</h1>]]>
   </A>
  </elem>
 </memaid>

-- 
------------------------------------------------
Peter Bienstman
Ghent University, Dep. of Information Technology
Sint-Pietersnieuwstraat 41, B-9000 Gent, Belgium
tel: +32 9 264 34 45, fax: +32 9 264 35 93
WWW: http://photonics.intec.ugent.be
email: [email protected]
------------------------------------------------



-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54