Hello all, this is my first mailing to the list. I hope it hasn't been
covered in the past, but I searched the archives and could find nothing.

We're using Batik's CSS capabilities, and none of its other features - it's
very nice that you can compile just the jars necessary for CSS and use
those.

When parsing a stylesheet, I'm finding that Batik's parser seems to not
notice any @import rule past the first one. Below is a sample program that
illustrates this problem. Expected output would be "1.css\n2.css\n3.css",
however I am simply getting "1.css"

I am running windows 2000, with JDK 1.3.

Can anyone shed some light on this problem? Is there just something wrong
with my tester (and our production code, which is hitting the same problem)?
Please note that I'm aware that StringBufferInputStream is deprecated,
however, working from FileInputStreams produces the same results. Thanks in
advance!



import org.apache.batik.css.parser.Parser;

import org.w3c.css.sac.*;

import java.io.StringBufferInputStream;
import java.io.InputStreamReader;
import java.io.IOException;

public class BatikErrorTest implements DocumentHandler
{
    public void importStyle(java.lang.String uri, SACMediaList media,
java.lang.String defaultNamespaceURI)
    {
        System.out.println( uri );
    }

    public static void main( String[] args )
    {
        BatikErrorTest tester = new BatikErrorTest();
        Parser parser = new Parser();
        parser.setDocumentHandler(tester);
        String styleSheet = "@import \"1.css\"; @import \"2.css\"; @import
\"3.css\"; H1 {text-align:center}";
        StringBufferInputStream is = 
            new StringBufferInputStream( styleSheet );
        InputStreamReader r = new InputStreamReader(is);
        InputSource source = new InputSource(r);
        try
        {
            parser.parseStyleSheet( source );
        }
        catch (IOException e)
        {
            System.out.println( "encountered error parsing style sheet: " +
e );
        }
    }

    public void comment(java.lang.String text){} 
    public void endDocument(InputSource source){} 
    public void endFontFace() {}
    public void endMedia(SACMediaList media) {}
    public void endPage(java.lang.String name, java.lang.String pseudo_page)
{}
    public void endSelector(SelectorList selectors) {}
    public void ignorableAtRule(java.lang.String atRule) {}
    public void namespaceDeclaration(java.lang.String prefix,
java.lang.String uri) {}
    public void property(java.lang.String name, LexicalUnit value, boolean
important) {}
    public void startDocument(InputSource source) {}
    public void startFontFace() {}
    public void startMedia(SACMediaList media) {}
    public void startPage(java.lang.String name, java.lang.String
pseudo_page) {}
    public void startSelector(SelectorList selectors) {}
}    
-- 
Mark Ashton

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to