Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » reading in XML file in generated editor
reading in XML file in generated editor [message #380908] Wed, 10 December 2003 18:37 Go to next message
Rajesh Kumar is currently offline Rajesh KumarFriend
Messages: 17
Registered: July 2009
Junior Member
I wrote an parser class inside the generated XEditor.java file and tried
to instantiate it in the XEditor() method (to call the parser when the
editor is being initialized)

However when I know run the plugin it gives an error saying
"Exception creating editor: Unable to instantiate editor:
verify.presentation.VerifyEditorID java.lang.NoClassDefFoundError:
org/xml/sax/HandlerBase"

My guess is that this is a classpath problem somewhere.

I had written the XML parser class inside the XEditor.java file
extending "HandlerBase" as follows (I had also added "import
org.xml.sax.AttributeList;
import org.xml.sax.HandlerBase;
import org.xml.sax.Parser;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.ParserFactory;
import org.xml.sax.XMLReader;
import org.apache.xerces.parsers.SAXParser;
import java.io.*;" at the top of the file)

class ParseProj extends HandlerBase
{

public ParseProj(String fileName)
{
try
{
Parser myParser = new SAXParser();
myParser.setDocumentHandler(this);
myParser.parse(fileName);
}
catch(Exception e)
{
System.out.println("Exc " + e);
}

}//end of constru


public void startDocument()
{
} // startDocument()

public void endDocument()
{
} // endDocument()

public void startElement(String name, AttributeList attrs)
{
} // startElement(String,AttributeList)

public void endElement(String name)
{
} // endElement(String)

public void characters(char ch[], int start, int length)
{
} // characters(char[],int,int);

public void processingInstruction(String target, String data)
{
} // processingInstruction(String,String)

public void ignorableWhitespace(char ch[], int start, int length)
{
} // ignorableWhitespace(char[],int,int);

}//end of ParseProj
Re: reading in XML file in generated editor [message #380909 is a reply to message #380908] Wed, 10 December 2003 18:43 Go to previous messageGo to next message
Rajesh Kumar is currently offline Rajesh KumarFriend
Messages: 17
Registered: July 2009
Junior Member
I am running Eclipse 2.1 with EMF 1.2.1. The code which I added in the
XEditor.java method was
try{
System.out.println("calling the parser");
ParseProj pux = new ParseProj("proj.svm");
}catch(Exception e){
System.out.println(e.toString());
}

Rajesh Kumar wrote:

> I wrote an parser class inside the generated XEditor.java file and tried
> to instantiate it in the XEditor() method (to call the parser when the
> editor is being initialized)
>
> However when I know run the plugin it gives an error saying
> "Exception creating editor: Unable to instantiate editor:
> verify.presentation.VerifyEditorID java.lang.NoClassDefFoundError:
> org/xml/sax/HandlerBase"
>
> My guess is that this is a classpath problem somewhere.
>
> I had written the XML parser class inside the XEditor.java file
> extending "HandlerBase" as follows (I had also added "import
> org.xml.sax.AttributeList;
> import org.xml.sax.HandlerBase;
> import org.xml.sax.Parser;
> import org.xml.sax.SAXException;
> import org.xml.sax.SAXParseException;
> import org.xml.sax.helpers.ParserFactory;
> import org.xml.sax.XMLReader;
> import org.apache.xerces.parsers.SAXParser;
> import java.io.*;" at the top of the file)
>
> class ParseProj extends HandlerBase
> {
>
> public ParseProj(String fileName)
> {
> try
> {
> Parser myParser = new SAXParser();
> myParser.setDocumentHandler(this);
> myParser.parse(fileName);
> }
> catch(Exception e)
> {
> System.out.println("Exc " + e);
> }
>
> }//end of constru
>
>
> public void startDocument()
> {
> } // startDocument()
>
> public void endDocument()
> {
> } // endDocument()
>
> public void startElement(String name, AttributeList attrs)
> {
> } // startElement(String,AttributeList)
>
> public void endElement(String name)
> {
> } // endElement(String)
>
> public void characters(char ch[], int start, int length)
> {
> } // characters(char[],int,int);
>
> public void processingInstruction(String target, String data)
> {
> } // processingInstruction(String,String)
>
> public void ignorableWhitespace(char ch[], int start, int length)
> {
> } // ignorableWhitespace(char[],int,int);
>
> }//end of ParseProj
>
Re: reading in XML file in generated editor [message #380910 is a reply to message #380909] Wed, 10 December 2003 19:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Rajesh,

You'll need to add org.apache.xerces to your plugin.xml.


Rajesh Kumar wrote:

> I am running Eclipse 2.1 with EMF 1.2.1. The code which I added in the
> XEditor.java method was
> try{
> System.out.println("calling the parser");
> ParseProj pux = new ParseProj("proj.svm");
> }catch(Exception e){
> System.out.println(e.toString());
> }
>
> Rajesh Kumar wrote:
>
> > I wrote an parser class inside the generated XEditor.java file and tried
> > to instantiate it in the XEditor() method (to call the parser when the
> > editor is being initialized)
> >
> > However when I know run the plugin it gives an error saying
> > "Exception creating editor: Unable to instantiate editor:
> > verify.presentation.VerifyEditorID java.lang.NoClassDefFoundError:
> > org/xml/sax/HandlerBase"
> >
> > My guess is that this is a classpath problem somewhere.
> >
> > I had written the XML parser class inside the XEditor.java file
> > extending "HandlerBase" as follows (I had also added "import
> > org.xml.sax.AttributeList;
> > import org.xml.sax.HandlerBase;
> > import org.xml.sax.Parser;
> > import org.xml.sax.SAXException;
> > import org.xml.sax.SAXParseException;
> > import org.xml.sax.helpers.ParserFactory;
> > import org.xml.sax.XMLReader;
> > import org.apache.xerces.parsers.SAXParser;
> > import java.io.*;" at the top of the file)
> >
> > class ParseProj extends HandlerBase
> > {
> >
> > public ParseProj(String fileName)
> > {
> > try
> > {
> > Parser myParser = new SAXParser();
> > myParser.setDocumentHandler(this);
> > myParser.parse(fileName);
> > }
> > catch(Exception e)
> > {
> > System.out.println("Exc " + e);
> > }
> >
> > }//end of constru
> >
> >
> > public void startDocument()
> > {
> > } // startDocument()
> >
> > public void endDocument()
> > {
> > } // endDocument()
> >
> > public void startElement(String name, AttributeList attrs)
> > {
> > } // startElement(String,AttributeList)
> >
> > public void endElement(String name)
> > {
> > } // endElement(String)
> >
> > public void characters(char ch[], int start, int length)
> > {
> > } // characters(char[],int,int);
> >
> > public void processingInstruction(String target, String data)
> > {
> > } // processingInstruction(String,String)
> >
> > public void ignorableWhitespace(char ch[], int start, int length)
> > {
> > } // ignorableWhitespace(char[],int,int);
> >
> > }//end of ParseProj
> >


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: reading in XML file in generated editor [message #380914 is a reply to message #380910] Thu, 11 December 2003 04:31 Go to previous message
Rajesh Kumar is currently offline Rajesh KumarFriend
Messages: 17
Registered: July 2009
Junior Member
Thanks for the quick response!

Ed Merks wrote:

> Rajesh,
>
> You'll need to add org.apache.xerces to your plugin.xml.
>
>
> Rajesh Kumar wrote:
>
>
>>I am running Eclipse 2.1 with EMF 1.2.1. The code which I added in the
>>XEditor.java method was
>> try{
>> System.out.println("calling the parser");
>> ParseProj pux = new ParseProj("proj.svm");
>> }catch(Exception e){
>> System.out.println(e.toString());
>> }
>>
>>Rajesh Kumar wrote:
>>
>>
>>>I wrote an parser class inside the generated XEditor.java file and tried
>>>to instantiate it in the XEditor() method (to call the parser when the
>>>editor is being initialized)
>>>
>>>However when I know run the plugin it gives an error saying
>>>"Exception creating editor: Unable to instantiate editor:
>>>verify.presentation.VerifyEditorID java.lang.NoClassDefFoundError:
>>>org/xml/sax/HandlerBase"
>>>
>>>My guess is that this is a classpath problem somewhere.
>>>
>>>I had written the XML parser class inside the XEditor.java file
>>>extending "HandlerBase" as follows (I had also added "import
>>>org.xml.sax.AttributeList;
>>>import org.xml.sax.HandlerBase;
>>>import org.xml.sax.Parser;
>>>import org.xml.sax.SAXException;
>>>import org.xml.sax.SAXParseException;
>>>import org.xml.sax.helpers.ParserFactory;
>>>import org.xml.sax.XMLReader;
>>>import org.apache.xerces.parsers.SAXParser;
>>>import java.io.*;" at the top of the file)
>>>
>>>class ParseProj extends HandlerBase
>>>{
>>>
>>> public ParseProj(String fileName)
>>> {
>>> try
>>> {
>>> Parser myParser = new SAXParser();
>>> myParser.setDocumentHandler(this);
>>> myParser.parse(fileName);
>>> }
>>> catch(Exception e)
>>> {
>>> System.out.println("Exc " + e);
>>> }
>>>
>>> }//end of constru
>>>
>>>
>>> public void startDocument()
>>> {
>>> } // startDocument()
>>>
>>> public void endDocument()
>>> {
>>> } // endDocument()
>>>
>>> public void startElement(String name, AttributeList attrs)
>>> {
>>> } // startElement(String,AttributeList)
>>>
>>> public void endElement(String name)
>>> {
>>> } // endElement(String)
>>>
>>> public void characters(char ch[], int start, int length)
>>> {
>>> } // characters(char[],int,int);
>>>
>>> public void processingInstruction(String target, String data)
>>> {
>>> } // processingInstruction(String,String)
>>>
>>> public void ignorableWhitespace(char ch[], int start, int length)
>>> {
>>> } // ignorableWhitespace(char[],int,int);
>>>
>>>}//end of ParseProj
>>>
>
>
Previous Topic:Can I increase productivity for App Dev in my environment?
Next Topic:How to create a Model for an especific language?
Goto Forum:
  


Current Time: Thu Apr 25 15:20:45 GMT 2024

Powered by FUDForum. Page generated in 0.02649 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top