001: /*
002: * Copyright (c) 1999 World Wide Web Consortium,
003: * (Massachusetts Institute of Technology, Institut National de
004: * Recherche en Informatique et en Automatique, Keio University). All
005: * Rights Reserved. This program is distributed under the W3C's Software
006: * Intellectual Property License. This program is distributed in the
007: * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
008: * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
009: * PURPOSE.
010: * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
011: *
012: * $Id$
013: */
014: package org.w3c.css.sac;
015:
016: /**
017: * @version $Revision$
018: * @author Philippe Le Hegaret
019: * @see org.w3c.css.sac.Selector
020: */
021: public interface SelectorFactory {
022:
023: /**
024: * Creates a conditional selector.
025: *
026: * @param selector a selector.
027: * @param condition a condition
028: * @return the conditional selector.
029: * @exception CSSException If this selector is not supported.
030: */
031: ConditionalSelector createConditionalSelector(
032: SimpleSelector selector, Condition condition)
033: throws CSSException;
034:
035: /**
036: * Creates an any node selector.
037: *
038: * @return the any node selector.
039: * @exception CSSException If this selector is not supported.
040: */
041: SimpleSelector createAnyNodeSelector() throws CSSException;
042:
043: /**
044: * Creates an root node selector.
045: *
046: * @return the root node selector.
047: * @exception CSSException If this selector is not supported.
048: */
049: SimpleSelector createRootNodeSelector() throws CSSException;
050:
051: /**
052: * Creates an negative selector.
053: *
054: * @param selector a selector.
055: * @return the negative selector.
056: * @exception CSSException If this selector is not supported.
057: */
058: NegativeSelector createNegativeSelector(SimpleSelector selector)
059: throws CSSException;
060:
061: /**
062: * Creates an element selector.
063: *
064: * @param namespaceURI the <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
065: * URI</a> of the element selector.
066: * @param tagName the <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local
067: * part</a> of the element name. <code>NULL</code> if this element
068: * selector can match any element.</p>
069: * @return the element selector
070: * @exception CSSException If this selector is not supported.
071: */
072: ElementSelector createElementSelector(String namespaceURI,
073: String tagName) throws CSSException;
074:
075: /**
076: * Creates a text node selector.
077: *
078: * @param data the data
079: * @return the text node selector
080: * @exception CSSException If this selector is not supported.
081: */
082: CharacterDataSelector createTextNodeSelector(String data)
083: throws CSSException;
084:
085: /**
086: * Creates a cdata section node selector.
087: *
088: * @param data the data
089: * @return the cdata section node selector
090: * @exception CSSException If this selector is not supported.
091: */
092: CharacterDataSelector createCDataSectionSelector(String data)
093: throws CSSException;
094:
095: /**
096: * Creates a processing instruction node selector.
097: *
098: * @param target the target
099: * @param data the data
100: * @return the processing instruction node selector
101: * @exception CSSException If this selector is not supported.
102: */
103: ProcessingInstructionSelector createProcessingInstructionSelector(
104: String target, String data) throws CSSException;
105:
106: /**
107: * Creates a comment node selector.
108: *
109: * @param data the data
110: * @return the comment node selector
111: * @exception CSSException If this selector is not supported.
112: */
113: CharacterDataSelector createCommentSelector(String data)
114: throws CSSException;
115:
116: /**
117: * Creates a pseudo element selector.
118: *
119: * @param pseudoName the pseudo element name. <code>NULL</code> if this
120: * element selector can match any pseudo element.</p>
121: * @return the element selector
122: * @exception CSSException If this selector is not supported.
123: */
124: ElementSelector createPseudoElementSelector(String namespaceURI,
125: String pseudoName) throws CSSException;
126:
127: /**
128: * Creates a descendant selector.
129: *
130: * @param parent the parent selector
131: * @param descendant the descendant selector
132: * @return the combinator selector.
133: * @exception CSSException If this selector is not supported.
134: */
135: DescendantSelector createDescendantSelector(Selector parent,
136: SimpleSelector descendant) throws CSSException;
137:
138: /**
139: * Creates a child selector.
140: *
141: * @param parent the parent selector
142: * @param child the child selector
143: * @return the combinator selector.
144: * @exception CSSException If this selector is not supported.
145: */
146: DescendantSelector createChildSelector(Selector parent,
147: SimpleSelector child) throws CSSException;
148:
149: /**
150: * Creates a sibling selector.
151: *
152: * @param nodeType the type of nodes in the siblings list.
153: * @param child the child selector
154: * @param adjacent the direct adjacent selector
155: * @return the sibling selector with nodeType
156: equals to org.w3c.dom.Node.ELEMENT_NODE
157: * @exception CSSException If this selector is not supported.
158: */
159: SiblingSelector createDirectAdjacentSelector(short nodeType,
160: Selector child, SimpleSelector directAdjacent)
161: throws CSSException;
162: }
|