@Test public void testResolveXpath_EmptyResults_Allowed() throws Exception { ConfiguredXpathQuery query = init(create(), " query.setAllowEmptyResults(Boolean.TRUE); Document doc = XmlHelper.createDocument(XML); AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage(XML); MetadataElement result = query.resolveXpath(doc, new XPath(), query.createXpathQuery(msg)); assertEquals("", 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);  }