Re: [xml] libxml2 review in windows::developer



Hi Daniel,

I wanted only to report this as a good news/bad news factoid:

good news: libmxml is considered mainstream, even on Win32
bad news: rather weak comparative benchmark doesn't give real information.

  Not much to me because I don't know what they benchmarked.

Reading the file into a tree, walking the tree, thawing objects:
 
void read_file(char const *input_name, FILE *output)
{
  using xmlpp::DomParser;
  using xmlpp::Node;
  using xmlpp::Attribute;

  DomParser       parser(input_name);
  Node            *root     = parser.get_root_node();
  Node::NodeList  children  = root->children("entry");

  Node::NodeList::const_iterator  begin = children.begin();
  Node::NodeList::const_iterator  end   = children.end();

  for(int i = 0; begin != end; ++begin, ++i)
  {
    Node const      *node   = *begin;
    Attribute const *year   = node->attribute("year");
    Attribute const *month  = node->attribute("month");
    Attribute const *day    = node->attribute("day");
    Attribute const *who    = node->attribute("who");
    Entry           entry(year->value(),
                          month->value(),
                          day->value(),
                          who->value());

    process_data(output, i, entry);
  }
}

Regards,
Peter Jacobi




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]