There was supposedly an API function called isEmptyElement(),
I didn't notice it, not enough coffee i guess,
but the rootelement generating EXN_ELEMENT_END twice is still a bug!
Code: Select all
<?xml version="1.0"?>
<XML>
</XML>
In this example, with the following code:
Code: Select all
static int begs = 0;
static int ends = 0;
while(xmlreader->read())
{
switch(xmlreader->getNodeType())
{
case io::EXN_ELEMENT:
begs++;
break;
case io::EXN_ELEMENT_END:
ends++;
break;
}
}
You would assume the result would be:
begs == 1
ends == 1
But in reality it's
begs == 1
ends == 2
This is wrong, the rootelement of the XML file will return EXN_ELEMENT_END twice!
The reason is occur is because how data is parsed.
parseCurrentNode() is called from read(), however read will return
true as long as *P != 0, so there will always be one extra call to read
that is excessive.
The following could be added after parseClosingXMLElement() is called from parseCurrentNode(), so that whites are always skipped after a closing tag.
Code: Select all
// more forward until '<' found
while(*P != L'<' && *P)
++P;