sudhakar_koundinya
asked on
javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
import javax.xml.*;
import javax.xml.namespace.*;
import javax.xml.stream.*;
import javax.xml.stream.events.*;
import javax.xml.stream.util.*;
import java.util.*;
import java.io.*;
class StaxExample1
{
public static void main(String[] args)
throws FileNotFoundException, XMLStreamException {
// Use the reference implementation for the XML input factory
System.setProperty("javax. xml.stream .XMLInputF actory",
"com.bea.xml.stream.MXPars erFactory" );
// Create the XML input factory
XMLInputFactory factory = XMLInputFactory.newInstanc e();
// Create the XML event reader
FileReader reader = new FileReader(args[0]);
XMLEventReader r =
factory.createXMLEventRead er(reader) ;
// Loop over XML input stream and process events
while(r.hasNext()) {
XMLEvent e = (XMLEvent)r.next();
processEvent(e);
}
}
/**
* Process a single XML event
* @param e - the event to be processed
*/
private static void processEvent(XMLEvent e) {
if (e.isStartElement()) {
QName qname = ((StartElement) e).getName();
String namespaceURI = qname.getNamespaceURI();
String localName = qname.getLocalPart();
Iterator iter = ((StartElement) e).getAttributes();
while (iter.hasNext()) {
Attribute attr = (Attribute) iter.next();
QName attributeName = attr.getName();
String attributeValue = attr.getValue();
}
}
if (e.isEndElement()) {
QName qname = ((EndElement) e).getName();
}
if (e.isCharacters()) {
String text = ((Characters) e).getData();
}
if (e.isStartDocument()) {
String version = ((StartDocument) e).getVersion();
String encoding = ((StartDocument) e).getCharacterEncodingSch eme();
boolean isStandAlone = ((StartDocument) e).isStandalone();
}
}
}
Here is an exception
Exception in thread "main" javax.xml.stream.FactoryCo nfiguratio nError: Provider
com.bea.xml.stream.MXParse rFactory not found
at javax.xml.stream.FactoryFi nder.newIn stance(Fac toryFinder .java:72)
at javax.xml.stream.FactoryFi nder.find( FactoryFin der.java:1 20)
at javax.xml.stream.FactoryFi nder.find( FactoryFin der.java:9 2)
at javax.xml.stream.XMLInputF actory.new Instance(X MLInputFac tory.java: 136)
at StaxExample1.main(StaxExam ple1.java: 22)
Please help me to resolve this problem
Thanks
Sudhakar
import javax.xml.namespace.*;
import javax.xml.stream.*;
import javax.xml.stream.events.*;
import javax.xml.stream.util.*;
import java.util.*;
import java.io.*;
class StaxExample1
{
public static void main(String[] args)
throws FileNotFoundException, XMLStreamException {
// Use the reference implementation for the XML input factory
System.setProperty("javax.
"com.bea.xml.stream.MXPars
// Create the XML input factory
XMLInputFactory factory = XMLInputFactory.newInstanc
// Create the XML event reader
FileReader reader = new FileReader(args[0]);
XMLEventReader r =
factory.createXMLEventRead
// Loop over XML input stream and process events
while(r.hasNext()) {
XMLEvent e = (XMLEvent)r.next();
processEvent(e);
}
}
/**
* Process a single XML event
* @param e - the event to be processed
*/
private static void processEvent(XMLEvent e) {
if (e.isStartElement()) {
QName qname = ((StartElement) e).getName();
String namespaceURI = qname.getNamespaceURI();
String localName = qname.getLocalPart();
Iterator iter = ((StartElement) e).getAttributes();
while (iter.hasNext()) {
Attribute attr = (Attribute) iter.next();
QName attributeName = attr.getName();
String attributeValue = attr.getValue();
}
}
if (e.isEndElement()) {
QName qname = ((EndElement) e).getName();
}
if (e.isCharacters()) {
String text = ((Characters) e).getData();
}
if (e.isStartDocument()) {
String version = ((StartDocument) e).getVersion();
String encoding = ((StartDocument) e).getCharacterEncodingSch
boolean isStandAlone = ((StartDocument) e).isStandalone();
}
}
}
Here is an exception
Exception in thread "main" javax.xml.stream.FactoryCo
com.bea.xml.stream.MXParse
at javax.xml.stream.FactoryFi
at javax.xml.stream.FactoryFi
at javax.xml.stream.FactoryFi
at javax.xml.stream.XMLInputF
at StaxExample1.main(StaxExam
Please help me to resolve this problem
Thanks
Sudhakar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
did u take a lock at this:
http://forums.bea.com/bea/thread.jspa?threadID=200024334&messageID=202415598&start=0
http://forums.bea.com/bea/thread.jspa?threadID=200024334&messageID=202415598&start=0
it is a jar called xbean.jar, I found this jar on my hard disk
ASKER
thanks I am able to resolve the issue
BTW,
will you have a glance on this link too
https://www.experts-exchange.com/questions/21191121/Stax-Parser.html#12470383
BTW,
will you have a glance on this link too
https://www.experts-exchange.com/questions/21191121/Stax-Parser.html#12470383
ASKER
ASKER
http://www.google.co.in/search?hl=en&q=com.bea.xml.stream.MXParserFactory+not+found&btnG=Search&meta=