java html 编辑插件,recommendations for a java HTML parser/editor

I've been running into problem after problem trying to use the a third party HTML editor to do what (I hoped) was a simple operation. Because of these problems, I'm looking for recommendations for an alternative HTML parser I could use to perform the operations.

Here's my situation, I have span tags in my html (with an ID attribute to identify them) and I simply want to replace their contents based on an update in another area of my client. For example:

Hello name you are age

I've been trying to use the HTMLDocument class in javax.swing.text like this:

Element e;

e = doc.getElement(document.getDefaultRootElement(), Attribute.ID, "1");

document.setInnerHTML(element, "John");

e = doc.getElement(document.getDefaultRootElement(), Attribute.ID, "2");

document.setInnerHTML(element, "99");

but the element returned is a leaf element and won't allow the innerHTML to be set. Unfortunately, the document, reader & parser are all supplied by a 3rd party & so I can't really modify it.

So, what I was hoping for was that someone else has had a similar problem and could recommend an alternative library to do this?

Thanks in advance, B.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值