google-code-export / gambas

Automatically exported from code.google.com/p/gambas
1 stars 0 forks source link

XmlReader doesn't parse the XML correctly when using depths and some empty values are contain garbage #305

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1) Describe the problem.

The new gb.xml component output is different then the "old" gambas2 version. 
The XmlReader doesn't support node depth and empty values contain garbage. The 
new component doesn't seem to support the complete XML spec?

2) GIVE THE FOLLOWING INFORMATIONS (if they are appropriate):

Version: TRUNK and 3.2.1
Revision: r5025, r5026, r5027
Operating system: Linux
Distribution: Lubuntu
Architecture: x86
GUI component: n/a
Desktop used: LXDE

3) Provide a little project that reproduces the bug or the crash.

The XMLParser example contains a XML response received from the weatherbug 
website. The gambas2 project produces the following output (the first 2 parts 
are the node depth names!):
aws:weatherxmlns:aws|=|http://www.aws.com/aws
aws:weatheraws:apiversion|=|2.0
aws:weatheraws:locationsaws:locationcityname|=|Zwijndrecht
aws:weatheraws:locationsaws:locationstatename|=|
aws:weatheraws:locationsaws:locationcountryname|=|Netherlands
aws:weatheraws:locationsaws:locationzipcode|=|
aws:weatheraws:locationsaws:locationcitycode|=|71394
aws:weatheraws:locationsaws:locationcitytype|=|1
aws:weatheraws:locationsaws:locationcityname|=|Zwijndrecht
aws:weatheraws:locationsaws:locationstatename|=|
aws:weatheraws:locationsaws:locationcountryname|=|Belgium
aws:weatheraws:locationsaws:locationzipcode|=|
aws:weatheraws:locationsaws:locationcitycode|=|50991
aws:weatheraws:locationsaws:locationcitytype|=|1
aws:weatheraws:locationsaws:locationcityname|=|Zakynthos
aws:weatheraws:locationsaws:locationstatename|=|
aws:weatheraws:locationsaws:locationcountryname|=|Greece
aws:weatheraws:locationsaws:locationzipcode|=|
aws:weatheraws:locationsaws:locationcitycode|=|63454
aws:weatheraws:locationsaws:locationcitytype|=|1

When i run this on gambas3 i loose all the node depths:
xmlns:aws|=|http://www.aws.com/aws
version|=|2.0
cityname|=|Zwijndrecht
statename|=|
countryname|=|Netherlands
zipcode|=|
citycode|=|71394
citytype|=|1
cityname|=|Zwijndrecht
statename|=|
countryname|=|Belgium
zipcode|=|
citycode|=|50991
citytype|=|1
cityname|=|Zakynthos
statename|=|
countryname|=|Greece
zipcode|=|
citycode|=|63454
citytype|=|1

Also the fields like "zipcode" doesn't contain any value in the XML, this gives 
garbage in the output (not visible in the copy-paste above, but clearly visible 
in the debugger - i done this with gambas2 and gambas3)

4) If your project needs a database, try to provide it, or part of it.

5) Explain clearly how to reproduce the bug or the crash.

6) By doing that carefully, you have done 50% of the bug fix job!

IMPORTANT NOTE: if you encounter several different problems or bugs, (for
example, a bug in your project, and an interpreter crash while debugging
it), please create distinct issues!

Original issue reported on code.google.com by uAle...@gmail.com on 11 Aug 2012 at 7:05

Attachments:

GoogleCodeExporter commented 9 years ago
OK, i retested with gambas3 r5032 and the output slightly changed and it is 
visible that the XMLReader component doesn't fully function. The output is now 
(the warning message and some fields contain garbage!):

xmlns:aws|=|http://www.aws.com/aws
version|=|2.0
cityname|=|Zwijndrecht
gbx3: warning: please use GB.ReturnNewZeroString() instead of 
GB.ReturnNewString()
gbx3: warning: please use GB.ReturnNewZeroString() instead of 
GB.ReturnNewString()
statename|=|?"  
countryname|=|Netherlands
zipcode|=|
citycode|=|71394
citytype|=|1
cityname|=|Zwijndrecht
statename|=|
countryname|=|Belgium
zipcode|=|
citycode|=|50991
citytype|=|1
cityname|=|Zakynthos
gbx3: warning: please use GB.ReturnNewZeroString() instead of 
GB.ReturnNewString()
gbx3: warning: please use GB.ReturnNewZeroString() instead of 
GB.ReturnNewString()
statename|=|? " odename
countryname|=|Greece
gbx3: warning: please use GB.ReturnNewZeroString() instead of 
GB.ReturnNewString()
gbx3: warning: please use GB.ReturnNewZeroString() instead of 
GB.ReturnNewString()
zipcode|=|@?!   ename
citycode|=|63454
citytype|=|1
Ended

Original comment by uAle...@gmail.com on 12 Aug 2012 at 6:39

GoogleCodeExporter commented 9 years ago
Does it work better with the last revision ? (#5034)

Original comment by adrien.p...@gmail.com on 12 Aug 2012 at 12:40

GoogleCodeExporter commented 9 years ago
Hi Adrien,

r5034 doesn't compile on my system (got a fresh copy from SVN), i get the 
following message during "make":

/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   
 -pipe -Wall -fno-exceptions -Wno-unused-value -fsigned-char 
-fvisibility=hidden -g -ggdb -Os -fno-omit-frame-pointer -fexceptions 
-fvisibility=default -std=c++0x -MT gb_xml_la-textnode.lo -MD -MP -MF 
.deps/gb_xml_la-textnode.Tpo -c -o gb_xml_la-textnode.lo `test -f 
'textnode.cpp' || echo './'`textnode.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -pipe -Wall -fno-exceptions 
-Wno-unused-value -fsigned-char -fvisibility=hidden -g -ggdb -Os 
-fno-omit-frame-pointer -fexceptions -fvisibility=default -std=c++0x -MT 
gb_xml_la-textnode.lo -MD -MP -MF .deps/gb_xml_la-textnode.Tpo -c textnode.cpp  
-fPIC -DPIC -o .libs/gb_xml_la-textnode.o
mv -f .deps/gb_xml_la-textnode.Tpo .deps/gb_xml_la-textnode.Plo
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   
 -pipe -Wall -fno-exceptions -Wno-unused-value -fsigned-char 
-fvisibility=hidden -g -ggdb -Os -fno-omit-frame-pointer -fexceptions 
-fvisibility=default -std=c++0x -MT gb_xml_la-element.lo -MD -MP -MF 
.deps/gb_xml_la-element.Tpo -c -o gb_xml_la-element.lo `test -f 'element.cpp' 
|| echo './'`element.cpp
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -pipe -Wall -fno-exceptions 
-Wno-unused-value -fsigned-char -fvisibility=hidden -g -ggdb -Os 
-fno-omit-frame-pointer -fexceptions -fvisibility=default -std=c++0x -MT 
gb_xml_la-element.lo -MD -MP -MF .deps/gb_xml_la-element.Tpo -c element.cpp  
-fPIC -DPIC -o .libs/gb_xml_la-element.o
element.cpp: In constructor ‘Element::Element(const char*, size_t)’:
element.cpp:47: error: type ‘Element’ is not a direct base of ‘Element’
make[5]: *** [gb_xml_la-element.lo] Error 1
make[5]: Leaving directory `/usr/src/gambas3-r5034/gb.xml/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/usr/src/gambas3-r5034/gb.xml/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/usr/src/gambas3-r5034/gb.xml'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/usr/src/gambas3-r5034/gb.xml'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/gambas3-r5034'
make: *** [all] Error 2

Original comment by uAle...@gmail.com on 12 Aug 2012 at 1:01

GoogleCodeExporter commented 9 years ago
There is no error on my system. Does it work with revision #5035 ?

Original comment by adrien.p...@gmail.com on 12 Aug 2012 at 3:27

GoogleCodeExporter commented 9 years ago
Hi Adrien,

Thanks, it compiles successfully on my system now. Also the output looks great, 
again thanks for fixing this all.

Regards,
Alex

Original comment by uAle...@gmail.com on 12 Aug 2012 at 7:50

GoogleCodeExporter commented 9 years ago
Is the issue fixed?

Original comment by benoit.m...@gmail.com on 14 Aug 2012 at 9:00

GoogleCodeExporter commented 9 years ago
Yes, r5036 gives the correct output. The issue can be closed.

Original comment by uAle...@gmail.com on 14 Aug 2012 at 9:03

GoogleCodeExporter commented 9 years ago

Original comment by adrien.p...@gmail.com on 14 Aug 2012 at 9:27