1 18 package org.apache.batik.css.engine.sac; 19 20 import org.w3c.css.sac.CSSException; 21 import org.w3c.css.sac.CharacterDataSelector; 22 import org.w3c.css.sac.Condition; 23 import org.w3c.css.sac.ConditionalSelector; 24 import org.w3c.css.sac.DescendantSelector; 25 import org.w3c.css.sac.ElementSelector; 26 import org.w3c.css.sac.NegativeSelector; 27 import org.w3c.css.sac.ProcessingInstructionSelector; 28 import org.w3c.css.sac.Selector; 29 import org.w3c.css.sac.SelectorFactory; 30 import org.w3c.css.sac.SiblingSelector; 31 import org.w3c.css.sac.SimpleSelector; 32 33 39 public class CSSSelectorFactory implements SelectorFactory { 40 41 44 public final static SelectorFactory INSTANCE = new CSSSelectorFactory(); 45 46 49 protected CSSSelectorFactory() { 50 } 51 52 56 public ConditionalSelector createConditionalSelector 57 (SimpleSelector selector, 58 Condition condition) 59 throws CSSException { 60 return new CSSConditionalSelector(selector, condition); 61 } 62 63 67 public SimpleSelector createAnyNodeSelector() throws CSSException { 68 throw new CSSException("Not implemented in CSS2"); 69 } 70 71 75 public SimpleSelector createRootNodeSelector() throws CSSException { 76 throw new CSSException("Not implemented in CSS2"); 77 } 78 79 83 public NegativeSelector createNegativeSelector(SimpleSelector selector) 84 throws CSSException { 85 throw new CSSException("Not implemented in CSS2"); 86 } 87 88 92 public ElementSelector createElementSelector(String namespaceURI, 93 String tagName) 94 throws CSSException { 95 return new CSSElementSelector(namespaceURI, tagName); 96 } 97 98 102 public CharacterDataSelector createTextNodeSelector(String data) 103 throws CSSException { 104 throw new CSSException("Not implemented in CSS2"); 105 } 106 107 111 public CharacterDataSelector createCDataSectionSelector(String data) 112 throws CSSException { 113 throw new CSSException("Not implemented in CSS2"); 114 } 115 116 120 public ProcessingInstructionSelector createProcessingInstructionSelector 121 (String target, 122 String data) throws CSSException { 123 throw new CSSException("Not implemented in CSS2"); 124 } 125 126 130 public CharacterDataSelector createCommentSelector(String data) 131 throws CSSException { 132 throw new CSSException("Not implemented in CSS2"); 133 } 134 135 139 public ElementSelector createPseudoElementSelector(String namespaceURI, 140 String pseudoName) 141 throws CSSException { 142 return new CSSPseudoElementSelector(namespaceURI, pseudoName); 143 } 144 145 149 public DescendantSelector createDescendantSelector 150 (Selector parent, 151 SimpleSelector descendant) 152 throws CSSException { 153 return new CSSDescendantSelector(parent, descendant); 154 } 155 156 160 public DescendantSelector createChildSelector(Selector parent, 161 SimpleSelector child) 162 throws CSSException { 163 return new CSSChildSelector(parent, child); 164 } 165 166 170 public SiblingSelector createDirectAdjacentSelector 171 (short nodeType, 172 Selector child, 173 SimpleSelector directAdjacent) 174 throws CSSException { 175 return new CSSDirectAdjacentSelector(nodeType, child, 176 directAdjacent); 177 } 178 } 179 | Popular Tags |