Closed GoogleCodeExporter closed 9 years ago
By default, the new XmlReader stops when encountering the end of an XML
element. As a workaround, this behaviour can be modified by setting the
appropriate reading flag :
XmlR.ReadFlags[XmlReaderNodeType.EndElement] = False
This seems to fix the problem. But to my knowledge, the old XmlReader stopped
on the end of an XML element too, so the default reading flag setting is good,
and there should be no need to change it.
I will investigate ...
Original comment by adrien.p...@gmail.com
on 8 Nov 2012 at 11:58
Problem fixed in revision #5323, thanks.
Original comment by adrien.p...@gmail.com
on 13 Nov 2012 at 9:32
@Adrien:
Problem has ONLY CHANGED ... The output is still not the same as gambas2.
Original comment by uAle...@gmail.com
on 13 Nov 2012 at 6:28
I think I found the problem, but it comes from your code.
Here is the strange section :
If CStr(XmlR.Node.value) = "" Then
StrHeader[XmlR.Node.depth] = XmlR.Node.name
End If
If I understood well the other parts of your code, you want to add the node
name to your array when the reader reads the beginning of an element. But the
node value is not empty only when reading the beginning of an element (that
worked "by chance" with Gambas 2), so it will change the array values, and the
output is finally not correct.
One good and safe way to detect the beginning of an element is to check the
value of the XmlReader.State property :
If XmlR.State = XmlReaderNodeType.Element Then
StrHeader[XmlR.Node.depth] = XmlR.Node.name
End If
With this code, the output is finally correct (I checked it well this time ;) ).
Regards,
Adrien
Original comment by adrien.p...@gmail.com
on 22 Nov 2012 at 4:13
Thanks Adrien it works perfectly now (it also fixed the "bug" in my gambas2
code - some unwanted xml output).
Original comment by uAle...@gmail.com
on 25 Nov 2012 at 4:09
Original issue reported on code.google.com by
uAle...@gmail.com
on 7 Nov 2012 at 7:25Attachments: