1 14 package org.w3c.flute.parser.selectors; 15 16 import org.w3c.css.sac.SelectorFactory; 17 import org.w3c.css.sac.ConditionalSelector; 18 import org.w3c.css.sac.NegativeSelector; 19 import org.w3c.css.sac.SimpleSelector; 20 import org.w3c.css.sac.ElementSelector; 21 import org.w3c.css.sac.CharacterDataSelector; 22 import org.w3c.css.sac.ProcessingInstructionSelector; 23 import org.w3c.css.sac.SiblingSelector; 24 import org.w3c.css.sac.DescendantSelector; 25 import org.w3c.css.sac.Selector; 26 import org.w3c.css.sac.Condition; 27 import org.w3c.css.sac.CSSException; 28 29 33 public class SelectorFactoryImpl implements SelectorFactory { 34 35 43 public ConditionalSelector createConditionalSelector(SimpleSelector selector, 44 Condition condition) 45 throws CSSException { 46 return new ConditionalSelectorImpl(selector, condition); 47 } 48 49 55 public SimpleSelector createAnyNodeSelector() throws CSSException { 56 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 57 } 58 59 65 public SimpleSelector createRootNodeSelector() throws CSSException { 66 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 67 } 68 69 76 public NegativeSelector createNegativeSelector(SimpleSelector selector) 77 throws CSSException { 78 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 79 } 80 81 92 public ElementSelector createElementSelector(String namespaceURI, String localName) 93 throws CSSException { 94 if (namespaceURI != null) { 95 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 96 } else { 97 return new ElementSelectorImpl(localName); 98 } 99 } 100 101 108 public CharacterDataSelector createTextNodeSelector(String data) 109 throws CSSException { 110 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 111 } 112 113 120 public CharacterDataSelector createCDataSectionSelector(String data) 121 throws CSSException { 122 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 123 } 124 125 133 public ProcessingInstructionSelector 134 createProcessingInstructionSelector(String target, 135 String data) 136 throws CSSException { 137 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 138 } 139 140 147 public CharacterDataSelector createCommentSelector(String data) 148 throws CSSException { 149 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 150 } 151 152 160 public ElementSelector createPseudoElementSelector(String namespaceURI, 161 String pseudoName) 162 throws CSSException { 163 if (namespaceURI != null) { 164 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 165 } else { 166 return new PseudoElementSelectorImpl(pseudoName); 167 } 168 } 169 170 178 public DescendantSelector createDescendantSelector(Selector parent, 179 SimpleSelector descendant) 180 throws CSSException { 181 return new DescendantSelectorImpl(parent, descendant); 182 } 183 184 192 public DescendantSelector createChildSelector(Selector parent, 193 SimpleSelector child) 194 throws CSSException { 195 return new ChildSelectorImpl(parent, child); 196 } 197 198 206 public SiblingSelector createDirectAdjacentSelector(short nodeType, 207 Selector child, 208 SimpleSelector directAdjacent) 209 throws CSSException { 210 if (nodeType != 1) { 211 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 212 } else { 213 return new DirectAdjacentSelectorImpl(child, directAdjacent); 214 } 215 } 216 217 } 218 | Popular Tags |