如何解析带有 HTML 标签的文档?

huangapple 未分类评论48阅读模式
英文:

How to parse a document with html tags?

问题

有一个具有浮动结构的文档:

一些随机文本

不同来源的格式

<!-- customtag -->

<!-- subtag结构 --> ... <!-- subtag结束 -->

我正在寻找一种方法,可以在解析custom tag块并将其转换为对象(每个文档可以有多个)的任务中应用。

目前正在考虑JAXB,StAX,JSoup以及谷歌提供的与此相关的任何内容。JAXB提供了一个良好的起点,但我看不到如何配置它的tag结构

英文:

Have a document with floating structure:

> some random text
>
> formatting for different source
>
> &lt;!-- customtag ---&gt;
>
> &lt;!-- subtag structure --&gt; ... &lt;!-- subtag END --&gt;

Am looking for something, which I can actually apply at a task of parsing the custom tag block and generate an object out of it (multiple per document).

Currently looking in the direction of JAXB, StAX, JSoup and anything google can provide in the matter. JAXB gives a good start, but I cannot see how to configure it's tag structure.

huangapple
  • 本文由 发表于 2020年5月4日 19:25:44
  • 转载请务必保留本文链接:https://java.coder-hub.com/61591110.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定