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

An Annotation-Based Way to Convert From Element / Elements to Java objects (Jackson/GSON style). #2004

Closed
wants to merge 6 commits into from

Conversation

sam-hieken
Copy link

@sam-hieken sam-hieken commented Sep 25, 2023

Hello,

I've noticed there's no built in way to turn XML / HTML into plain Java objects, and decided to build out a solution for my personal use. It's been a massive productivity boost (especially when dealing with XML), so I figured it couldn't hurt to see if anyone was interested in getting it merged as an experimental feature.

Please keep in mind a few things:

  • I started working on this yesterday; while I have done quite a lot of testing, I wouldn't be surprised if there are some issues in terms of error handling and performance.
  • Conversion is currently only forward: I currently haven't added a way to convert back from a properly annotated object to an Element / Elements (nor do I plan to at the moment)
  • The only supported collection types currently are List and Set for simplicity, though I'd be open to adding support for most (if not all)
  • Documentation is sparse; due to how recently I created this (and the fact I created it for personal use), documentation is not my priority (more than happy to build it out though if this gets merged)
  • My testing has mainly been parsing XML: it's possible some issues will arise using HTML (though I can't think of any HTML specific issues, as the converter should work with all SGML).

Thank you

@sam-hieken sam-hieken changed the title Add an Annotation-Based Way to Convert From Elements to Java objects. An Annotation-Based Way to Convert From Elements to Java objects. Sep 25, 2023
Java <11 compatibility
@sam-hieken sam-hieken changed the title An Annotation-Based Way to Convert From Elements to Java objects. An Annotation-Based Way to Convert From Element / Elements to Java objects. Sep 25, 2023
@sam-hieken sam-hieken changed the title An Annotation-Based Way to Convert From Element / Elements to Java objects. An Annotation-Based Way to Convert From Element / Elements to Java objects (Jackson/GSON style). Sep 25, 2023
@jhy
Copy link
Owner

jhy commented Oct 18, 2023

Hi there -- this looks quite interesting, but I don't feel it's a good fit directly in jsoup. I think it would be better as a separate specific project, leveraging jsoup for the parsing. On first review I believe no modifications to jsoup are required; please ping me if otherwise.

Cheers,
Jonathan

@jhy jhy closed this Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants