I discovered a new way to parse RTF in java/groovy programs.
Consider the following sequence:
1. Instantiate XmlSlurper
2. Instantiate RTFParser (of Apache Tika)
3. Parse RTF (either file or string), passing XmlSlurper to RTFParser (such passing is possible, since RTFParser expects ContentHandler interface, which is implemented by XmlSlurper).
4. Traverse RTF content groovy-style: each, find, findAll, etc.
Example of code here:
https://gist.github.com/akhikhl/5993538
Consider the following sequence:
1. Instantiate XmlSlurper
2. Instantiate RTFParser (of Apache Tika)
3. Parse RTF (either file or string), passing XmlSlurper to RTFParser (such passing is possible, since RTFParser expects ContentHandler interface, which is implemented by XmlSlurper).
4. Traverse RTF content groovy-style: each, find, findAll, etc.
Example of code here:
https://gist.github.com/akhikhl/5993538
Комментариев нет:
Отправить комментарий