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 |
Rajesh Kumar 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 |
Rajesh Kumar 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 |
Ed Merks 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 |
Rajesh Kumar 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
>>>
>
>
|
|
|
Goto Forum:
Current Time: Thu Apr 25 15:20:45 GMT 2024
Powered by FUDForum. Page generated in 0.02649 seconds
|