Archived

This forum has been archived. Please start a new discussion on GitHub.

confused with IceXML

I'm working on a xml2freezedb module,which read xml data from a xml file,and write them into freeze evictor or map db.
for example,if the slice:
module Demo
{
   struct hello
   {
      int a;
      float b;
      string c;
   };

};

if the freeze map 's key is int, the value is ::Demo::hello then the xml file will like this:
<database>
<record>
     <key>1</key>
     <value>
          <a>1</a>
          <b>3.14</b>
          <c>xml2db</c>
     </value>
</record>
</database>
and I write a xmltest.cpp to test the parser's output:
#include <IceXML/Parser.h>
#include <iostream>
using namespace std;
using namespace IceXML;

void dumpXML(NodePtr node)
{
    cout << "<" << node->getName() << ">" << endl;
    NodeList nodes = node->getChildren();
    if( nodes.empty() )
    {
        cout << node->getValue() << endl;
    }
    else
    {
       for(int i = 0;i < nodes.size() ;i++)
       {
          dumpXML(nodes[i]);
       }
    }
    cout << "</" << node->getName() << ">" << endl;
}
int main(int argc,char** argv)
{
    DocumentPtr xml = IceXML::Parser::parse(argv[1]);
    dumpXML(xml);
   return 0;
}
But the output has many empty xml elements:
<>
<database>
<>


</>
<record>
<>

</>
<>


</>
<>

</>
<key>
<>
1
</>
</key>
<>

</>
<>


</>
<>

</>
<value>
<>

</>
<>


</>
<>

</>
<a>
<>
1
</>
</a>
<>

</>
<>


</>
<>

</>
<b>
<>
3.14
</>
</b>
<>

</>
<>


</>
<>

</>
<c>
<>
xml2db
</>
</c>
<>

</>
<>


</>
<>

</>
</value>
<>

</>
<>


</>
</record>
<>


</>
</database>
</>
If this is not a IceXML::DocumentBuilder's bug,then what's the IceXML real meaning?

Comments

  • marc
    marc Florida
    IceXML is only used internally by other Ice libraries and tools. It is not part of the official Ice API, and therefore also not documented in our Ice manual. I'm afraid providing assistance with undocumented internal libraries is out of the free support we can provide here in these forums.
  • marc wrote:
    IceXML is only used internally by other Ice libraries and tools. It is not part of the official Ice API, and therefore also not documented in our Ice manual. I'm afraid providing assistance with undocumented internal libraries is out of the free support we can provide here in these forums.
    That's ok,:p . I just feel something strange with IceXML's behaviour.