@Test public void testResolveXpath_NamespaceWithNamespaceContext() throws Exception { ConfiguredXpathQuery query = init(create(), "count(/svrl:schematron-output/svrl:failed-assert)"); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML_WITH_NAMESPACE); StaticNamespaceContext ctx = new StaticNamespaceContext(); Document doc = XmlHelper.createDocument(XML_WITH_NAMESPACE, ctx); MetadataElement result = query.resolveXpath(doc, new XPath(ctx), query.createXpathQuery(msg)); assertEquals("2", result.getValue()); }
@Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); }
ConfiguredXpathQuery extends ConfiguredXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } }
ConfiguredXpathQuery extends ConfiguredXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } ConfiguredXpathQuery();  ConfiguredXpathQuery(String metadataKey, String xpath); }
ConfiguredXpathQuery extends ConfiguredXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } ConfiguredXpathQuery();  ConfiguredXpathQuery(String metadataKey, String xpath); @Override MetadataElement resolveXpath(Document doc, XPath xpath, String expr); }
ConfiguredXpathQuery extends ConfiguredXpathQueryImpl implements XpathQuery { @Override public MetadataElement resolveXpath(Document doc, XPath xpath, String expr) throws Exception { return new MetadataElement(getMetadataKey(), XpathQueryHelper.resolveSingleTextItem(doc, xpath, expr, allowEmptyResults())); } ConfiguredXpathQuery();  ConfiguredXpathQuery(String metadataKey, String xpath); @Override MetadataElement resolveXpath(Document doc, XPath xpath, String expr);  }