You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by mr...@apache.org on 2006/11/20 03:54:40 UTC
svn commit: r477010 [2/2] - in
/xml/commons/trunk/java/external/src/org/w3c/css: ./ sac/ sac/helpers/
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/Parser.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/Parser.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/Parser.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/Parser.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * The original version of this interface comes from SAX :
+ * http://www.megginson.com/SAX/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+import java.io.IOException;
+import java.util.Locale;
+
+/**
+ * Basic interface for CSS (Simple API for CSS) parsers.
+ *
+ * <p>All CSS parsers must implement this basic interface: it allows
+ * applications to register handlers for different types of events
+ * and to initiate a parse from a URI, or a character stream.</p>
+ *
+ * <p>All CSS parsers must also implement a zero-argument constructor
+ * (though other constructors are also allowed).</p>
+ *
+ * <p>CSS parsers are reusable but not re-entrant: the application
+ * may reuse a parser object (possibly with a different input source)
+ * once the first parse has completed successfully, but it may not
+ * invoke the parse() methods recursively within a parse.</p>
+ *
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ * @see DocumentHandler
+ * @see ErrorHandler
+ * @see InputSource
+ */
+public interface Parser {
+
+ /**
+ * Allow an application to request a locale for errors and warnings.
+ *
+ * <p>CSS parsers are not required to provide localisation for errors
+ * and warnings; if they cannot support the requested locale,
+ * however, they must throw a CSS exception. Applications may
+ * not request a locale change in the middle of a parse.</p>
+ *
+ * @param locale A Java Locale object.
+ * @exception CSSException Throws an exception
+ * (using the previous or default locale) if the
+ * requested locale is not supported.
+ * @see CSSException
+ * @see CSSParseException
+ */
+ public void setLocale(Locale locale) throws CSSException;
+
+ /**
+ * Allow an application to register a document event handler.
+ *
+ * <p>If the application does not register a document handler, all
+ * document events reported by the CSS parser will be silently
+ * ignored (this is the default behaviour implemented by
+ * HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the CSS parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The document handler.
+ * @see DocumentHandler
+ */
+ public void setDocumentHandler(DocumentHandler handler);
+
+ public void setSelectorFactory(SelectorFactory selectorFactory);
+ public void setConditionFactory(ConditionFactory conditionFactory);
+
+ /**
+ * Allow an application to register an error event handler.
+ *
+ * <p>If the application does not register an error event handler,
+ * all error events reported by the CSS parser will be silently
+ * ignored, except for fatalError, which will throw a CSSException
+ * (this is the default behaviour implemented by HandlerBase).</p>
+ *
+ * <p>Applications may register a new or different handler in the
+ * middle of a parse, and the CSS parser must begin using the new
+ * handler immediately.</p>
+ *
+ * @param handler The error handler.
+ * @see ErrorHandler
+ * @see CSSException
+ */
+ public void setErrorHandler(ErrorHandler handler);
+
+ /**
+ * Parse a CSS document.
+ *
+ * <p>The application can use this method to instruct the CSS parser
+ * to begin parsing an CSS document from any valid input
+ * source (a character stream, a byte stream, or a URI).</p>
+ *
+ * <p>Applications may not invoke this method while a parse is in
+ * progress (they should create a new Parser instead for each
+ * additional CSS document). Once a parse is complete, an
+ * application may reuse the same Parser object, possibly with a
+ * different input source.</p>
+ *
+ * @param source The input source for the top-level of the
+ * CSS document.
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see InputSource
+ * @see #parseStyleSheet(java.lang.String)
+ * @see #setDocumentHandler
+ * @see #setErrorHandler
+ */
+ public void parseStyleSheet(InputSource source)
+ throws CSSException, IOException;
+
+
+ /**
+ * Parse a CSS document from a URI.
+ *
+ * <p>This method is a shortcut for the common case of reading a document
+ * from a URI. It is the exact equivalent of the following:</p>
+ *
+ * <pre>
+ * parse(new InputSource(uri));
+ * </pre>
+ *
+ * <p>The URI must be fully resolved by the application before it is passed
+ * to the parser.</p>
+ *
+ * @param uri The URI.
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ * @see #parseStyleSheet(InputSource)
+ */
+ public void parseStyleSheet(String uri) throws CSSException, IOException;
+
+ /**
+ * Parse a CSS style declaration (without '{' and '}').
+ *
+ * @param styleValue The declaration.
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public void parseStyleDeclaration(InputSource source)
+ throws CSSException, IOException;
+
+
+ /**
+ * Parse a CSS rule.
+ *
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public void parseRule(InputSource source) throws CSSException, IOException;
+
+ /**
+ * Returns a string about which CSS language is supported by this
+ * parser. For CSS Level 1, it returns "http://www.w3.org/TR/REC-CSS1", for
+ * CSS Level 2, it returns "http://www.w3.org/TR/REC-CSS2". Note that a
+ * "CSSx" parser can return lexical unit other than those allowed by CSS
+ * Level x but this usage is not recommended.
+ */
+ public String getParserVersion();
+
+ /**
+ * Parse a comma separated list of selectors.
+ *
+ *
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public SelectorList parseSelectors(InputSource source)
+ throws CSSException, IOException;
+
+
+ /**
+ * Parse a CSS property value.
+ *
+ *
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public LexicalUnit parsePropertyValue(InputSource source)
+ throws CSSException, IOException;
+
+
+ /**
+ * Parse a CSS priority value (e.g. "!important").
+ *
+ *
+ * @exception CSSException Any CSS exception, possibly
+ * wrapping another exception.
+ * @exception java.io.IOException An IO exception from the parser,
+ * possibly from a byte stream or character stream
+ * supplied by the application.
+ */
+ public boolean parsePriority(InputSource source)
+ throws CSSException, IOException;
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/Parser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/Parser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/PositionalCondition.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/PositionalCondition.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/PositionalCondition.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/PositionalCondition.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,36 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ * @see Condition#SAC_POSITIONAL_CONDITION
+ */
+public interface PositionalCondition extends Condition {
+
+ /**
+ * Returns the position in the tree.
+ * <p>A negative value means from the end of the child node list.
+ * <p>The child node list begins at 0.
+ */
+ public int getPosition();
+
+ /**
+ * <code>true</code> if the child node list only shows nodes of the same
+ * type of the selector (only elements, only PIS, ...)
+ */
+ public boolean getTypeNode();
+
+ /**
+ * <code>true</code> if the node should have the same node type (for
+ * element, same namespaceURI and same localName).
+ */
+ public boolean getType();
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/PositionalCondition.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/PositionalCondition.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/ProcessingInstructionSelector.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/ProcessingInstructionSelector.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/ProcessingInstructionSelector.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/ProcessingInstructionSelector.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,31 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * This simple matches a
+ * <a href="http://www.w3.org/TR/REC-xml#sec-pi">processing instruction</a>.
+ *
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ * @see Selector#SAC_PROCESSING_INSTRUCTION_NODE_SELECTOR
+ */
+public interface ProcessingInstructionSelector extends SimpleSelector {
+
+ /**
+ * Returns the <a href="http://www.w3.org/TR/REC-xml#NT-PITarget">target</a>
+ * of the processing instruction.
+ */
+ public String getTarget();
+
+ /**
+ * Returns the character data.
+ */
+ public String getData();
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/ProcessingInstructionSelector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/ProcessingInstructionSelector.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/SACMediaList.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/SACMediaList.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/SACMediaList.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/SACMediaList.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,27 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ */
+public interface SACMediaList {
+
+ /**
+ * Returns the length of this media list
+ */
+ public int getLength();
+
+ /**
+ * Returns the medium at the specified index, or <code>null</code> if this
+ * is not a valid index.
+ */
+ public String item(int index);
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SACMediaList.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SACMediaList.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/Selector.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/Selector.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/Selector.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/Selector.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * This interface defines a selector.
+ * <p><b>Remarks</b>: Not all the following selectors are supported (or will be
+ * supported) by CSS.
+ * <p>All examples are CSS2 compliant.
+ *
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ */
+public interface Selector {
+
+ /* simple selectors */
+
+ /**
+ * This is a conditional selector.
+ * example:
+ * <pre class="example">
+ * simple[role="private"]
+ * .part1
+ * H1#myId
+ * P:lang(fr).p1
+ * </pre>
+ *
+ * @see ConditionalSelector
+ */
+ public static final short SAC_CONDITIONAL_SELECTOR = 0;
+
+ /**
+ * This selector matches any node.
+ * @see SimpleSelector
+ */
+ public static final short SAC_ANY_NODE_SELECTOR = 1;
+
+ /**
+ * This selector matches the root node.
+ * @see SimpleSelector
+ */
+ public static final short SAC_ROOT_NODE_SELECTOR = 2;
+
+ /**
+ * This selector matches only node that are different from a specified one.
+ * @see NegativeSelector
+ */
+ public static final short SAC_NEGATIVE_SELECTOR = 3;
+
+ /**
+ * This selector matches only element node.
+ * example:
+ * <pre class="example">
+ * H1
+ * animate
+ * </pre>
+ * @see ElementSelector
+ */
+ public static final short SAC_ELEMENT_NODE_SELECTOR = 4;
+
+ /**
+ * This selector matches only text node.
+ * @see CharacterDataSelector
+ */
+ public static final short SAC_TEXT_NODE_SELECTOR = 5;
+
+ /**
+ * This selector matches only cdata node.
+ * @see CharacterDataSelector
+ */
+ public static final short SAC_CDATA_SECTION_NODE_SELECTOR = 6;
+
+ /**
+ * This selector matches only processing instruction node.
+ * @see ProcessingInstructionSelector
+ */
+ public static final short SAC_PROCESSING_INSTRUCTION_NODE_SELECTOR = 7;
+
+ /**
+ * This selector matches only comment node.
+ * @see CharacterDataSelector
+ */
+ public static final short SAC_COMMENT_NODE_SELECTOR = 8;
+ /**
+ * This selector matches the 'first line' pseudo element.
+ * example:
+ * <pre class="example">
+ * :first-line
+ * </pre>
+ * @see ElementSelector
+ */
+ public static final short SAC_PSEUDO_ELEMENT_SELECTOR = 9;
+
+ /* combinator selectors */
+
+ /**
+ * This selector matches an arbitrary descendant of some ancestor element.
+ * example:
+ * <pre class="example">
+ * E F
+ * </pre>
+ * @see DescendantSelector
+ */
+ public static final short SAC_DESCENDANT_SELECTOR = 10;
+
+ /**
+ * This selector matches a childhood relationship between two elements.
+ * example:
+ * <pre class="example">
+ * E > F
+ * </pre>
+ * @see DescendantSelector
+ */
+ public static final short SAC_CHILD_SELECTOR = 11;
+ /**
+ * This selector matches two selectors who shared the same parent in the
+ * document tree and the element represented by the first sequence
+ * immediately precedes the element represented by the second one.
+ * example:
+ * <pre class="example">
+ * E + F
+ * </pre>
+ * @see SiblingSelector
+ */
+ public static final short SAC_DIRECT_ADJACENT_SELECTOR = 12;
+
+ /**
+ * An integer indicating the type of <code>Selector</code>
+ */
+ public short getSelectorType();
+
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/Selector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/Selector.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorFactory.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorFactory.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorFactory.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorFactory.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ * @see org.w3c.css.sac.Selector
+ */
+public interface SelectorFactory {
+
+ /**
+ * Creates a conditional selector.
+ *
+ * @param selector a selector.
+ * @param condition a condition
+ * @return the conditional selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ ConditionalSelector createConditionalSelector(SimpleSelector selector,
+ Condition condition)
+ throws CSSException;
+
+ /**
+ * Creates an any node selector.
+ *
+ * @return the any node selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ SimpleSelector createAnyNodeSelector() throws CSSException;
+
+ /**
+ * Creates an root node selector.
+ *
+ * @return the root node selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ SimpleSelector createRootNodeSelector() throws CSSException;
+
+ /**
+ * Creates an negative selector.
+ *
+ * @param selector a selector.
+ * @return the negative selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ NegativeSelector createNegativeSelector(SimpleSelector selector)
+ throws CSSException;
+
+ /**
+ * Creates an element selector.
+ *
+ * @param namespaceURI the <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace
+ * URI</a> of the element selector.
+ * @param tagName the <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local
+ * part</a> of the element name. <code>NULL</code> if this element
+ * selector can match any element.</p>
+ * @return the element selector
+ * @exception CSSException If this selector is not supported.
+ */
+ ElementSelector createElementSelector(String namespaceURI, String tagName)
+ throws CSSException;
+
+ /**
+ * Creates a text node selector.
+ *
+ * @param data the data
+ * @return the text node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ CharacterDataSelector createTextNodeSelector(String data)
+ throws CSSException;
+
+ /**
+ * Creates a cdata section node selector.
+ *
+ * @param data the data
+ * @return the cdata section node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ CharacterDataSelector createCDataSectionSelector(String data)
+ throws CSSException;
+
+ /**
+ * Creates a processing instruction node selector.
+ *
+ * @param target the target
+ * @param data the data
+ * @return the processing instruction node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ ProcessingInstructionSelector
+ createProcessingInstructionSelector(String target,
+ String data)
+ throws CSSException;
+
+ /**
+ * Creates a comment node selector.
+ *
+ * @param data the data
+ * @return the comment node selector
+ * @exception CSSException If this selector is not supported.
+ */
+ CharacterDataSelector createCommentSelector(String data)
+ throws CSSException;
+
+ /**
+ * Creates a pseudo element selector.
+ *
+ * @param pseudoName the pseudo element name. <code>NULL</code> if this
+ * element selector can match any pseudo element.</p>
+ * @return the element selector
+ * @exception CSSException If this selector is not supported.
+ */
+ ElementSelector createPseudoElementSelector(String namespaceURI,
+ String pseudoName)
+ throws CSSException;
+
+ /**
+ * Creates a descendant selector.
+ *
+ * @param parent the parent selector
+ * @param descendant the descendant selector
+ * @return the combinator selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ DescendantSelector createDescendantSelector(Selector parent,
+ SimpleSelector descendant)
+ throws CSSException;
+
+ /**
+ * Creates a child selector.
+ *
+ * @param parent the parent selector
+ * @param child the child selector
+ * @return the combinator selector.
+ * @exception CSSException If this selector is not supported.
+ */
+ DescendantSelector createChildSelector(Selector parent,
+ SimpleSelector child)
+ throws CSSException;
+
+ /**
+ * Creates a sibling selector.
+ *
+ * @param nodeType the type of nodes in the siblings list.
+ * @param child the child selector
+ * @param adjacent the direct adjacent selector
+ * @return the sibling selector with nodeType
+ equals to org.w3c.dom.Node.ELEMENT_NODE
+ * @exception CSSException If this selector is not supported.
+ */
+ SiblingSelector createDirectAdjacentSelector(short nodeType,
+ Selector child,
+ SimpleSelector directAdjacent)
+ throws CSSException;
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorFactory.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorList.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorList.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorList.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorList.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * The SelectorList interface provides the abstraction of an ordered collection
+ * of selectors, without defining or constraining how this collection is
+ * implemented.
+ *
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ */
+public interface SelectorList {
+
+ /**
+ * Returns the length of this selector list
+ */
+ public int getLength();
+
+ /**
+ * Returns the selector at the specified index, or <code>null</code> if this
+ * is not a valid index.
+ */
+ public Selector item(int index);
+}
+
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorList.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SelectorList.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/SiblingSelector.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/SiblingSelector.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/SiblingSelector.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/SiblingSelector.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,36 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ * @see Selector#SAC_DIRECT_ADJACENT_SELECTOR
+ */
+public interface SiblingSelector extends Selector {
+
+ public static final short ANY_NODE = 201;
+
+ /**
+ * The node type to considered in the siblings list.
+ * All DOM node types are supported. In order to support the "any" node
+ * type, the code ANY_NODE is added to the DOM node types.
+ */
+ public short getNodeType();
+
+ /**
+ * Returns the first selector.
+ */
+ public Selector getSelector();
+
+ /*
+ * Returns the second selector.
+ */
+ public SimpleSelector getSiblingSelector();
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SiblingSelector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SiblingSelector.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/SimpleSelector.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/SimpleSelector.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/SimpleSelector.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/SimpleSelector.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,21 @@
+/*
+ * (c) COPYRIGHT 1999 World Wide Web Consortium
+ * (Massachusetts Institute of Technology, Institut National de Recherche
+ * en Informatique et en Automatique, Keio University).
+ * All Rights Reserved. http://www.w3.org/Consortium/Legal/
+ *
+ * $Id$
+ */
+package org.w3c.css.sac;
+
+/**
+ * This interface is only for constraints on selectors.
+ *
+ * <p>A <code>ConditionalSelector</code> can only accept a simple selector or a
+ * negative selector.</p>
+ *
+ * @version $Revision$
+ * @author Philippe Le Hegaret */
+public interface SimpleSelector extends Selector {
+ // empty
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SimpleSelector.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/SimpleSelector.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: xml/commons/trunk/java/external/src/org/w3c/css/sac/helpers/ParserFactory.java
URL: http://svn.apache.org/viewvc/xml/commons/trunk/java/external/src/org/w3c/css/sac/helpers/ParserFactory.java?view=auto&rev=477010
==============================================================================
--- xml/commons/trunk/java/external/src/org/w3c/css/sac/helpers/ParserFactory.java (added)
+++ xml/commons/trunk/java/external/src/org/w3c/css/sac/helpers/ParserFactory.java Sun Nov 19 18:54:38 2006
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1999 World Wide Web Consortium,
+ * (Massachusetts Institute of Technology, Institut National de
+ * Recherche en Informatique et en Automatique, Keio University). All
+ * Rights Reserved. This program is distributed under the W3C's Software
+ * Intellectual Property License. This program is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
+ *
+ * $Id$
+ */
+package org.w3c.css.sac.helpers;
+
+import org.w3c.css.sac.Parser;
+
+/**
+ * @version $Revision$
+ * @author Philippe Le Hegaret
+ */
+public class ParserFactory {
+
+ /**
+ * Create a parser with given selectors factory and conditions factory.
+ */
+ public Parser makeParser()
+ throws ClassNotFoundException,
+ IllegalAccessException,
+ InstantiationException,
+ NullPointerException,
+ ClassCastException {
+ String className = System.getProperty("org.w3c.css.sac.parser");
+ if (className == null) {
+ throw new NullPointerException("No value for sac.parser property");
+ } else {
+ return (Parser)(Class.forName(className).newInstance());
+ }
+ }
+}
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/helpers/ParserFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xml/commons/trunk/java/external/src/org/w3c/css/sac/helpers/ParserFactory.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision