diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 20d76cc13438..a204ca0720d8 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -573,6 +573,20 @@ protected: return OUString::createFromAscii((const char*)xmlGetProp(pXmlNode, BAD_CAST(rAttribute.getStr()))); } + /** + * Same as the assertXPathContent(), but don't assert: return the string instead. + */ + OUString getXPathContent(xmlDocPtr pXmlDoc, const OString& rXPath) + { + xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath); + + CPPUNIT_ASSERT_MESSAGE(OString("XPath '" + rXPath + "' not found").getStr(), + xmlXPathNodeSetGetLength(pXmlNodes) > 0); + + xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0]; + return OUString::createFromAscii((const char*)((pXmlNode->children[0]).content)); + } + /** * Assert that rXPath exists, and returns exactly one node. * In case rAttribute is provided, the rXPath's attribute's value must