Ignore the stupid http://www.w3.org/1999/xhtml namespace some html have

I think this also fixes a memory leak with the xpath wide string.
This commit is contained in:
King_DuckZ 2020-03-31 20:11:03 +02:00
parent 6e35c880a4
commit bdb858de5a

View file

@ -59,11 +59,14 @@ namespace duck {
BatchResults retval;
try {
AutoDelete<DynamicContext> context(xqilla.createContext(XQilla::XQUERY_UPDATE, &xconfig));
//see http://xqilla.sourceforge.net/docs/simple-api/classStaticContext.html#adc869a84712459fa49db67fe837c9b01
context->setDefaultElementAndTypeNS(u"http://www.w3.org/1999/xhtml");
Node::Ptr ptr = context->parseDocument(input_buf);
context->setContextItem(ptr);
for (const auto& xpath : parQueries) {
AutoDelete<XQQuery> query(xqilla.parse(X(xpath.c_str())));
AutoDeleteArray<XMLCh> xpath_wide = xercesc::XMLString::transcode(xpath.c_str());
AutoDelete<XQQuery> query(xqilla.parse(xpath_wide, context, nullptr, XQilla::NO_ADOPT_CONTEXT));
context->setContextPosition(1);
context->setContextSize(1);