xml2 icon indicating copy to clipboard operation
xml2 copied to clipboard

passsing variable to conditional xpath expression returns null whereas passing value gives result

Open iamihgam opened this issue 1 year ago • 1 comments

I have a variable say x which can take any integer value.

When I try to pass the value directly (say, x=0) instead of variable as below, I get respective nodes

root_unitgroup %>% xml_find_all("//*[@dataSetInternalID = '0']")

however, if I pass variable as below , I get empty node, or null value if I use xml_find_first instead .

root_unitgroup %>%  xml_find_all("//*[@dataSetInternalID = '$x']")

iamihgam avatar Aug 13 '22 18:08 iamihgam

Can you please provide a minimal reprex (reproducible example)? The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it: please help me help you! If you've never heard of a reprex before, start by reading about the reprex package, including the advice further down the page. Please make sure your reprex is created with the reprex package as it gives nicely formatted output and avoids a number of common pitfalls.

hadley avatar Oct 30 '23 18:10 hadley