?? element.java
字號:
/**
* Represents an HTML element.
*
* @author SeungJin Lim
* @version 1.0, 2006/10/20
* @since JDK1.5
*/
package html;
import java.util.Enumeration;
public class Element {
public Element( String arg ) {
if( !arg.startsWith("<") || !arg.endsWith(">") );
int whitespace = arg.indexOf(" ");
if( whitespace<0 ) throw new RuntimeException("[Element] invalid anchor tag: "+arg );
name = arg.substring( 1, whitespace ).toUpperCase();
attrList = new AttributeList( arg );
}
/**
* Returns attribute names contained in this element.
* @return
*/
public Enumeration attributes() {
return attrList.getAttributes();
}
/**
* Returns the value of attribute <code>key</code>.
* @param key
* @return
*/
public String attributeValueOf( String key ) {
return attrList.getAttributeValueOf(key.toUpperCase());
}
public String name() {
return name;
}
/**
* Sets attribute <code>attr</code> with <code>value</code>.
* @param attr
* @param value
*/
public void setAttribute( String attr, String value ) {
attrList.putAttributeValueOf( attr, value );
}
public String toString() {
return "<"+name+" "+attrList+">";
}
/**
* The name of this element:
*/
private String name;
/**
* The attribute list in this element:
*/
private AttributeList attrList;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -