question about rules attributes...

vaab <[email protected]> Tue, 17 May 2005 12:08:37 +0200
Newsgroups gmane.comp.mozilla.devel.rdf
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Hi,

I'm really stuck in some really simple case of templating mechanism. I 
have 2 problem that are unsolvable but really simple. What is really 
annoying is that templating do not work equally in different tags. But 
maybe is it also that there are no recent documentation.

I wonder what is the use of the "parent" attribute, and the 
'rdf:type="..."'. Or when do they work ? I've just tryed this over and 
over, noticed some change without any internal logic (well mostely for 
the 'parent' attribute). Can someone cast some light on the dark magic 
of this attribute ? It could maybe help me solve all the things I 
couldn't do with template.

I just don't understand why template are so difficult to use. The 
specification seems quite simple, the XML query langage is easy, and I 
think it is really a good choice (well it surely lack some little 
tweaks), but it simply DO NOT work as stated. And before completing this 
langage, isn't it better to make it work ?

These considerations bring me to think it is the implementation that is 
flawed. I'm not a seasoned programmer but I implemented a parser and 
builder roughly based on the same XML-language. It is incomplete, quick 
and dirty, and in PHP, but it simply works.

Is it normal that your templates can simply kill firefox (with a loop) 
while javascripts loops are detected ?

Examples :

why with this tree :

---
<tree id="test"
       flex="1"
       datasources="knowledge.rdf"
       flags="dont-build-content dont-recurse"
       ref="http://www.w3.org/2000/01/rdf-schema#Class"
       containment="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
       template="testTemplate">
  <treecols>
   <treecol label="label" id="label" flex="1" primary="true" />
  </treecols>
</tree>
---

and this template

---
<template id="testTemplate">
  <rule parent="tree" rdf:type="http://www.w3.org/2000/01/rdf-schema#Class">
	<treechildren flex="1">
	  <treeitem  >
	    <treerow>
	      <treecell uri="rdf:*" 
label="rdf:http://www.w3.org/2000/01/rdf-schema#label"/>
	    </treerow>
	  </treeitem>
	</treechildren>
     </rule>
</template>
---

Setting flag : "dont-build-content" AND attribute parent="tree" just 
don't draw anything ?
Removing parent="tree" allows to draw an empty container that is 
considered as a container... And is not, then the label disappear I 
don't know why.

IT SEEM IMPOSSIBLE to ask to draw only the first element WITHOUT 
recursion... is this normal ?

Removing the "dont-build-content" flags allows to draw the correct 
element without recursing...

And removing both make firefox enter an infinite loop and finally crash. 
While this is understandable, it could be detected easily and quickly 
with a recursion depth limit (as it is detected in javascript I suppose) 
or a simple path checker.

I'm willing to help with this as I really need a little bit more solid 
implementation of templates. Is someone willing to spend a little time 
to present me how this works and is related to the rest of gecko's code, 
and where I should look if I want to help ? Who is reviewer / 
super-reviewer that are able to look on template code ?

Can someone light me up what is the current status of all this 
template-code and why do we have to bare all this today ?. (And it seems 
that template where nearly all written 3-4 years ago ?)

Thx for all,
Valentin