1 23 24 package org.enhydra.xml.xmlc.html; 25 26 import java.util.Enumeration ; 27 import java.util.Hashtable ; 28 29 import org.enhydra.xml.xmlc.XMLCException; 30 31 33 36 public class HTMLProprietaryTags { 37 40 public static final String TAG_SET_CYBER_STUDIO = "cyberstudio"; 41 42 45 public static final int TAG_CM_EMPTY = 0x01; 46 47 50 public static final int TAG_CM_INLINE = 0x02; 51 52 55 public static final int TAG_CM_BLOCK = 0x04; 56 57 60 public static final int TAG_CM_OPT = 0x08; 61 62 65 public class Tag { 66 69 public final String tagName; 70 71 74 public final int contentModel; 75 76 80 public final String tagSet; 81 82 85 protected Tag(String tagName, 86 int contentModel) { 87 this.tagName = tagName; 88 this.contentModel = contentModel; 89 this.tagSet = null; 90 } 91 92 95 protected Tag(String tagName, 96 int contentModel, 97 String tagSet) { 98 this.tagName = tagName; 99 this.contentModel = contentModel; 100 this.tagSet = tagSet; 101 } 102 } 103 104 107 private Hashtable tags = new Hashtable (); 108 109 113 private Hashtable attributes = new Hashtable (); 114 115 118 private Hashtable tagSets = new Hashtable (); 119 120 129 public void addTagSet(String tagSetName) throws XMLCException { 130 if (tagSetName.equalsIgnoreCase(TAG_SET_CYBER_STUDIO)) { 131 if (!tagSets.containsKey(TAG_SET_CYBER_STUDIO)) { 132 registerCyberStudioTags(); 133 tagSets.put(TAG_SET_CYBER_STUDIO, TAG_SET_CYBER_STUDIO); 134 } 135 } else { 136 throw new XMLCException ("Unknown proprietary tag set: \"" 137 + tagSetName + "\", valid sets are: " 138 + TAG_SET_CYBER_STUDIO); 139 } 140 } 141 142 145 public Enumeration getTagSets() { 146 return tagSets.elements(); 147 } 148 149 155 public void addTag(String tagName, 156 int contentModel) throws XMLCException { 157 tagName = tagName.toUpperCase(); 158 tags.put(tagName, new Tag(tagName, 159 contentModel)); 160 } 161 162 165 public Enumeration getTags() { 166 return tags.elements(); 167 } 168 169 174 public void addAttribute(String attributeName) throws XMLCException { 175 attributeName = attributeName.toUpperCase(); 176 attributes.put(attributeName, attributeName); 177 } 178 179 182 public Enumeration getAttributes() { 183 return attributes.elements(); 184 } 185 186 189 public void addTag(String tagName, 190 int contentModel, 191 String tagSet) { 192 tagName = tagName.toUpperCase(); 193 tags.put(tagName, new Tag(tagName, contentModel, tagSet)); 194 } 195 196 199 private void registerCyberStudioTags() throws XMLCException { 200 String [] csBlockTags = { 201 "csactionclass", "csactiondict", "csactionitem", 202 "csactionparam", "csactions", "csgroup", 203 "csimport", "csmagic", "cspart", 204 "csscriptdict", "cssequence", "cssequencer", 205 "cstrack" 206 }; 207 for (int i = 0; i < csBlockTags.length; i++) { 208 addTag(csBlockTags[i], TAG_CM_BLOCK, TAG_SET_CYBER_STUDIO); 209 } 210 211 addTag("csobj", TAG_CM_BLOCK|TAG_CM_INLINE, TAG_SET_CYBER_STUDIO); 212 213 String [] csEmptyTags = { 214 "csbrowser", "csaction", "csactioncntl", 215 "csactionenum", "csgeneric", "csseqaction" 216 }; 217 for (int i = 0; i < csEmptyTags.length; i++) { 218 addTag(csEmptyTags[i], TAG_CM_INLINE|TAG_CM_EMPTY|TAG_CM_OPT, 219 TAG_SET_CYBER_STUDIO); 220 } 221 } 222 } 223 | Popular Tags |