Migrating from JDOM to Java DOM
antoniosanct opened this issue · 7 comments
Hi, @PatrickGotthard !
Is it possible to replace JDOM2 with standard JDK DOM Implementation? Would it be a nice opportunity if I tell you that I've finished this task? Please, create a separate branch from master and (if you want) discuss with everybody some aspects like invalid tests (because of are not neccesary anymore) or the child navigation replaced from JDOM2 to JDK.
FYI, I've finished all the modules, including SonarQube bugs/vulnerabilities
Regards,
Antonio.
Originally posted by @antoniosanct in #455 (comment)
Hi @antoniosanct,
personally I would love to replace JDOM but we would possibly break all 3rd party extensions.
Is it possible to re-use existing extensions when you drop in the JDOM dependency yourself? How much effort is it to migrate to pure Java DOM?
In addition I think that there are some Android projects that use Rome. Afaik Java DOM is not available for Android, or is it?
And last but not least there are some "foreign attributes" exposed as JDOM objects.
I really don't know whether this is a good idea, this would be a really massive API change.
The best option would be to clean up all APIs and to add support for multiple implementations but that would be a really time consuming task - I'm currently the only "active" maintainer and already don't have enough time for this project.
Regards,
Patrick
Hi, @PatrickGotthard!
I've a separate branch in my own fork repo, replacing every JDOM reference at each active module. Note that some test cases failed in parsing/generation/parsing process (although they are all OK!) that I'm reviewing during this week.
Each new JDOM object has been replaced by Java DOM alternative, including prefixes and namespaces (around 3k compiler error between 5 maven projects). However, I have my doubts about some extensions that I didn't understand.
I don't know if Java DOM is available in Android, any one could I help us?
For foreign attribute, I've create a WireFeedForeignMarkup class that replace that approach. More over, I've created a ChildNavigator class to replace JDOM2 DOM navigation.
I agree with you that this massive API change is dangerous, but an opportunity step to take now.
I look forward to your comments.
Regards,
Antonio.
I don't know if Java DOM is available in Android, any one could I help us?
@antoniosanct I believe the JDK's DOM API exists in Android, for two reasons.
- There is documentation for the org.w3c.dom namespace
- According to this Android Developers blogpost, "Android 13 Core Libraries now align with the OpenJDK 11 LTS release." The W3C SAX and DOM APIs were introduced in JDK 1.4 and still exist in the latest OpenJDK.
I agree with you that this massive API change is dangerous, but an opportunity step to take now.
I agree with this. Maybe we can make this breaking change for ROME 2? Start with a new module system built on top of the Java DOM API rather than JDOM2. I think this option is good because JDOM2 has transitive dependencies on projects like Apache Xalan, which is being retired and recently got a very alarming CVE.
I'm currently the only "active" maintainer and already don't have enough time for this project.
@PatrickGotthard I am interested in helping maintain his project. What is the best way to get started?
Thanks @rome-user very so much for your efforts in answering the questions raised. It is very useful for me to continue learning about it.
Sadly, I have no recent news about the current status of the project. I have the work held in a branch in my forked repo, in case it was raised as an alpha version on such a relevant change for the project.
I hope the situation can change soon, because there are always other initiatives to contribute.
Regards,
Antonio.
Hi @antoniosanct,
to revive the project I would not switch to Java DOM yet. I plan to release version 2.0.0 soon, maybe we could switch to Java DOM in version 3.0.0.
Regards,
Patrick
Regarding #629 it would be interesting if we could use SAX or StAX. Unfortunately I don't have any experience with this frameworks and I also don't know whether it is compatible with Android.
We could also add a fascade that supports multiple implementations. As a bonus we would be able to swap/add implementation at any time without breaking 3rd party extensions.
Hi, @PatrickGotthard:
SAX or StAX are incompatible with ROME actual version. ROME design loads entire document at WireFeedInput process. SAX is designed by events, then all rome-core/com.rometools.rome.feed.io.impl would have to be redesigned. If ROME changes to JDK DOM implementation, then it would have to increase minimum Android version to maintain backward-compatibility.
Regards,
Antonio.