Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extension to use full path expression to a node in XML #106

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

w3stling
Copy link
Owner

@w3stling w3stling commented Aug 10, 2023

For Atom feed name element can exist inside both author element and contributor element. Allow to use full path expression/feed/entry/author/name and /feed/entry/contributor/name in extension to distinguish the two apart.

Atom feed example:

<feed>
...
    <entry>
        <title>An entry from my feed</title>
        <summary>DEFAULT --- This is the default summary</summary>
        <link rel="self" href="/web20/sample_atom_feed/entry" /> 
        <author>
              <name>Joe Bloggs</name>
              <uri>http://www.hursley.ibm.com/JBloggs/</uri>
              <email>[email protected]</email>
        </author>
        <contributor>
              <name>John Doe</name>
        </contributor>
        <category term="Comments" />
        <published>2023-08-10T15:41:00</published>
     </entry>
...
</feed>

Custom extension that maps value Joe Bloggs to field Comments in Item object using full path expression:

List<Item> items = new RssReader().addItemExtension("/feed/entry/author/name", Item::setComments)
                                  .read(URL)
                                  .collect(Collectors.toList());

@w3stling w3stling added the enhancement New feature or request label Aug 10, 2023
@w3stling w3stling merged commit 8b1aa08 into master Aug 10, 2023
4 checks passed
@w3stling w3stling deleted the full-path-xml branch August 10, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant