xmerl_xpath does not handle "/"

View: New views
1 Messages — Rating Filter:   Alert me  

xmerl_xpath does not handle "/"

by Matthew Dempsky-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.
_______________________________________________
erlang-patches mailing list
erlang-patches@...
http://www.erlang.org/mailman/listinfo/erlang-patches
LightInTheBox - Buy quality products at wholesale price!