You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2011/10/10 23:39:41 UTC
svn commit: r1181252 - in
/tika/trunk/tika-core/src/main/java/org/apache/tika/sax:
BodyContentHandler.java xpath/XPathParser.java
Author: jukka
Date: Mon Oct 10 21:39:41 2011
New Revision: 1181252
URL: http://svn.apache.org/viewvc?rev=1181252&view=rev
Log:
TIKA-750: JavaDoc of Tika XPathParser should mention descendant:node()
Fixed as suggested by David Smiley.
Modified:
tika/trunk/tika-core/src/main/java/org/apache/tika/sax/BodyContentHandler.java
tika/trunk/tika-core/src/main/java/org/apache/tika/sax/xpath/XPathParser.java
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/BodyContentHandler.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/BodyContentHandler.java?rev=1181252&r1=1181251&r2=1181252&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/sax/BodyContentHandler.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/sax/BodyContentHandler.java Mon Oct 10 21:39:41 2011
@@ -42,7 +42,7 @@ public class BodyContentHandler extends
* The XPath matcher used to select the XHTML body contents.
*/
private static final Matcher MATCHER =
- PARSER.parse("/xhtml:html/xhtml:body/descendant:node()");
+ PARSER.parse("/xhtml:html/xhtml:body/descendant::node()");
/**
* Creates a content handler that passes all XHTML body events to the
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/xpath/XPathParser.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/xpath/XPathParser.java?rev=1181252&r1=1181251&r2=1181252&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/sax/xpath/XPathParser.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/sax/xpath/XPathParser.java Mon Oct 10 21:39:41 2011
@@ -23,6 +23,7 @@ import java.util.Map;
* Parser for a very simple XPath subset. Only the following XPath constructs
* (with namespaces) are supported:
* <ul>
+ * <li><code>.../node()</code></li>
* <li><code>.../text()</code></li>
* <li><code>.../@*</code></li>
* <li><code>.../@name</code></li>
@@ -31,6 +32,10 @@ import java.util.Map;
* <li><code>...//*...</code></li>
* <li><code>...//name...</code></li>
* </ul>
+ * <p>
+ * In addition the non-abbreviated <code>.../descendant::node()</code>
+ * construct can be used for cases where the descendant-or-self axis
+ * used by the <code>...//node()</code> construct is not appropriate.
*/
public class XPathParser {
@@ -60,7 +65,8 @@ public class XPathParser {
return TextMatcher.INSTANCE;
} else if (xpath.equals("/node()")) {
return NodeMatcher.INSTANCE;
- } else if (xpath.equals("/descendant:node()")) {
+ } else if (xpath.equals("/descendant::node()")
+ || xpath.equals("/descendant:node()")) { // for compatibility
return new CompositeMatcher(
TextMatcher.INSTANCE,
new ChildMatcher(new SubtreeMatcher(NodeMatcher.INSTANCE)));