[erlang-patches] xmerl_xpath does not handle "/"

Matthew Dempsky matthew@REDACTED
Fri Aug 15 22:53:19 CEST 2008


The xpath parser has special support for handling the expression "/",
but the xpath interpreter doesn't handle the resulting parse tree.
"/" against "<a/>" should return the entire xmlDocument.

(I feel this patch is slightly hackish, but it's the least intrusive
way to handle this, and this is the only way the path expression can
be '/'.)

--- xmerl_xpath.erl.patched     2008-08-15 13:43:40.000000000 -0500
+++ xmerl_xpath.erl     2008-08-15 15:22:55.000000000 -0500
@@ -236,7 +236,9 @@
                                                         acc = Acc}) ->
     ?dbg("PredExpr = ~p~n", [PredExpr]),
     NewContext = axis(Axis, NodeTest, C, Acc),
-    pred_expr(PredExpr, S#state{context = NewContext}).
+    pred_expr(PredExpr, S#state{context = NewContext});
+path_expr('/', S) ->
+    S.



More information about the erlang-patches mailing list