1 30 31 package com.steadystate.css.parser.selectors; 32 33 import org.w3c.css.sac.*; 34 35 public class SelectorFactoryImpl implements SelectorFactory { 36 37 public ConditionalSelector createConditionalSelector( 38 SimpleSelector selector, 39 Condition condition) throws CSSException { 40 return new ConditionalSelectorImpl(selector, condition); 41 } 42 43 public SimpleSelector createAnyNodeSelector() throws CSSException { 44 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 45 } 46 47 public SimpleSelector createRootNodeSelector() throws CSSException { 48 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 49 } 50 51 public NegativeSelector createNegativeSelector(SimpleSelector selector) 52 throws CSSException { 53 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 54 } 55 56 public ElementSelector createElementSelector(String namespaceURI, String localName) 57 throws CSSException { 58 if (namespaceURI != null) { 59 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 60 } 61 return new ElementSelectorImpl(localName); 62 } 63 64 public CharacterDataSelector createTextNodeSelector(String data) 65 throws CSSException { 66 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 67 } 68 69 public CharacterDataSelector createCDataSectionSelector(String data) 70 throws CSSException { 71 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 72 } 73 74 public ProcessingInstructionSelector createProcessingInstructionSelector( 75 String target, 76 String data) throws CSSException { 77 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 78 } 79 80 public CharacterDataSelector createCommentSelector(String data) 81 throws CSSException { 82 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 83 } 84 85 public ElementSelector createPseudoElementSelector( 86 String namespaceURI, 87 String pseudoName) throws CSSException { 88 if (namespaceURI != null) { 89 throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); 90 } 91 return new PseudoElementSelectorImpl(pseudoName); 92 } 93 94 public DescendantSelector createDescendantSelector( 95 Selector parent, 96 SimpleSelector descendant) throws CSSException { 97 return new DescendantSelectorImpl(parent, descendant); 98 } 99 100 public DescendantSelector createChildSelector( 101 Selector parent, 102 SimpleSelector child) throws CSSException { 103 return new ChildSelectorImpl(parent, child); 104 } 105 106 public SiblingSelector createDirectAdjacentSelector( 107 short nodeType, 108 Selector child, 109 SimpleSelector directAdjacent) throws CSSException { 110 return new DirectAdjacentSelectorImpl(nodeType, child, directAdjacent); 111 } 112 } 113 | Popular Tags |