1 23 24 package org.enhydra.xml.xmlc.dom; 25 26 import java.util.HashSet ; 27 import java.util.StringTokenizer ; 28 29 import org.w3c.dom.Element ; 30 31 36 public final class HTMLDomFactoryMethods { 37 40 private static String [] URL_ATTRIBUTES = { 41 "action", "archive", "background", "cite", "classid", "codebase", 42 "data", "href", "longdesc", "onblur", "onchange", "onclick", 43 "ondblclick", "onfocus", "onkeydown", "onkeypress", "onkeyup", 44 "onload", "onmousedown", "onmousemove", "onmouseout", "onmouseover", 45 "onmouseup","onreset", "onselect", "onsubmit", "onunload", "profile", 46 "src", "usemap" 47 }; 48 49 52 private static final HashSet urlAttributes; 53 54 57 static { 58 urlAttributes = new HashSet (URL_ATTRIBUTES.length); 59 for (int idx = 0; idx < URL_ATTRIBUTES.length; idx++) { 60 urlAttributes.add(URL_ATTRIBUTES[idx]); 61 } 62 } 63 64 67 public static final String getBaseClassName() { 68 return "org.enhydra.xml.xmlc.html.HTMLObjectImpl"; 69 } 70 71 74 public static final String [] getInterfaceNames() { 75 return new String [] {"org.enhydra.xml.xmlc.html.HTMLObject"}; 76 } 77 78 81 public static final String [] getElementClassNames(Element element) { 82 String classNames = element.getAttribute("class"); 84 if ((classNames == null) || (classNames.length() ==0)) { 85 return null; 86 } else { 87 StringTokenizer tokens = new StringTokenizer (classNames); 89 String [] names = new String [tokens.countTokens()]; 90 for (int idx = 0; idx < names.length; idx++) { 91 names[idx] = tokens.nextToken(); 92 } 93 return names; 94 } 95 } 96 97 98 101 public static final boolean isURLAttribute(Element element, 102 String attrName) { 103 return urlAttributes.contains(attrName); 104 } 105 } 106 | Popular Tags |