1 19 package org.enhydra.zeus.util; 20 21 import java.util.Hashtable; 22 import java.util.Enumeration; 23 24 import com.wutka.dtd.DTDElement; 26 import com.wutka.dtd.DTDMixed; 27 import com.wutka.dtd.DTDPCData; 28 29 38 public class DTDUtils { 39 40 49 public static boolean isSimpleElement(DTDElement element, 50 boolean ignoreIDAttributes) { 51 if (element == null) { 52 throw new IllegalArgumentException("A non-null DTDElement must " + 53 "be supplied to DTDUtils methods."); 54 } 55 56 boolean result = true; 57 58 if ((element.getContent() instanceof DTDPCData) || 59 (element.getContent() instanceof DTDMixed)) { 60 61 Hashtable attributes = element.attributes; 63 String key = null; 64 for (Enumeration enum = attributes.keys(); 66 enum.hasMoreElements(); ) { 67 key = (String)enum.nextElement(); 68 69 73 if (!key.startsWith("dt_")) { 74 if (ignoreIDAttributes) { 76 if (key.equalsIgnoreCase("id")) { 77 continue; 78 } 79 } 80 result = false; 81 break; 82 } 83 } 84 } else { 85 result = false; 86 } 87 return result; 88 } 89 } 90 | Popular Tags |