#Best library to read a XML file and get value from an element?

1 messages · Page 1 of 1 (latest)

unique nest
#

Basically, I want to read a XML file and get a value from an element, but I'm wondering what the best tools are to do this. Jackson? JDOM? Which is the most appropriate?

errant masonBOT
#

<@&987246452180930620> please have a look, thanks.

errant masonBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

unique nest
#

Options seem to be between JDOM and Jackson, which one would be the best here?

supple plover
#

jackson works well. but u will feel that its a json lib with xml support added on top

#

and not a dedicated xml lib

high locust
#

JOOX

#

its "jquery for xml"

#

which means if you aren't trying to bind the entire document it should be more than sufficient

#
        var doc = $("""
                <elements>
                    <element id="abc"> Apple </element>
                    <element> Orange </element>
                </elements>
                """);

        System.out.println(
                doc.find("#abc").text()
        );
#
 Apple 
#

basic example

unique nest
#

JOOX seems incredibly simple. I'll give it a try.

#

Right now I'm working with JDOM though, I'm wondering if this still is a good tool? I haven't worked with XML before so I don't want to put off my employer by using something weird, so I'm curious if JDOM is still a "valid" or widely used library

high locust
#

No clue

#

i have not used JDOM

#

generally things that just parse data never really become obsolete

#

personally i like JOOX because its a module

#

and you can use jlink, etc

#

but i know most dont care about that

#

I think probably all of the options are valid

unique nest
#

Using JOOX, thank you, its perfect for me.