W3C home > Mailing lists > Public > www-style@w3.org > November 2002

Re: Sac Parser

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 05 Nov 2002 21:34:00 +0100
To: Gonzalo Vazquez <gonzalovp6@yahoo.es>
Cc: www-style@w3.org
Message-ID: <3dd12a09.15684433@smtp.bjoern.hoehrmann.de>

* Gonzalo Vazquez wrote:
> I' m a student from Spain that must use SAC parser,
>to parse an CSS StyleSheet. 
>
> I' m download sac 1.3 from
>http://www.w3.org/Style/CSS/SAC/ in section Java
>Implementation. 
> 
> when I unzip the files, i found a sac.jar , a
>stylesheet.css and a Manifest.mf files, beetween
>others. 
>  
>  So i tried to use. 
>
> I write the command java -jar sac.jar and it tell me 
>
> Failed to load Main-class manifest attribute from
>sac.jar.
>
> What i'm doing wrong. 

SAC is an interface package, it does not contain an application, an
implementation or CSS parser. You need to write the application, the
implementation of the SAC interface yourself. The SAC note contains such
example, see

  http://www.w3.org/TR/SAC/DemoSAC.java

I won't gurantee this sample does not have errors, I was unable to get
it running without modifications. I added

  import org.w3c.css.sac.helpers.*;
  import java.io.*;

as import declarations, 

  System.setProperty("org.w3c.css.sac.parser",
                     "org.w3c.flute.parser.Parser");

in main(...) to advice the package to use the Flute parser for CSS
parsing (flute is available from the SAC homepage) and added
implementations for the unimplemented interface, like

    public void startDocument(InputSource s) throws CSSException {}
    public void endDocument(InputSource s) throws CSSException {}
    public void comment(String s) throws CSSException {}
    public void ignorableAtRule(String s) throws CSSException {}
    public void namespaceDeclaration(String prefix, String uri)
      throws CSSException {}
    public void importStyle(String s, SACMediaList l, String s2)
      throws CSSException {}
    public void startPage(String s, String s2) throws CSSException {}
    public void endPage(String s, String s2) throws CSSException {}
    public void startFontFace() throws CSSException {}
    public void endFontFace() throws CSSException {}

Then you need to compile the application using `javac` and run it. Don't
forget to add sac.jar and flute.jar to your classpath.

HTH.
Received on Tuesday, 5 November 2002 15:33:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:17 GMT