Skip to content

XML+XPath #5075

@Alkarex

Description

@Alkarex

A simplified XML case: https://gist.githubusercontent.com/mgnsk/39ffd7f8e0a24038373a53f76c317d93/raw/0c772312121ce089bc4c14082ae54e8882298d74/freshrss_test.xml

  • //array/object item and ./string[@name="title"] title gives only a single entry with the title Meta title
  • /array/object item and ./string[@name="title"] title gives an empty feed

Now the same XML but the inner array has a name attribute which is similar to the actual XML I dealt with: https://gist.githubusercontent.com/mgnsk/0aab124cfd3516cb8ccddb8d39d5c5a7/raw/e9fe30a5cdedcc736027353e08b4be994f91beb2/freshrss_test.xml

  • //array/object item and ./string[@name="title"] title gives me 4 entries
  • /array/object item and ./string[@name="title"] title gives empty feed

I was finally able to solve it with

  • //array[count(@*)=0]/object item and ./string[@name="title"] title gives correct 2 entries Item 1 and Item 2
    but still wondering why just /array/object couldn't work.

Originally posted by @mgnsk in #5071 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions