[ODE] XODE - attributes or elements?

William Denniss lists at omegadelta.net
Sat Mar 20 10:26:07 MST 2004


On Fri, 2004-03-19 at 17:01, Nate W wrote:
> On Fri, 19 Mar 2004, William Denniss wrote:
> 
> > We could go with the objects=elements and properties=attributes model
> > but then we would have to make it consistant thoughtout.  Should the
> > other element of joint 'link2' be an attribute as well?  What about
> > mass, and torque, and force of Body?  The latter two have multiple
> > attributes themselves so it would have to be "torquex" "torquey" etc... 
> 
> A "thing" that has attributes of its own should probably be an element.  
> For example I'd prefer the torque vector be expressed as <torque x="0"
> y="0" z="0"> rather than torquex, torquey, torquez approach.
> 
> > Wouldn't having everything as attributes make the file a bit of a mess?
> 
> I guess that's an aesthetic thing - I like attributes because they cut
> down on mess. :-)
> 
> > Personally I think this:
> > 
> >                     <axis>
> >                       <rotation x="0" y="-1" z="0" />
> >                       <lowStop>0</lowStop>
> >                       <hiStop>0</hiStop>
> >                       <vel>0</vel>
> >                       <fMax>0</fMax>
> >                       <fudgeFactor>1</fudgeFactor>
> >                       <bounce>0</bounce>
> >                       <CFM>0</CFM>
> >                       <StopERP>0.05</StopERP>
> >                       <StopCFM>0.0001</StopCFM>
> >                       <SuspensionERP>0.05</SuspensionERP>
> >                       <SuspensionCFM>0.0001</SuspensionCFM>
> >                     </axis>  
> > 
> > Looks better than this:
> > 
> > <axis rotationx="1" rotationy="1" rotationz="1" lowStop="0" hiStop="0"
> > vel="0" fMax="0" fudgeFactor="0" bounce="0" CFM="0" StopERP="0"
> > StopCFM="0" SuspensionERP="0" SuspensionCFM="0" />
> 
> And I agree, but only you've indented one and not the other. :-) I think a
> fairer comparison would be:
> 
> <axis 
> 	lowStop="0" 
> 	hiStop="0"
> 	vel="0" 
> 	fMax="0" 
> 	fudgeFactor="0" 
> 	bounce="0" 
> 	CFM="0" 
> 	StopERP="0"
> 	StopCFM="0" 
> 	SuspensionERP="0" 
> 	SuspensionCFM="0">
> 	<rotation x="1" y="1" z="1"/> 
> </axis>
> 
> ...which I think looks better than either of the above.

Point taken.  However, typically attributes are crammed on to one line
and elements are separated out and indented so what I presented was the
"default" view of an XML file - where as yours would need some
additional logic to format it.

> I agree about making the rotation vector a child element.  The x/y/z
> values form a vector and I think it makes sense to exress vectors as
> elements.  One could argue for <stop low="0" high="1"/> but I wouldn't go
> that far - there's no common data type with "low" and "high" members as
> there is with x, y, and z.
> 
> > Do we need to vote on this too?
> 
> I dunno... if we get into the details of exactly what should be an
> attribute and what shouldn't, it could drag on for a while.  Maybe a vote
> on the general approach, though, e.g.
> 
> 1) keep the current format
> 
> 2) if an element has no attributes and a single value in its innertext,
> make it an attribute of its parent

I guess I would be happy with #2, although I have some misgivings about
the formatting and overall "feel" of the XML, it is logical for single
value properties to be attributes.

Any more thoughts on this matter?

Cheers,

Will.

-- 
William Denniss - will@ http://tanksoftware.com/



More information about the ODE mailing list