Re: Sac Parser

* 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 UTC