1 42 43 package org.jfree.xml.writer; 44 45 import java.util.HashMap ; 46 47 53 public class SafeTagList { 54 55 56 private HashMap safeTags; 57 58 61 private static class SafeDescription { 62 63 64 private boolean open; 65 66 67 private boolean close; 68 69 75 public SafeDescription(final boolean open, final boolean close) { 76 this.open = open; 77 this.close = close; 78 } 79 80 85 public boolean isOpen() { 86 return this.open; 87 } 88 89 94 public boolean isClose() { 95 return this.close; 96 } 97 } 98 99 102 public SafeTagList() { 103 this.safeTags = new HashMap (); 104 } 105 106 111 public void add (final String tag) { 112 this.safeTags.put(tag, new SafeDescription(true, true)); 113 } 114 115 122 public void add (final String tag, final boolean open, final boolean closed) { 123 this.safeTags.put(tag, new SafeDescription(open, closed)); 124 } 125 126 134 public boolean isSafeForOpen (final String tag) { 135 final SafeDescription sd = (SafeDescription) this.safeTags.get(tag); 136 if (sd == null) { 137 return false; 138 } 139 return sd.isOpen(); 140 } 141 142 150 public boolean isSafeForClose (final String tag) { 151 final SafeDescription sd = (SafeDescription) this.safeTags.get(tag); 152 if (sd == null) { 153 return false; 154 } 155 return sd.isClose(); 156 } 157 158 } 159 | Popular Tags |