octave-maintainers
[Top][All Lists]
Advanced

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

Re: XML tools for Octave


From: Andy Adler
Subject: Re: XML tools for Octave
Date: Thu, 29 Jun 2006 09:05:12 -0400 (EDT)

On Thu, 29 Jun 2006, Bill Denney wrote:

Andy Adler wrote:
I'm trying to write this. My idea is that XML like this
<a b="c" d="e"> text <f g="h"/> more text <f>data</f> </a>

will load into octave as

    v= xmlparse( filename)

with:
    v.a.ATTS.b      => "c"
    v.a.ATTS.d      => "e"
    v.a.TEXT        => " text  more text  "
    v.a.f(1).ATTS.g => "h"
    v.a.f(2).TEXT   => "data"
Shouldn't it parse as something more like

v.a.ATTS.b = "c"
v.a.ATTS.d = "e"
v.a.CHILD{1} = " text "
v.a.CHILD{2}.f.ATTS.g => "h"
v.a.CHILD{3} = " more text  "
v.a.CHILD{4}.f.CHILD{1}   => "data"

because otherwise you lose the fact that <f g="h"/> is between " text " and " more text ".

Bill

My concern is that this output makes writing software to parse the
xml output really frustrating - you need to loop through the CHILD
vectors to find what you're looking for. This would result in people taking shortcuts that make the code fragile.

This is actually a big debate in the XML semantics community - the fact that XML does not map easily to data structures.

The other issue is that XML allows tag names to be full unicode,
but octave will only allow [0-9A-Za-z_] characters for structs.
I'm not sure how to deal with this, but I want to keep a simple
output format.

--
Andy Adler <address@hidden> 1(613)562-5800x6218



reply via email to

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