xml parsing - java.net.MalformedURLException: no protocol with javax.xml.stream.XMLStreamException while using JAXB -


i using jaxb unmarshal xml document. while parsing xml throwing malformedurlexception wrapped xmlstreamexception. understand while creating xmlstreamreader object throwing exception. suggestions please?

the code snippet using:

    xmlinputfactory xif = xmlinputfactory.newfactory();           xmlresolver resolver = new xmlresolver(); //to capture systemid, base uri etc.     xif.setxmlresolver(resolver);      //throws malformedurlexception  while processing below line     xmlstreamreader xsr = xif.createxmlstreamreader(new streamsource(filetoprocess));      jaxbcontext jaxbcontext = jaxbcontext.newinstance(mypackage.myclassname.class); 

here exception trace:

     class javax.xml.stream.xmlstreamexception      javax.xml.stream.xmlstreamexception: java.net.malformedurlexception: no protocol:       [xml_filepath/xml_file_name] 

filetoprocess string contains absolute path, /home/project/input/myproject.xml

run time jdk 1.7. signature/protocol missing?

thanks, bhaskar

try this:

xmlstreamreader streamreader = factory.createxmlstreamreader( new filereader("data\\test.xml")); 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -