Topic: 怎样可以拿到"<A ...> text </A>"之间的数据text! |
Print this page |
1.怎样可以拿到"<A ...> text </A>"之间的数据text! | Copy to clipboard |
Posted by: hidi_zhou Posted on: 2003-03-10 18:00 请问各位高手: 怎样可以拿到"<A ...> text </A>"之间的数据text! 可以的话,请讲具体点。 |
2.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: mochow Posted on: 2003-03-10 20:00 http://www.javaresearch.org/article/showarticle.jsp?column=46&thread=1256 |
3.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: snowbug Posted on: 2003-03-11 00:00 If it is web page processing, you can also use javascript: define an ID for the <a> tag, and use document.all.your_id to refer to that <a> tag object. then use, I think, innerHTML or outerHTML, to refer to the text and then do your processing. |
4.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: quickL Posted on: 2003-03-11 06:54 Are you talking about XML processing? |
5.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: hidi_zhou Posted on: 2003-03-11 10:24 No, i just want to parse the html file, and get the data from html file. my purpose does not get all data between any tags. only the data from tagA and tagB. my problem is how to skip the atrributes of tagA, then get the"text". |
6.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: javaren Posted on: 2003-03-11 13:13 String str is your full html text //省略了合法性判断 int aStartPos = str.indexOf("<A"); int aEndPos = str.indexOf("</A>", aStartPos); int textStartPos = str.indexOf(">", aStartPos); String text = str.substring(textStartPos + 1, aEndPos); |
7.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: javaren] | Copy to clipboard |
Posted by: ditty Posted on: 2003-03-11 13:22 对于这种问题,可以考虑用xml解析工具实现,如jdom,但是,前提是被解析的html必须严格符合xml语法格式,即前后对称,并无单独存在的属性,如:disabled readonly等. |
8.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: ditty] | Copy to clipboard |
Posted by: rainman Posted on: 2003-03-11 13:26 自己写一个parser比较好啊。现成的什么html2txt参考一下好了。 |
9.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: abc123 Posted on: 2003-03-11 16:57 regexp? |
10.Re:怎样可以拿到"<A ...> text </A>"之间的数据text! [Re: hidi_zhou] | Copy to clipboard |
Posted by: hidi_zhou Posted on: 2003-03-11 17:31 谢谢各位,i have done it,thank you very much! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |