NEX_Developer
asked on
Which XML parser should I used for my requirement
I have a requirement
1) To decrypt the PGP encrypted XML file in memory,
2) and search for all the occurrences of 'card_number' element
3) encrypt them using other encryption API and replace the clear text value of 'card_number' element value
4) There after encrypt the whole XML file
5) and finally store that xml file on disk
During each execution of my Java program, I may have about 1 to 4 XML files to be processed for above requirement. Each file can have about 600 to 1000 'card_number' elements. Each decrypted file (if stored on disk can be 100 to 200 KB). But I will not have to let store on disk, keep in memory and process.
I have been looking into couple options:
1) JDOM parser
2) DOM4J
3) or don't use any external jars/libraries but use core JDK API like
https://docs.oracle.com/javase/8/docs/api/index.html?javax/xml/parsers/DocumentBuilder.html
I have been reading different options at http://www.tutorialspoint.com/java_xml/java_dom4j_parser.htm, and not able to decide which parser is suitable for my requirement.
1) To decrypt the PGP encrypted XML file in memory,
2) and search for all the occurrences of 'card_number' element
3) encrypt them using other encryption API and replace the clear text value of 'card_number' element value
4) There after encrypt the whole XML file
5) and finally store that xml file on disk
During each execution of my Java program, I may have about 1 to 4 XML files to be processed for above requirement. Each file can have about 600 to 1000 'card_number' elements. Each decrypted file (if stored on disk can be 100 to 200 KB). But I will not have to let store on disk, keep in memory and process.
I have been looking into couple options:
1) JDOM parser
2) DOM4J
3) or don't use any external jars/libraries but use core JDK API like
https://docs.oracle.com/javase/8/docs/api/index.html?javax/xml/parsers/DocumentBuilder.html
I have been reading different options at http://www.tutorialspoint.com/java_xml/java_dom4j_parser.htm, and not able to decide which parser is suitable for my requirement.
Either of 1,2,3 would work.
ASKER
I know either of them work, the reason I explained in great detail what my requirement is to select the best suitable out of 3.
So I am looking for that answer.
So I am looking for that answer.
U want 'the best'?
Why don't you go on the wiki page for each of those projects and see some examples of how to use each one and judge it from there?
Why don't you go on the wiki page for each of those projects and see some examples of how to use each one and judge it from there?
Security best practice would actually dictate that the most sensitive tokens be hashed (one-way encryption), where possible, such that nobody could know their plaintext values.
ASKER
CEHJ,
Can you please reply in context of XML parser? I am good with my all encryption/decryption process. My focus is to select the best suitable XML parser for my need.
Thanks
Can you please reply in context of XML parser? I am good with my all encryption/decryption process. My focus is to select the best suitable XML parser for my need.
Thanks
XMLReader in the JDK would be fine
ASKER
Thanks for suggesting XMLReader. I am having hard time to search for any simple example of XMLReader usage to edit the xml element. Any good example showing, step by step how to manipulate the xml file using this API would be appreciated.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
how about doing what a software developer would do, try some quick examples with the three technologies mentioned. Pick one you prefer working with.
ASKER
I used DOM Parser API (inbuilt in JDK) and it worked great. Thanks a lot.
:)