I've been using an XML library of my own devices, based around RapidXML for ages, it has been totally brilliant, utterly useful and completely thread & memory safe for about three years.
Yet today, the trusty dog that it is, has turned around and bit my hand, as I've found a bug, and I'm not sure where the bug comes in, whether in my code or from the underlying RapidXML.
My problem, I load a structure:
<Root>
<a>0</a>
<b>1</b>
</Root>
This is fine, however, these turn into my classed "XMLConstruct" and I have three of these:
XMLConstruct
m_Name = "Root"
m_Value = null
m_Children[2]
[0] = XMLConstruct
m_Name = "a"
m_Value = "0"
m_Children = null
[1] = XMLConstruct
m_Name = "b"
m_Value = "1"
m_Children = null
This is fine, it works, I have my data... But every use previously I created a class "Root" from this, and used that classes "ToXML" function.
However, today I want to just open the XML and "for each node if m_name == 'a' set m_value = '999'".
Sounds simple... Nope, when I do this the XML output I get from the underlying Rapid XML is:
<Root>
<a>
<>999</>
</a>
<b>
<>1</>
</b>
</Root>
This is a mystery to me, I'm going to have to bottom it out, but it's that kind of problem on a Monday morning which annoys me.
More annoyingly, the C# implementation of the same library I'm using, does not do this... The difference between the C++ version and the C# version is the underlying XML library, so I'm suspecting something about the node allocation, or the node use inside Rapid XML being off...
No comments:
Post a Comment