diff --git a/examples/XPath/xgrep.cpp b/examples/XPath/xgrep.cpp index a1f2413b..4903df3a 100644 --- a/examples/XPath/xgrep.cpp +++ b/examples/XPath/xgrep.cpp @@ -55,19 +55,23 @@ int main(int argc, char* argv[]) // doc.normalize(); Arabica::XPath::XPathValuePtr result; result = xpath->evaluate(doc); - if(result->asBool()) + + std::cout << file << std::endl; + switch(result->type()) { - std::cout << file << std::endl; - if(result->type() == Arabica::XPath::NODE_SET) - { - const Arabica::XPath::NodeSet& ns = result->asNodeSet(); - for(unsigned int i = 0; i < ns.size(); ++i) + case Arabica::XPath::NODE_SET: { - Arabica::DOM::Node n = ns[i]; - std::cout << n << std::endl; - } - } // if .. - } // if ... + const Arabica::XPath::NodeSet& ns = result->asNodeSet(); + for(unsigned int i = 0; i < ns.size(); ++i) + { + Arabica::DOM::Node n = ns[i]; + std::cout << n << std::endl; + } + } + break; + default: + std::cout << result->asString() << std::endl; + } // switch } else {