r1435 - in guix/trunk/guix-compiler/src/main/java/org/w3c: css/sac css/sac/helpers flute/parser/selectors flute/util
Author: kmorin Date: 2009-05-19 08:39:48 +0000 (Tue, 19 May 2009) New Revision: 1435 Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties Log: Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/SelectorList.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -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: SelectorList.java,v 1.1 1999/09/26 10:06:45 plehegar Exp $ + */ +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: 1.1 $ + * @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); +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/css/sac/helpers/ParserFactory.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -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: ParserFactory.java,v 1.1 2000/02/14 15:54:49 plehegar Exp $ + */ +package org.w3c.css.sac.helpers; + +import org.w3c.css.sac.Parser; + +/** + * @version $Revision: 1.1 $ + * @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()); + } + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AndConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2000 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: AndConditionImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.CombinatorCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.1 $ + * @author Philippe Le Hegaret + */ +public class AndConditionImpl implements CombinatorCondition { + + Condition firstCondition; + Condition secondCondition; + + /** + * Creates a new AndConditionImpl + */ + public AndConditionImpl(Condition firstCondition, Condition secondCondition) { + this.firstCondition = firstCondition; + this.secondCondition = secondCondition; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_AND_CONDITION; + } + + /** + * Returns the first condition. + */ + public Condition getFirstCondition() { + return firstCondition; + } + + /** + * Returns the second condition. + */ + public Condition getSecondCondition() { + return secondCondition; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/AttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2000 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: AttributeConditionImpl.java,v 1.2 2002/06/17 14:08:15 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class AttributeConditionImpl implements AttributeCondition { + + String localName; + String value; + + /** + * Creates a new AttributeConditionImpl + */ + public AttributeConditionImpl(String localName, String value) { + this.localName = localName; + this.value = value; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_ATTRIBUTE_CONDITION; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this attribute condition. + * <p><code>NULL</code> if : + * <ul> + * <li>this attribute condition can match any namespace. + * <li>this attribute is an id attribute. + * </ul> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this attribute. + * <p><code>NULL</code> if : + * <ul> + * <li><p>this attribute condition can match any attribute. + * <li><p>this attribute is a class attribute. + * <li><p>this attribute is an id attribute. + * <li><p>this attribute is a pseudo-class attribute. + * </ul> + */ + public String getLocalName() { + return localName; + } + + /** + * Returns <code>true</code> if the attribute must have an explicit value + * in the original document, <code>false</code> otherwise. + */ + public boolean getSpecified() { + return false; + } + + /** + * Returns the value of the attribute. + * If this attribute is a class or a pseudo class attribute, you'll get + * the class name (or psedo class name) without the '.' or ':'. + */ + public String getValue() { + return value; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/BeginHyphenAttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2000 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: BeginHyphenAttributeConditionImpl.java,v 1.2 2002/06/17 14:11:10 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class BeginHyphenAttributeConditionImpl implements AttributeCondition { + + String localName; + String value; + + /** + * Creates a new AttributeConditionImpl + */ + public BeginHyphenAttributeConditionImpl(String localName, String value) { + this.localName = localName; + this.value = value; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_BEGIN_HYPHEN_ATTRIBUTE_CONDITION; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this attribute condition. + * <p><code>NULL</code> if : + * <ul> + * <li>this attribute condition can match any namespace. + * <li>this attribute is an id attribute. + * </ul> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this attribute. + * <p><code>NULL</code> if : + * <ul> + * <li><p>this attribute condition can match any attribute. + * <li><p>this attribute is a class attribute. + * <li><p>this attribute is an id attribute. + * <li><p>this attribute is a pseudo-class attribute. + * </ul> + */ + public String getLocalName() { + return localName; + } + + /** + * Returns <code>true</code> if the attribute must have an explicit value + * in the original document, <code>false</code> otherwise. + */ + public boolean getSpecified() { + return false; + } + + /** + * Returns the value of the attribute. + * If this attribute is a class or a pseudo class attribute, you'll get + * the class name (or psedo class name) without the '.' or ':'. + */ + public String getValue() { + return value; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ChildSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2000 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: ChildSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.DescendantSelector; +import org.w3c.css.sac.Selector; +import org.w3c.css.sac.SimpleSelector; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class ChildSelectorImpl implements DescendantSelector { + + Selector parent; + SimpleSelector child; + + /** + * An integer indicating the type of <code>Selector</code> + */ + public short getSelectorType() { + return Selector.SAC_CHILD_SELECTOR; + } + + /** + * Creates a new ChildSelectorImpl + */ + public ChildSelectorImpl(Selector parent, SimpleSelector child) { + this.parent = parent; + this.child = child; + } + + + /** + * Returns the parent selector. + */ + public Selector getAncestorSelector() { + return parent; + } + + /* + * Returns the simple selector. + */ + public SimpleSelector getSimpleSelector() { + return child; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ClassConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2000 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: ClassConditionImpl.java,v 1.2 2002/06/17 14:10:28 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class ClassConditionImpl implements AttributeCondition { + + String value; + + /** + * Creates a new AttributeConditionImpl + */ + public ClassConditionImpl(String value) { + this.value = value; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_CLASS_CONDITION; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this attribute condition. + * <p><code>NULL</code> if : + * <ul> + * <li>this attribute condition can match any namespace. + * <li>this attribute is an id attribute. + * </ul> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this attribute. + * <p><code>NULL</code> if : + * <ul> + * <li><p>this attribute condition can match any attribute. + * <li><p>this attribute is a class attribute. + * <li><p>this attribute is an id attribute. + * <li><p>this attribute is a pseudo-class attribute. + * </ul> + */ + public String getLocalName() { + return null; + } + + /** + * Returns <code>true</code> if the attribute must have an explicit value + * in the original document, <code>false</code> otherwise. + */ + public boolean getSpecified() { + return false; + } + + /** + * Returns the value of the attribute. + * If this attribute is a class or a pseudo class attribute, you'll get + * the class name (or psedo class name) without the '.' or ':'. + */ + public String getValue() { + return value; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionFactoryImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2000 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: ConditionFactoryImpl.java,v 1.2 2002/06/17 14:12:38 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.CSSException; +import org.w3c.css.sac.Condition; +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.LangCondition; +import org.w3c.css.sac.ContentCondition; +import org.w3c.css.sac.CombinatorCondition; +import org.w3c.css.sac.PositionalCondition; +import org.w3c.css.sac.NegativeCondition; +import org.w3c.css.sac.ConditionFactory; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class ConditionFactoryImpl implements ConditionFactory { + + /** + * Creates an and condition + * + * @param first the first condition + * @param second the second condition + * @return A combinator condition + * @exception CSSException if this exception is not supported. + */ + public CombinatorCondition createAndCondition(Condition first, + Condition second) + throws CSSException { + return new AndConditionImpl(first, second); + } + + /** + * Creates an or condition + * + * @param first the first condition + * @param second the second condition + * @return A combinator condition + * @exception CSSException if this exception is not supported. + */ + public CombinatorCondition createOrCondition(Condition first, + Condition second) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates a negative condition + * + * @param condition the condition + * @return A negative condition + * @exception CSSException if this exception is not supported. + */ + public NegativeCondition createNegativeCondition(Condition condition) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + + /** + * Creates a positional condition + * + * @param position the position of the node in the list. + * @param typeNode <code>true</code> if the list should contain + * only nodes of the same type (element, text node, ...). + * @param type <code>true</code> true if the list should contain + * only nodes of the same node (for element, same localName + * and same namespaceURI). + * @return A positional condition + * @exception CSSException if this exception is not supported. + */ + public PositionalCondition createPositionalCondition(int position, + boolean typeNode, + boolean type) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * creates an attribute condition + * + * @param localName the localName of the attribute + * @param namespaceURI the namespace URI of the attribute + * @param specified <code>true</code> if the attribute must be specified + * in the document. + * @param value the value of this attribute. + * @return An attribute condition + * @exception CSSException if this exception is not supported. + */ + public AttributeCondition createAttributeCondition(String localName, + String namespaceURI, + boolean specified, + String value) + throws CSSException { + if ((namespaceURI != null) || specified) { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } else { + return new AttributeConditionImpl(localName, value); + } + } + + /** + * Creates an id condition + * + * @param value the value of the id. + * @return An Id condition + * @exception CSSException if this exception is not supported. + */ + public AttributeCondition createIdCondition(String value) + throws CSSException { + return new IdConditionImpl(value); + } + + /** + * Creates a lang condition + * + * @param value the value of the language. + * @return A lang condition + * @exception CSSException if this exception is not supported. + */ + public LangCondition createLangCondition(String lang) + throws CSSException { + return new LangConditionImpl(lang); + } + + /** + * Creates a "one of" attribute condition + * + * @param localName the localName of the attribute + * @param namespaceURI the namespace URI of the attribute + * @param specified <code>true</code> if the attribute must be specified + * in the document. + * @param value the value of this attribute. + * @return A "one of" attribute condition + * @exception CSSException if this exception is not supported. + */ + public AttributeCondition createOneOfAttributeCondition(String localName, + String namespaceURI, + boolean specified, + String value) + throws CSSException { + if ((namespaceURI != null) || specified) { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } else { + return new OneOfAttributeConditionImpl(localName, value); + } + } + + /** + * Creates a "begin hyphen" attribute condition + * + * @param localName the localName of the attribute + * @param namespaceURI the namespace URI of the attribute + * @param specified <code>true</code> if the attribute must be specified + * in the document. + * @param value the value of this attribute. + * @return A "begin hyphen" attribute condition + * @exception CSSException if this exception is not supported. + */ + public AttributeCondition createBeginHyphenAttributeCondition(String localName, + String namespaceURI, + boolean specified, + String value) + throws CSSException { + if ((namespaceURI != null) || specified) { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } else { + return new BeginHyphenAttributeConditionImpl(localName, value); + } + } + + /** + * Creates a class condition + * + * @param localName the localName of the attribute + * @param namespaceURI the namespace URI of the attribute + * @param specified <code>true</code> if the attribute must be specified + * in the document. + * @param value the name of the class. + * @return A class condition + * @exception CSSException if this exception is not supported. + */ + public AttributeCondition createClassCondition(String namespaceURI, + String value) + throws CSSException { + return new ClassConditionImpl(value); + } + + /** + * Creates a pseudo class condition + * + * @param namespaceURI the namespace URI of the attribute + * @param value the name of the pseudo class + * @return A pseudo class condition + * @exception CSSException if this exception is not supported. + */ + public AttributeCondition createPseudoClassCondition(String namespaceURI, + String value) + throws CSSException { + return new PseudoClassConditionImpl(value); + } + + /** + * Creates a "only one" child condition + * + * @return A "only one" child condition + * @exception CSSException if this exception is not supported. + */ + public Condition createOnlyChildCondition() throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates a "only one" type condition + * + * @return A "only one" type condition + * @exception CSSException if this exception is not supported. + */ + public Condition createOnlyTypeCondition() throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates a content condition + * + * @param data the data in the content + * @return A content condition + * @exception CSSException if this exception is not supported. + */ + public ContentCondition createContentCondition(String data) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ConditionalSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2000 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: ConditionalSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.ConditionalSelector; +import org.w3c.css.sac.Selector; +import org.w3c.css.sac.SimpleSelector; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.1 $ + * @author Philippe Le Hegaret + */ +public class ConditionalSelectorImpl implements ConditionalSelector { + + SimpleSelector simpleSelector; + Condition condition; + + /** + * An integer indicating the type of <code>Selector</code> + */ + public short getSelectorType() { + return Selector.SAC_CONDITIONAL_SELECTOR; + } + + + /** + * Creates a new ConditionalSelectorImpl + */ + public ConditionalSelectorImpl(SimpleSelector simpleSelector, + Condition condition) { + this.simpleSelector = simpleSelector; + this.condition = condition; + } + + + /** + * Returns the simple selector. + * <p>The simple selector can't be a <code>ConditionalSelector</code>.</p> + */ + public SimpleSelector getSimpleSelector() { + return simpleSelector; + } + + /** + * Returns the condition to be applied on the simple selector. + */ + public Condition getCondition() { + return condition; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DescendantSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2000 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: DescendantSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.DescendantSelector; +import org.w3c.css.sac.Selector; +import org.w3c.css.sac.SimpleSelector; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class DescendantSelectorImpl implements DescendantSelector { + + Selector parent; + SimpleSelector simpleSelector; + + /** + * An integer indicating the type of <code>Selector</code> + */ + public short getSelectorType() { + return Selector.SAC_DESCENDANT_SELECTOR; + } + + /** + * Creates a new DescendantSelectorImpl + */ + public DescendantSelectorImpl(Selector parent, SimpleSelector simpleSelector) { + this.parent = parent; + this.simpleSelector = simpleSelector; + } + + + /** + * Returns the parent selector. + */ + public Selector getAncestorSelector() { + return parent; + } + + /* + * Returns the simple selector. + */ + public SimpleSelector getSimpleSelector() { + return simpleSelector; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/DirectAdjacentSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2000 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: DirectAdjacentSelectorImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.SiblingSelector; +import org.w3c.css.sac.Selector; +import org.w3c.css.sac.SimpleSelector; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class DirectAdjacentSelectorImpl implements SiblingSelector { + + Selector child; + SimpleSelector directAdjacent; + + /** + * An integer indicating the type of <code>Selector</code> + */ + public short getSelectorType() { + return Selector.SAC_DIRECT_ADJACENT_SELECTOR; + } + + /** + * Creates a new DescendantSelectorImpl + */ + public DirectAdjacentSelectorImpl(Selector child, + SimpleSelector directAdjacent) { + this.child = child; + this.directAdjacent = directAdjacent; + } + + public short getNodeType() { + return 1; + } + + /** + * Returns the parent selector. + */ + public Selector getSelector() { + return child; + } + + /* + * Returns the simple selector. + */ + public SimpleSelector getSiblingSelector() { + return directAdjacent; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/ElementSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2000 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: ElementSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.ElementSelector; +import org.w3c.css.sac.Selector; + +/** + * @version $Revision: 1.1 $ + * @author Philippe Le Hegaret + */ +public class ElementSelectorImpl implements ElementSelector { + + String localName; + + /** + * Creates a new ElementSelectorImpl + */ + public ElementSelectorImpl(String localName) { + this.localName = localName; + } + + /** + * An integer indicating the type of <code>Selector</code> + */ + public short getSelectorType() { + return Selector.SAC_ELEMENT_NODE_SELECTOR; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this element selector. + * <p><code>NULL</code> if this element selector can match any namespace.</p> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this element. + * <p><code>NULL</code> if this element selector can match any element.</p> + * </ul> + */ + public String getLocalName() { + return localName; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/IdConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2000 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: IdConditionImpl.java,v 1.2 2002/06/17 14:08:28 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class IdConditionImpl implements AttributeCondition { + + String value; + + /** + * Creates a new AttributeConditionImpl + */ + public IdConditionImpl(String value) { + this.value = value; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_ID_CONDITION; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this attribute condition. + * <p><code>NULL</code> if : + * <ul> + * <li>this attribute condition can match any namespace. + * <li>this attribute is an id attribute. + * </ul> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this attribute. + * <p><code>NULL</code> if : + * <ul> + * <li><p>this attribute condition can match any attribute. + * <li><p>this attribute is a class attribute. + * <li><p>this attribute is an id attribute. + * <li><p>this attribute is a pseudo-class attribute. + * </ul> + */ + public String getLocalName() { + return null; + } + + /** + * Returns <code>true</code> if the attribute must have an explicit value + * in the original document, <code>false</code> otherwise. + */ + public boolean getSpecified() { + return false; + } + + /** + * Returns the value of the attribute. + * If this attribute is a class or a pseudo class attribute, you'll get + * the class name (or psedo class name) without the '.' or ':'. + */ + public String getValue() { + return value; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/LangConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2000 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: LangConditionImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.LangCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.1 $ + * @author Philippe Le Hegaret + */ +public class LangConditionImpl implements LangCondition { + + String lang; + + /** + * Creates a new LangConditionImpl + */ + public LangConditionImpl(String lang) { + this.lang = lang; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_LANG_CONDITION; + } + + /** + * Returns the language + */ + public String getLang() { + return lang; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/OneOfAttributeConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2000 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: OneOfAttributeConditionImpl.java,v 1.2 2002/06/17 14:09:59 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class OneOfAttributeConditionImpl implements AttributeCondition { + + String localName; + String value; + + /** + * Creates a new AttributeConditionImpl + */ + public OneOfAttributeConditionImpl(String localName, String value) { + this.localName = localName; + this.value = value; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_ONE_OF_ATTRIBUTE_CONDITION; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this attribute condition. + * <p><code>NULL</code> if : + * <ul> + * <li>this attribute condition can match any namespace. + * <li>this attribute is an id attribute. + * </ul> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this attribute. + * <p><code>NULL</code> if : + * <ul> + * <li><p>this attribute condition can match any attribute. + * <li><p>this attribute is a class attribute. + * <li><p>this attribute is an id attribute. + * <li><p>this attribute is a pseudo-class attribute. + * </ul> + */ + public String getLocalName() { + return localName; + } + + /** + * Returns <code>true</code> if the attribute must have an explicit value + * in the original document, <code>false</code> otherwise. + */ + public boolean getSpecified() { + return false; + } + + /** + * Returns the value of the attribute. + * If this attribute is a class or a pseudo class attribute, you'll get + * the class name (or psedo class name) without the '.' or ':'. + */ + public String getValue() { + return value; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoClassConditionImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2000 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: PseudoClassConditionImpl.java,v 1.2 2002/06/17 14:08:37 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.AttributeCondition; +import org.w3c.css.sac.Condition; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class PseudoClassConditionImpl implements AttributeCondition { + + String value; + + /** + * Creates a new AttributeConditionImpl + */ + public PseudoClassConditionImpl(String value) { + this.value = value; + } + + /** + * An integer indicating the type of <code>Condition</code>. + */ + public short getConditionType() { + return Condition.SAC_PSEUDO_CLASS_CONDITION; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this attribute condition. + * <p><code>NULL</code> if : + * <ul> + * <li>this attribute condition can match any namespace. + * <li>this attribute is an id attribute. + * </ul> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this attribute. + * <p><code>NULL</code> if : + * <ul> + * <li><p>this attribute condition can match any attribute. + * <li><p>this attribute is a class attribute. + * <li><p>this attribute is an id attribute. + * <li><p>this attribute is a pseudo-class attribute. + * </ul> + */ + public String getLocalName() { + return null; + } + + /** + * Returns <code>true</code> if the attribute must have an explicit value + * in the original document, <code>false</code> otherwise. + */ + public boolean getSpecified() { + return true; + } + + /** + * Returns the value of the attribute. + * If this attribute is a class or a pseudo class attribute, you'll get + * the class name (or psedo class name) without the '.' or ':'. + */ + public String getValue() { + return value; + } +} + Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/PseudoElementSelectorImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2000 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: PseudoElementSelectorImpl.java,v 1.1 2000/04/19 21:57:47 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.ElementSelector; +import org.w3c.css.sac.Selector; + +/** + * @version $Revision: 1.1 $ + * @author Philippe Le Hegaret + */ +public class PseudoElementSelectorImpl implements ElementSelector { + + String localName; + + /** + * Creates a new ElementSelectorImpl + */ + public PseudoElementSelectorImpl(String localName) { + this.localName = localName; + } + + /** + * An integer indicating the type of <code>Selector</code> + */ + public short getSelectorType() { + return Selector.SAC_PSEUDO_ELEMENT_SELECTOR; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#dt-NSName">namespace + * URI</a> of this element selector. + * <p><code>NULL</code> if this element selector can match any namespace.</p> + */ + public String getNamespaceURI() { + return null; + } + + /** + * Returns the + * <a href="http://www.w3.org/TR/REC-xml-names/#NT-LocalPart">local part</a> + * of the + * <a href="http://www.w3.org/TR/REC-xml-names/#ns-qualnames">qualified + * name</a> of this element. + * <p><code>NULL</code> if this element selector can match any element.</p> + * </ul> + */ + public String getLocalName() { + return localName; + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/parser/selectors/SelectorFactoryImpl.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2000 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: SelectorFactoryImpl.java,v 1.2 2000/07/27 21:32:26 plehegar Exp $ + */ +package org.w3c.flute.parser.selectors; + +import org.w3c.css.sac.SelectorFactory; +import org.w3c.css.sac.ConditionalSelector; +import org.w3c.css.sac.NegativeSelector; +import org.w3c.css.sac.SimpleSelector; +import org.w3c.css.sac.ElementSelector; +import org.w3c.css.sac.CharacterDataSelector; +import org.w3c.css.sac.ProcessingInstructionSelector; +import org.w3c.css.sac.SiblingSelector; +import org.w3c.css.sac.DescendantSelector; +import org.w3c.css.sac.Selector; +import org.w3c.css.sac.Condition; +import org.w3c.css.sac.CSSException; + +/** + * @version $Revision: 1.2 $ + * @author Philippe Le Hegaret + */ +public class SelectorFactoryImpl implements 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. + */ + public ConditionalSelector createConditionalSelector(SimpleSelector selector, + Condition condition) + throws CSSException { + return new ConditionalSelectorImpl(selector, condition); + } + + /** + * Creates an any node selector. + * + * @return the any node selector. + * @exception CSSException If this selector is not supported. + */ + public SimpleSelector createAnyNodeSelector() throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates an root node selector. + * + * @return the root node selector. + * @exception CSSException If this selector is not supported. + */ + public SimpleSelector createRootNodeSelector() throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates an negative selector. + * + * @param selector a selector. + * @return the negative selector. + * @exception CSSException If this selector is not supported. + */ + public NegativeSelector createNegativeSelector(SimpleSelector selector) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * 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. + */ + public ElementSelector createElementSelector(String namespaceURI, String localName) + throws CSSException { + if (namespaceURI != null) { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } else { + return new ElementSelectorImpl(localName); + } + } + + /** + * Creates a text node selector. + * + * @param data the data + * @return the text node selector + * @exception CSSException If this selector is not supported. + */ + public CharacterDataSelector createTextNodeSelector(String data) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates a cdata section node selector. + * + * @param data the data + * @return the cdata section node selector + * @exception CSSException If this selector is not supported. + */ + public CharacterDataSelector createCDataSectionSelector(String data) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * 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. + */ + public ProcessingInstructionSelector + createProcessingInstructionSelector(String target, + String data) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * Creates a comment node selector. + * + * @param data the data + * @return the comment node selector + * @exception CSSException If this selector is not supported. + */ + public CharacterDataSelector createCommentSelector(String data) + throws CSSException { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } + + /** + * 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. + */ + public ElementSelector createPseudoElementSelector(String namespaceURI, + String pseudoName) + throws CSSException { + if (namespaceURI != null) { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } else { + return new PseudoElementSelectorImpl(pseudoName); + } + } + + /** + * 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. + */ + public DescendantSelector createDescendantSelector(Selector parent, + SimpleSelector descendant) + throws CSSException { + return new DescendantSelectorImpl(parent, descendant); + } + + /** + * 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. + */ + public DescendantSelector createChildSelector(Selector parent, + SimpleSelector child) + throws CSSException { + return new ChildSelectorImpl(parent, child); + } + + /** + * Creates a direct adjacent selector. + * + * @param child the child selector + * @param adjacent the direct adjacent selector + * @return the combinator selector. + * @exception CSSException If this selector is not supported. + */ + public SiblingSelector createDirectAdjacentSelector(short nodeType, + Selector child, + SimpleSelector directAdjacent) + throws CSSException { + if (nodeType != 1) { + throw new CSSException(CSSException.SAC_NOT_SUPPORTED_ERR); + } else { + return new DirectAdjacentSelectorImpl(child, directAdjacent); + } + } + +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/Encoding.java 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,49 @@ +/* + * 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: Encoding.java,v 1.1 1999/04/02 13:23:32 plehegar Exp $ + */ +package org.w3c.flute.util; + +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; + +/** + * @version $Revision: 1.1 $ + * @author Philippe Le Hegaret + */ +public class Encoding { + private Encoding() {} + + /** + * Converts the format encoding information into Java encoding information. + */ + public static String getJavaEncoding(String encoding) { + String _result = encodings.getProperty(encoding); + if (_result == null) { + return encoding; + } + return _result; + } + + static Properties encodings; + + static { + encodings = new Properties(); + + try { + URL url = Encoding.class.getResource("encoding.properties"); + InputStream f = url.openStream(); + encodings.load(f); + f.close(); + } catch (Exception e) { + System.err.println(Encoding.class + + ": couldn't load encoding properties "); + e.printStackTrace(); + } + } +} Added: guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties =================================================================== --- guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties (rev 0) +++ guix/trunk/guix-compiler/src/main/java/org/w3c/flute/util/encoding.properties 2009-05-19 08:39:48 UTC (rev 1435) @@ -0,0 +1,92 @@ +iso-ir-6 = ASCII +ANSI_X3.4-1986 = ASCII +ISO_646.irv:1991 = ASCII +ASCII = ASCII +ISO646-US = ASCII +US-ASCII = ASCII +us = ASCII +IBM367 = ASCII +cp367 = ASCII +csASCII = ASCII + +iso-ir-100 = ISO8859_1 +ISO_8859-1:1987 = ISO8859_1 +ISO_8859-1 = ISO8859_1 +ISO-8859-1 = ISO8859_1 +latin1 = ISO8859_1 +l1 = ISO8859_1 +IBM819 = ISO8859_1 +CP819 = ISO8859_1 +csISOLatin1 = ISO8859_1 + +iso-ir-101 = ISO8859_2 +ISO_8859-2:1987 = ISO8859_2 +ISO_8859-2 = ISO8859_2 +ISO-8859-2 = ISO8859_2 +latin2 = ISO8859_2 +l2 = ISO8859_2 +csISOLatin2 = ISO8859_2 + +ISO_8859-3:1988 = ISO8859_3 +iso-ir-109 = ISO8859_3 +ISO_8859-3 = ISO8859_3 +ISO-8859-3 = ISO8859_3 +latin3 = ISO8859_3 +l3 = ISO8859_3 +csISOLatin3 = ISO8859_3 + +iso-ir-110 = ISO8859_4 +ISO_8859-4:1988 = ISO8859_4 +ISO_8859-4 = ISO8859_4 +ISO-8859-4 = ISO8859_4 +latin4 = ISO8859_4 +l4 = ISO8859_4 +csISOLatin4 = ISO8859_4 + +iso-ir-127 = ISO8859_6 +ISO_8859-6 = ISO8859_6 +ISO_8859-6:1987 = ISO8859_6 +ISO-8859-6 = ISO8859_6 +ECMA-114 = ISO8859_6 +ASMO-708 = ISO8859_6 +arabic = ISO8859_6 +csISOLatinArabic = ISO8859_6 + +iso-ir-126 = ISO8859_7 +ISO_8859-7 = ISO8859_7 +ISO_8859-7:1987 = ISO8859_7 +ISO-8859-7 = ISO8859_7 +ELOT_928 = ISO8859_7 +ECMA-118 = ISO8859_7 +greek = ISO8859_7 +greek8 = ISO8859_7 +csISOLatinGreek = ISO8859_7 + +ISO_8859-8:1988 = ISO8859_8 +iso-ir-138 = ISO8859_8 +ISO_8859-8 = ISO8859_8 +ISO-8859-8 = ISO8859_8 +hebrew = ISO8859_8 +csISOLatinHebrew = ISO8859_8 + +ISO_8859-9:1989 = ISO8859_9 +iso-ir-148 = ISO8859_9 +ISO_8859-9 = ISO8859_9 +ISO-8859-9 = ISO8859_9 +latin5 = ISO8859_9 +l5 = ISO8859_9 +csISOLatin5 = ISO8859_9 + +ISO_8859-15 = ISO8859_15_FDIS + +UTF-8 = UTF8 + +Shift_JIS = SJIS +MS_Kanji = SJIS +csShiftJIS = SJIS + +EUC-JP = EUC_JP +csEUCPkdFmtJapanese = EUC_JP +Extended_UNIX_Code_Packed_Format_for_Japanese = EUC_JP + +csBig5 = Big5
participants (1)
-
kmorin@users.labs.libre-entreprise.org