比如下面的代码
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="robots" content="index,follow" />
<meta name="description" content="Enjoy shopping at online store that offers sporting goods and fitness equipment for the outdoors enthusiasts at discounted prices: product information, apparel, footwear, equipment and accessories for sale." />
<meta name="keywords" content="Shopping, sporting goods, health, fitness, product information, discounted, name brand products, best buy, shoes, fashion, apparel, footwear, equipment, ecommerce, sport, goods, products, sale, store, clothes, accessories" />
有多个META标签,每个META标签的NAME属性的值是我想读的内容。如果我用 if (t==HTML.Tag.META) 那么只能读一个META,怎么样把所有的META标签读入,然后把keyword 和description读到KEYWORD和DESCRIPTION里
protected void attributes(AttributeSet attributes)
{
Enumeration e = attributes.getAttributeNames();
while ( e.hasMoreElements() ) {
Object name = e.nextElement();
String value = (String)attributes.getAttribute(name);
下面怎么写,请指教我。我是第一次写JAVA程序好多不懂。
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="robots" content="index,follow" />
<meta name="description" content="Enjoy shopping at online store that offers sporting goods and fitness equipment for the outdoors enthusiasts at discounted prices: product information, apparel, footwear, equipment and accessories for sale." />
<meta name="keywords" content="Shopping, sporting goods, health, fitness, product information, discounted, name brand products, best buy, shoes, fashion, apparel, footwear, equipment, ecommerce, sport, goods, products, sale, store, clothes, accessories" />
有多个META标签,每个META标签的NAME属性的值是我想读的内容。如果我用 if (t==HTML.Tag.META) 那么只能读一个META,怎么样把所有的META标签读入,然后把keyword 和description读到KEYWORD和DESCRIPTION里
protected void attributes(AttributeSet attributes)
{
Enumeration e = attributes.getAttributeNames();
while ( e.hasMoreElements() ) {
Object name = e.nextElement();
String value = (String)attributes.getAttribute(name);
下面怎么写,请指教我。我是第一次写JAVA程序好多不懂。
HTMLPageParser callback = new HTMLPageParser(page);
HTMLPage hpage = new HTMLPage(page);
hpage.open(hpage.getURL(), callback);}
catch ( Exception e ) {
JOptionPane.showMessageDialog(this,
e,
"Error",
JOptionPane.OK_CANCEL_OPTION,
null );
}
是我添加进去的。我就写了这么多,其他的都是HEATON大哥的。如果需要的话我传给你们。QQ21764290