On Wed, 17 May 2006, Alois Schloegl wrote:
what I like on XML4MAT and XMLTREE is, it returns a structure; the
fields can be easily accessed and the API is simple. Also I think that
XML4MAT is a flawed approach, because it uses to many passes through the
data.
So, I used your examples to test XMLTREE.
[snip]
h =
XMLTree object (5 nodes) []
ans =
1x1 struct array with no fields.
It parses example 1 . Problem?
[ Example 1 was]
s{1}=['<xml>v',13,'<b>v</xml>'];
Alois,
Sorry to take so long to get back to you. Everything here
seems ok except example #1.
This sample is non-well formed XML. A parser should not
accept it as XML at all.
The <b> tag never closes. I suppose that
a parser could try to guess, but what is a good guess?
<xml>v <b></b>v</xml>
OR
<xml>v <b>v</b></xml>
The homepage of XMLTREE says:
---------
XMLTree: an XML toolbox for Matlab
XML Parser is an XML 1.0 parser written in Matlab. It aims to be fully
conforming. It is currently not a validating XML processor. "
---------
Do you think XMLTREE is a reasonable approach and its worth making it
useful for Octave?
I tool a quick look, and would guess that xmltree can be adapted without
too much work. It uses classes, so this would need to be modified. It
also has a short mex file xml_findstr.c which doesn't look too hard
to convert.
So this may be a good approach; however
1) I'm a little wary of the way its programmed. It looks like too much
re-inventing of the wheel
2) In general, I would prefer an approach that goes with Bill Denney's
suggestion of expat or Xerces and does little of the work in the
scripting language.
Does anyone know if what xml libraries are commonly provided with
different flavours of OSes these days.
Looking in /usr/lib/libxml* on my debian system gives:
libxml2 - the XML C parser and toolkit developed for the Gnome project
libxmlparse - libxmlparse is a lightweight ANSI C++ XML parser.
libxmltok - get encoding and create tokens for the XSLT engine
libexpat - an XML parser library written in C
My guess would be that libexpat is the most common. Comments?
--
Andy Adler <address@hidden> 1(613)562-5800x6218