1. XML library by Thomas Parslow

I tried this code:

include print.e
include xml.e

object xml
xml = xml_Parse("<aaa>bbb</aaa>")
print(2, xml )

xml = xml_GetSubElement(xml, "aaa")
print(2, xml)


but the output is:

{{1,{"aaa",{},{{3,"bbb"}}}}}
C:\EUPHORIA\include\xml.e:321 in function xml_GetSubElement()
subscript value 2 is out of bounds, reading from a sequence of length 1
... called from xmlcoba.ex:9
--> see ex.err


Press Enter...


Am I right in using xml_GetSubElement?

Thanks!

new topic     » topic index » view message » categorize

2. Re: XML library by Thomas Parslow

> I tried this code:

> include print.e
> include xml.e

> object xml
> xml = xml_Parse("<aaa>bbb</aaa>")
> print(2, xml )

> xml = xml_GetSubElement(xml, "aaa")
> print(2, xml)


> but the output is:

> {{1,{"aaa",{},{{3,"bbb"}}}}}
> C:\EUPHORIA\include\xml.e:321 in function xml_GetSubElement()
> subscript value 2 is out of bounds, reading from a sequence of length 1
> ... called from xmlcoba.ex:9
-->> see ex.err


> Press Enter...


> Am I right in using xml_GetSubElement?

> Thanks!

The reason for this is that xml_Parse returns a sequence where each
element represents an xml document (A xml document always has a single
root element). So this would work:

--include print.e
include xml.e

object xml
xml = xml_Parse("<root><aaa>bbb</aaa></root>")
print(2, xml )
if length(xml) < 1 or xml[1][XML_pTYPE] != XML_tELEMENT then
    puts(2,"Unable to parse XML fragment\n")
    abort(1)
end if
xml = xml[1]

xml = xml_GetSubElement(xml, "aaa")
print(2, xml)

XML.E is not a very good library at all, it's slow, hard to work with
and non-conformant, this is mainly because I didn't really have any
idea of how to work with XML when I wrote it :)
I've written a completely different XML parser which I'm now using in
my Jabber client, it's available in the Marvin source package at
http://marvin-jabber.sourceforge.net/ (it's in the eebax directory).
If anyone is interested I'll write some docs and examples and release
it separately...

Thomas Parslow (PatRat)
E-Mail/Jabber: tom at almostobsolete.net
ICQ: 26359483

new topic     » goto parent     » topic index » view message » categorize

3. Re: XML library by Thomas Parslow

On 11 Apr 2002, at 18:35, Thomas Parslow (PatRat) wrote:

> 
> > I tried this code:
> 
> > include print.e
> > include xml.e
> 
> > object xml
> > xml = xml_Parse("<aaa>bbb</aaa>")
> > print(2, xml )
> 
> > xml = xml_GetSubElement(xml, "aaa")
> > print(2, xml)
> 
> 
> > but the output is:
> 
> > {{1,{"aaa",{},{{3,"bbb"}}}}}
> > C:\EUPHORIA\include\xml.e:321 in function xml_GetSubElement()
> > subscript value 2 is out of bounds, reading from a sequence of length 1
> > ... called from xmlcoba.ex:9
> -->> see ex.err
> 
> 
> > Press Enter...
> 
> 
> > Am I right in using xml_GetSubElement?
> 
> > Thanks!
> 
> The reason for this is that xml_Parse returns a sequence where each
> element represents an xml document (A xml document always has a single
> root element). So this would work:
> 
> --include print.e
> include xml.e
> 
> object xml
> xml = xml_Parse("<root><aaa>bbb</aaa></root>")
> print(2, xml )
> if length(xml) < 1 or xml[1][XML_pTYPE] != XML_tELEMENT then
>     puts(2,"Unable to parse XML fragment\n")
>     abort(1)
> end if
> xml = xml[1]
> 
> xml = xml_GetSubElement(xml, "aaa")
> print(2, xml)
> 
> XML.E is not a very good library at all, it's slow, hard to work with
> and non-conformant, this is mainly because I didn't really have any
> idea of how to work with XML when I wrote it :)
> I've written a completely different XML parser which I'm now using in
> my Jabber client, it's available in the Marvin source package at
> http://marvin-jabber.sourceforge.net/ (it's in the eebax directory).
> If anyone is interested I'll write some docs and examples and release
> it separately...

There is getxml() in strtok too, altho i set up the xml in the database about 
1990, before there was a standard. It has various options, like get the 3rd 
<tag>, etc, docs not included. YMMV, batteries not included.

Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu