问题描述
用一个简单的一个不错的解析器任何想法使用的API,可配置?我期待给它喂食,如<数据href=\"http://wikitravel.org/wiki/en/api.php?format=xml&action=parse&prop=wikitext&page=San%20Francisco\" rel=\"nofollow\">http://wikitravel.org/wiki/en/api.php?format=xml&action=parse&prop=wikitext&page=San%20Francisco,选择数据我想,和输出自定义HTML的部分为每一个独特类型的元素? Java的将是preferred,但如果有一个PHP / JS的解决方案,大多数(99%+)wikitext的兼容,这将是好为好。
Any ideas for a nice parser with an easy to use api that is configurable? I'm looking to feed it data such as http://wikitravel.org/wiki/en/api.php?format=xml&action=parse&prop=wikitext&page=San%20Francisco, choose sections of data I want, and output custom html for each unique type of element? Java would be preferred, but if there's a php/js solution that is compatible with most (99%+) wikitext, that would be okay as well.
推荐答案
是可能wikitext的最好Java解析器。它,提供wikitext的,但我严重怀疑。它分析成wikitext的抽象语法树,随后必须做的东西(如将其转换为HTML)。
Sweble is probably the best Java parser of wikitext. It claims to be 100% compliant with wikitext, but I seriously doubt that. It parses wikitext into an abstract syntax tree that you then have to do something with (like convert it to HTML).
一个页面,列出了各种编程语言解析器wikitext的。我不认为任何人做的wikitext的99 +%,但。一般来说解析wikitext的是一个非常复杂的问题。 wikitext的甚至没有正式MediaWiki的解析器本身以外的任何位置定义的。
There is a page on mediawiki.org that lists wikitext parsers in various programming languages. I don't think any of them do 99+% of wikitext though. In general parsing wikitext is a really complex problem. Wikitext isn't even formally defined anywhere outside of the MediaWiki parser itself.
这篇关于Java的解析器wikitext的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!