Hi Alberto,

Thank you. I added setting "entities" to "true", but the program prints 0 as
before:


#include <iostream>
using namespace std;

#include <xercesc/dom/DOMConfiguration.hpp>
#include <xercesc/dom/DOMNode.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/util/PlatformUtils.hpp>
using namespace xercesc;

namespace {
    bool entity_reference_node_found(DOMNode const* const node)
    {
        if (DOMNode::ENTITY_REFERENCE_NODE == node->getNodeType())
            return true;
        for (DOMNode const* child = node->getFirstChild(); child; child =
child->getNextSibling())
            if (entity_reference_node_found(child))
                return true;
        return false;
    }
}

int main()
{
    XMLPlatformUtils::Initialize();
    {
        XercesDOMParser parser;
        parser.parse("undefined_entity.xml");
        DOMDocument const* const document = parser.getDocument();
        document->getDOMConfig()->setParameter(L"entities", true);
        cout << entity_reference_node_found(document) << '\n';
    }
    XMLPlatformUtils::Terminate();
}


Igor

-- 
View this message in context: 
http://www.nabble.com/Keep-undefined-entity-references-while-parsing-tp23899329p23959377.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.

Reply via email to