Hi all,

I had a problem running gnujaxp transformation with sablevm, jamvm (but
I don't know their mailing list) and gij. I did succeed with kaffe.

Chris investigate a little more and it seems the problem is when native
code is called (libxml or libxsl).

Here is an example.

NOTE: I post this mail on several mailing lists but only reply on your
      own one, thanks.

--- Begin Message --- Arnaud Vandyck wrote:
Can I forward this mail to the gcj dev mailing list?

Sure. I attach a simple test case which uses the libxmlj SAX parser to parse an XML file given on argv. Using java=gij, I get the following:

# ./saxtest test.xml
>> Parsing test.xml
Exception in thread "main" java.lang.UnsatisfiedLinkError: parseStream
<<No stacktrace available>>
Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: freeLibxsltGlobal
<<No stacktrace available>>

# gij --version
gij (GNU libgcj) version 3.4.2

Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# uname -a
Darwin bobtail.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug 5 19:26:16 PDT2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC Power Macintosh powerpc

Using the Apple-supplied java, the program behaves as expected.
--
Chris Burdess

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;

public class saxtest extends DefaultHandler
{

  Locator locator;

  public void setDocumentLocator(Locator l)
    {
      locator = l;
    }

  public void startDocument()
    {
      msg("startDocument");
    }

  public void endDocument()
    {
      msg("endDocument");
    }

  public void startElement(String uri, String localName, String qname,
                           Attributes atts)
    {
      if (uri == null)
        msg("startElement "+qname);
      else
        msg("startElementNS "+uri+" "+localName);
      int len = atts.getLength();
      for (int i = 0; i < len; i++)
        {
          String attrUri = atts.getURI(i);
          if (attrUri == null)
            System.out.println("\tattribute "+atts.getQName(i)+" = "+atts.getValue(i));
          else
            System.out.println("\tattributeNS "+attrUri+" "+
                               atts.getLocalName(i)+" = "+atts.getValue(i));
        }
    }

  public void endElement(String uri, String localName, String qname)
    {
      if (uri == null)
        msg("endElement "+qname);
      else
        msg("endElementNS "+uri+" "+localName);
    }

  public void characters(char[] ch, int start, int len)
    {
      msg("characters: "+new String(ch, start, len));
    }

  public void warning(SAXParseException e)
    {
      msg("WARNING: "+e.getMessage());
    }

  public void error(SAXParseException e)
    {
      msg("ERROR: "+e.getMessage());
    }

  public void fatalError(SAXParseException e)
    {
      msg("FATAL ERROR: "+e.getMessage());
    }

  public InputSource resolveEntity (String publicId, String systemId)
    throws IOException
    {
      msg("resolveEntity: "+systemId);
      try
        {
          URL url = new URL (systemId);
          return new InputSource (url.openStream ());
        }
      catch (MalformedURLException e)
        {
          File file = new File (systemId);
          if (!file.exists ())
            {
              return null;
            }
          InputStream in = new FileInputStream (file);
          return new InputSource (in);
        }
    }

  void msg (String message)
    {
      if (locator != null)
        {
          String systemId = locator.getSystemId ();
          if (systemId != null)
            {
              int ls = systemId.lastIndexOf ('/');
              if (ls != -1)
                {
                  systemId = systemId.substring (ls + 1);
                }
              System.out.print (systemId + ':');
            }
          System.out.print (locator.getLineNumber ());
          int col = locator.getColumnNumber ();
          if (col != -1)
            {
              System.out.print ("," + col);
            }
          System.out.print (":");
        }
      System.out.println(message);
    }

  public static void main (String[] args)
    {
      saxtest test = new saxtest ();
      try
        {
          SAXParserFactory factory = SAXParserFactory.newInstance ();
          factory.setValidating (true);
          SAXParser parser = factory.newSAXParser ();
          XMLReader reader = parser.getXMLReader ();
          reader.setContentHandler (test);
          reader.setErrorHandler (test);
          reader.setEntityResolver (test);
          for (int i = 0; i < args.length; i++)
            {
              System.out.println (">> Parsing " + args[i]);
              reader.parse (args[i]);
            }
        }
      catch (Exception e)
        {
          e.printStackTrace ();
        }
    }

}

Attachment: saxtest
Description: Binary data


--- End Message ---

-- 
Arnaud Vandyck
http://fosdem.org/
Free and Open Source Developers' European Meeting
February 26-27 2005,
Bruxelles, Belgium
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/classpath

Reply via email to