[英]Get encoded html content only from url in java
Is there a library in JAVA where I can encode HTML, but only content? JAVA中是否有一个我可以编码HTML但只能编码内容的库?
I have like 我喜欢
<div>Tél</div>
and I only want 我只想要
<div>Tél</div>
instead of 代替
<div>Tél<</div>
I need this library to encode an entire HTML. 我需要这个库来编码整个HTML。 I have tried library JSoup but it has bugs when handling some objects.
我尝试了库JSoup,但是在处理某些对象时存在错误。
Thanks 谢谢
It's never a good idea to parse HTML using regex, that's a recipe for disaster. 使用正则表达式解析HTML绝不是一个好主意,这是灾难的根源。
So first look at this Q&A for HTML parsing in java: Java HTML Parsing 因此,首先请看一下Java中HTML解析的常见问题解答 : Java HTML解析
Once you are able to parse HTML and get internal HTML text then you can encode HTML in one of the these ways: Is there a JDK class to do HTML encoding (but not URL encoding)? 一旦能够解析HTML并获取内部HTML文本,就可以通过以下方式之一对HTML进行编码: 是否有一个JDK类可以进行HTML编码(而不是URL编码)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.