XML. (was: Re: [ODE] outputting objects)

Anselm Hook anselm at hook.org
Tue Feb 4 10:02:01 2003


I'd still argue that the point is still not the xml itself - it is that
you need some tool to map between *any* notation and C objects.  lets say
that you have an xml file:

  <ode:body>
     <position>0 0 0</position>
  </ode:body>

how do you pluck out and apply position to the ode object without having
to hand write code?  do you write code like this:

   for( all xml nodes ) {
     if( mode is body )
       if( node is position )
          body->position = parse_field
   }

clearly this would be a large mass of messy code.  the right way is to
define your reflection programmatically; at least like this:

   struct reflection_struct {
       char* fieldname
       fnpointer setter;
       fnpointer getter;
   }

   reflection_struct {
       "body:setposition", bodysetpositiongetter, bodysetpositionsetter
   }

   code() {
      for( all xml nodes ) {
         lookup reflection field name
         reflection->invoke_setter_fn()
      }
   }

and then taking things just slightly further - generate the
data-structures using a reflection generator....  then you have a system
that automates your binding between notations for declaring structure.

look at the gnome object bindings, bonobo, various idl tools....

Would you agree with me on this or do you see it as simply not being that
much trouble to do the glue code by hand?  It may just be a matter of
perspective...  as Terence Parr says (tongue in cheek) - why do in one day
what you can spend a week automating? :-)  Or as I sometimes joke - all
applications tend to re-invent java.

 - a

On Tue, 4 Feb 2003, Shaul Kedem wrote:

> some XML references:
>
> to get more into XML, learn about technologies related
> and the standard, goto http://www.w3.org/
>
> I suggest reading the XML standard, XML Schema (what
> used to be DTD) and XSL (transformation language that
> can prove useful in translating one XML format to
> another, and to HTML).
>
> Good XML parsers:
>
> Xerces (multi-platform, a bit heavy) :
> http://xml.apache.org/
>
> TinyXML (win, very light):
> http://sourceforge.net/projects/tinyxml/
>
> MSXML (win, a bit heavier, but with lots more
> options):
> http://msdn.microsoft.com/downloads/default.asp?url=/downloads/topic.asp?URL=/msdn-files/028/000/072/topic.xml
>
> Very good XML editor: http://www.xmlspy.com/
>
> browsers in which you can view xml: IE, Mozilla, etc
>
> Editors with XML capabilities: ms studio .net,
> editplus.
>
>
>
> --- w Wei <ww_dotnet@yahoo.com> wrote:
> >
> > Okay, i think XML might be the way to go with this
> > one... I know that some of you have done this
> > already (juice), could you give me some pointers to
> > get started?  Thanks
> >
> > -ww
> >
> >
> >
> > ---------------------------------
> > Do you Yahoo!?
> > Yahoo! Mail Plus - Powerful. Affordable. Sign up now
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> _______________________________________________
> ODE mailing list
> ODE@q12.org
> http://q12.org/mailman/listinfo/ode
>