You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Esteban Kemp <ek...@hotmail.com> on 2003/01/29 06:19:27 UTC

New (org.apache.xerces.parsers.SAXParser)

Hi

I'm a little new in XML tecnologies and I hava installed
xerces-2_2_1 and j2sdk1.4.1 in a linux RedHat 7.1 machine I have this code 
in Java (is short):

import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.SAXException;

public class SAXParserDemo{

  public void performDemo(String uri) {
   System.out.println("Parsing XML file: "+ uri +"\n\n" );
   try{
    XMLReader parser = 
XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
    }
   catch (SAXException e){
     System.out.println(e.getMessage());
   }
  }


  public static void main (String[] args){
  if (args.length != 1){
     System.out.println("Usage...");
     System.exit(0);
   }
  String uri = args[0];
  SAXParserDemo parserDemo = new SAXParserDemo();
  parserDemo.performDemo(uri);
  }
}

but when I execute de class I get:
java SAXPArserDemo content.xml

SAX2 driver class org.apache.xerces.parsers.SAXParser not Found...

I understend the error, but I dont know how can i fix it....

Thx...


_________________________________________________________________



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org


Re: New (org.apache.xerces.parsers.SAXParser)

Posted by Andy Clark <an...@apache.org>.
Esteban Kemp wrote:
>   try{
>    XMLReader parser = 
> XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
>    }
>   catch (SAXException e){
>     System.out.println(e.getMessage());
>   }

Your code doesn't seem to parse anything -- it just
creates a parser instance. But I'm supposing that
you will be adding that code once you get past your
initial problem running the program, right?

> java SAXPArserDemo content.xml
> 
> SAX2 driver class org.apache.xerces.parsers.SAXParser not Found...

Is this your exact command-line? If so, then I would
say that your classpath doesn't state where to find
the Xerces classes. Do this instead: (on one line)

   java -cp .;xercesImpl.jar;xmlParserAPIs.jar
        SAXParserDemo
        content.xml

-- 
Andy Clark * andyc@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org