Menu

XPath Expression Search

Paul
2023-12-27
2023-12-27
  • Paul

    Paul - 2023-12-27

    If I use an XPath expression but don't select the field to search it doesn't work. See example below.
    As the expression defines the node, why is the "search in" required at all?

    Find entries without tags
    XPath: //Tags[(string-length(.) = 0)]

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2023-12-27

    Sometimes it is easier to select the 'Search in' fields instead of writing them into the XPath expression. For example, if you want to search some word in all standard string fields except the password field (i.e. title, user name, URL and notes), you can simply activate/deactivate the corresponding checkboxes; typing a corresponding XPath expression (with a list of field names) would be more complicated.

    Best regards,
    Dominik

     
  • Paul

    Paul - 2023-12-27

    How would I write that expression so it works without having to specify the node, but having the Tags field selected in search?

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2023-12-27

    For example, in the XPath expression //Entry/*[contains(., 'Michael')]/.., the Tags node is not specified explicitly; the tags are searched if and only if the 'Tags' checkbox is activated.

    Best regards,
    Dominik

     
  • Paul

    Paul - 2023-12-27

    It's counter-intuitive (to me) that an XPath statement is limited to sections of the XML.
    It makes sense for text and regex searches.

    cheers, Paul

     

Log in to post a comment.

MongoDB Logo MongoDB