Hi Martin.
Martin Zdila:
> found third CSS issue:
>
> DIV {
> background-image: URL('someurl');
> }
>
> is parsed as:
>
> DIV {
> background-image: someurl;
> }
I just tried a short test program (attached) that parses the above
stylesheet, and it does get parsed as an actual url() value. The output
of running the program is:
Property 'background-image' has value 'someurl', which is of type 24.
(LexicalUnit.SAC_URI == 24)
Note that LexicalUnit.getStringValue() strips off the "url(" and ")":
http://www.w3.org/Style/CSS/SAC/doc/org/w3c/css/sac/LexicalUnit.html#getStringValue__
--
Cameron McCormack ≝ http://mcc.id.au/
import org.w3c.css.sac.ConditionFactory;
import org.w3c.css.sac.InputSource;
import org.w3c.css.sac.SelectorFactory;
import org.w3c.css.sac.LexicalUnit;
import org.apache.batik.css.engine.sac.CSSConditionFactory;
import org.apache.batik.css.engine.sac.CSSSelectorFactory;
import org.apache.batik.css.parser.DefaultDocumentHandler;
import org.apache.batik.css.parser.Parser;
import java.io.StringReader;
public class Test extends DefaultDocumentHandler {
public static void main(String[] args) {
new Test().test();
}
public void test() {
String stylesheet = "DIV { background-image: URL('someurl'); }";
Parser p = new Parser();
p.setSelectorFactory(CSSSelectorFactory.INSTANCE);
p.setConditionFactory(new CSSConditionFactory(null, "class", null, "id"));
p.setDocumentHandler(this);
try {
p.parseStyleSheet(new InputSource(new StringReader(stylesheet)));
} catch (Exception e) {
e.printStackTrace();
}
}
public void property(String name, LexicalUnit value, boolean important) {
System.out.println("Property '" + name + "' has value '" + value.getStringValue() + "', which is of type " + value.getLexicalUnitType() + ".");
System.out.println("(LexicalUnit.SAC_URI == " + LexicalUnit.SAC_URI + ")");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]