Pregunta

I just learned to write parser.I need a quick help.I have tried searchign for the same but was not of much help.

I have written all the callback methods.Now i am writing the private static main method to call the parser.

    SAXParserFactory parserFactor = SAXParserFactory.newInstance();
    SAXParser parser = parserFactor.newSAXParser();
    SAXParserExample handler = new SAXParserExample();`

parser.parse(new File(args[0]), handler);

Now my xml name is Employees.xml and i have a class also Employee.java

When i am runing this i am getting this error.I guess i need to send the xml file as argument.

Exception in thread "main" java.lang.RuntimeException: The name of the XML file is required! at main.java.SAXParserExample.main(SAXParserExample.java:82)

¿Fue útil?

Solución

You can try this

java Classname Filename.txt

Hope it works.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top