help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: howto return a structure from xml


From: Andy Adler
Subject: Re: howto return a structure from xml
Date: Thu, 4 Sep 2003 13:46:53 -0400 (EDT)

> * Jan-Mark Batke <address@hidden> [2003-09-04 16:52]:
>
> > 3. retval should hold the xml structure,
> >
> > retval = root {
> >               block1 {
> >                      block2 = content;
> >                      }
> >               block3 = bla;
> >               }
> > (no idea so far)

Note that this step is semantically unclear. One of the issues
with XML is that iy doesn't map clearly to data structes in
any particular language.

Some of the issues you have are:
 - How do you deal with attributes?
    <foo bar1="a" bar2="b"/>
   Note that the XML namespace spec says that attribute
   order _must_ be not significant, so you can't map it
   to an array

 - How do you deal with repeated elements?
    <foo><bar/><bar/></foo>
   That doesn't map to octave structures, but can
   map to cells

 - Do you convert strings to numbers or not.
    <foo partnumber="100.00"/>

   Do you convert this to partnumber to 100 or not.
   If you do, can you be sure that the semantics is preserved?
   If you don't then octave will end up wasting lots of memory
   handling strings (which its not really designed to do)

 - How do you handle namespaces? etc, etc.

For an extended rant on XML (from a perl perspective) see:
www.site.uottawa.ca/~adler/talks/2003/YAPC-CA-2003-XML-talk.pdf

Please don't get me wrong. I'm not saying this isn't useful
or worthwhile. I'm just pointing out that getting it _right_
is hard. (And there are thousands of broken XML parsers
to illustrate how to get it _wrong_)

Andy



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]