From 85ecf2d319600d7354283f75ec48eea91fca43a6 Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Thu, 27 Oct 2005 11:36:21 +0000 Subject: [PATCH] added namespace check --- src/router_flexml.hpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/router_flexml.hpp b/src/router_flexml.hpp index d02c3e1..f3d4e6f 100644 --- a/src/router_flexml.hpp +++ b/src/router_flexml.hpp @@ -1,4 +1,4 @@ -/* $Id: router_flexml.hpp,v 1.2 2005-10-26 21:30:54 marc Exp $ +/* $Id: router_flexml.hpp,v 1.3 2005-10-27 11:36:21 marc Exp $ Copyright (c) 2005, Index Data. %LICENSE% @@ -83,13 +83,22 @@ namespace yp2 } - void parse_xml_config_dom() { + void parse_xml_config_dom() { + //xmlNs *yp2_ns = xmlNewNs(pptr, BAD_CAST + // "http://indexdata.dk/yp2/config/1", 0); + + + if (m_xmlconf_doc) { const xmlNode* root = xmlDocGetRootElement(m_xmlconf_doc); - if (std::string((const char *) root->name) != "yp2") - xml_dom_error(root, "expected , got "); + if ((std::string((const char *) root->name) != "yp2") + || (std::string((const char *)(root->ns->href)) + != "http://indexdata.dk/yp2/config/1") + ) + xml_dom_error(root, + "expected , got "); for (const struct _xmlAttr *attr = root->properties; attr; attr = attr->next) @@ -134,13 +143,13 @@ namespace yp2 != "filter") xml_dom_error(root, "expected , got "); - //while(node2 && std::string((const char *)node2->name) == "filter"){ + while(node2 && std::string((const char *)node2->name) == "filter"){ std::cout << "processing /yp2/filters/filter" << std::endl; - //for (; node2 && node2->type != XML_ELEMENT_NODE; node2 = node2->next) - // ; - //if(node2->type != XML_ELEMENT_NODE) - // break; - //} + for (; node2 && node2->type != XML_ELEMENT_NODE; node2 = node2->next) + std::cout << (const char *) root->name << std::endl; + if(node2->type != XML_ELEMENT_NODE) + break; + } // process node which is expected third element node node = node->next; -- 1.7.10.4