简体   繁体   中英

Convert RTF into XML using Java

I have a rich text document(.rtf or .doc) that has lot of data elements which needs to be read and converted into structured data objects either XML or Json. These docs have certain formats in terms of data. Are there any libraries that i can use to convert using java. DO anyone have come across this type of scenario?

Has anyone tried Apache POI or Apache Tika to convert into XML

I'd break this task into two parsers and two serializers

  1. Parse rtf to java model
  2. Parse doc to java model
  3. Serialize java model to xml
  4. Serialize java model to json

For 1&2 its pretty standard to use POI . For 3&4 you have many more options, a popular option would be Jackson

我建议查看RTF Parser Kit ,您可以使用它来填充适合进一步处理或持久性的 Java 数据结构。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM