Get an error when reading XML?

When I try to read from a XML file like this:
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document m_doc = docBuilder.parse("formular/faktura.xml"); // this is where I get error
..................................I get this error:
java.net.MalformedURLException: no protocol: formular/faktura.xml
at java.net.URL.<init>(URL.java:537)
at java.net.URL.<init>(URL.java:434)
at java.net.URL.<init>(URL.java:383)
at gnu.xml.aelfred2.XmlParser.pushURL(XmlParser.java:3414)
at gnu.xml.aelfred2.XmlParser.doParse(XmlParser.java:159)
at gnu.xml.aelfred2.SAXDriver.parse(SAXDriver.java:320)
at gnu.xml.aelfred2.XmlReader.parse(XmlReader.java:294)
at gnu.xml.dom.JAXPFactory$JAXPBuilder.parse(JAXPFactory.java:186)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at dk.aslani.layout.funktion.IndlaesXML.<init>(IndlaesXML.java:38)
at dk.aslani.layout.gui.LayoutShow.<init>(LayoutShow.java:30)
at dk.aslani.bilag.gui.OpretFaktura.actionPerformed(OpretFaktura.java:1707)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:289)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1113)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(BasicMenuItemUI.java:943)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Container.processEvent(Container.java:1569)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Container.dispatchEventImpl(Container.java:1627)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
at java.awt.Container.dispatchEventImpl(Container.java:1613)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Does anyone know this error ?
Some of my XML file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<Faktura>
<felt>
     <navn>Faktura</navn>
     <aktiv>1</aktiv>
     <tabel/>
     <kolonne/>
     <id/>
     <etiket>Faktura</etiket>
     <fontNavn>Arial</fontNavn>
     <fontStr>22</fontStr>
     <fontFed>1</fontFed>
     <fontKur>0</fontKur>
     <fontUnd>0</fontUnd>
     <posX>39.0</posX>
     <posY>248.0</posY>
</felt>
<felt>
     <navn>Firma navn</navn>
     <aktiv>1</aktiv>
     <tabel>FIRMAOPL</tabel>
     <kolonne>NAVN</kolonne>
     <id>1</id>
     <etiket/>
     <fontNavn>Times New Roman</fontNavn>
     <fontStr>64</fontStr>
     <fontFed>1</fontFed>
     <fontKur>0</fontKur>
     <fontUnd>0</fontUnd>
     <posX>45.0</posX>
     <posY>47.0</posY>
</felt>
....................................

Thx dubwai
How is file:// prefix on URL used ? Am not sure what
U mean?The String version of the parse method is expecting a URL. What you are passing it is not a valid URL. You need to define the protocol. For example, a URL you use in your browser is http, you need to use file: because the document resides on a file system. You can use file in your browser.
I think you'll fnd it easier to just use the parse(File) method.

Similar Messages

  • I am getting an error when reading the preview cache and the program shuts down.

    I had to reload Lightroom on a new computer and after I did that it gives me an error when reading from its preview cache and then it shuts the program down.  How can I fix this problem?

    Delete the preview cache ... it is a folder whose name ends with Previews.LRDATA in the same folder as your catalog file.

  • Getting error when reading xml file from a remote connection

    Hi all,
    I want to read an xml file from a remote connection, not from my local machine.So when i am creating the data server i am giving the host name(that is the ip of the machine where the xml file is located), giving the proper username and password and giving the path of the xml file. When i am testing the connection the error that is coming:- "Connection failed and the xml file could not be created, verify that you have write permission in the directory"...
    but read write and execute permissions have been given on the directory as well as to the file...
    Regards,
    Sourav

    Hi Sutirtha,
    Initially I have started the agent.sh giving the agent name <agent name>and port number 20910 and defined it in the topology manager it is showing that the agent test is succesful. Then I tested a particular Data server against that agent and the test was successful.
    After this we had stopped the agent and restarted it.
    However now suddenly the testing against the remote agent is failing with the following excep:
    java.lang.Exception:
         at com.sunopsis.graphical.l.pm.a(pm.java)
         at com.sunopsis.graphical.l.pm.s(pm.java)
         at com.sunopsis.graphical.l.pm.g(pm.java)
         at com.sunopsis.graphical.l.pm.a(pm.java)
         at com.sunopsis.graphical.l.pm.a(pm.java)
         at com.sunopsis.graphical.l.iz.actionPerformed(iz.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.Dialog$1.run(Unknown Source)
         at java.awt.Dialog.show(Unknown Source)
         at java.awt.Component.show(Unknown Source)
         at java.awt.Component.setVisible(Unknown Source)
         at com.sunopsis.graphical.l.pm.q(pm.java)
         at com.sunopsis.graphical.l.pm.<init>(pm.java)
         at com.sunopsis.graphical.frame.b.jh.bx(jh.java)
         at com.sunopsis.graphical.frame.bo.w(bo.java)
         at com.sunopsis.graphical.frame.bo.d(bo.java)
         at com.sunopsis.graphical.frame.w.actionPerformed(w.java)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    PS: do i have to modify any file after or before starting the odi agent
    Thnks and Rgds,
    Sourav
    Edited by: user13263578 on Mar 15, 2011 9:35 PM
    Edited by: user13263578 on Mar 15, 2011 9:48 PM

  • I'm unable to open up Lightroom 5, I get this message in a pop up box: "Lightroom encountered an error when reading from it's preview cache and needs to quit" Underneath  that is "Lightroom will attempt to fix this problem the next time when it launches."

    I'm unable to open up Lightroom 5, I get this message in a pop up box: "Lightroom encountered an error when reading from it's preview cache and needs to quit" Underneath  that is "Lightroom will attempt to fix this problem the next time when it launches."  It hasn't, what should I do? Thanks Shawn (Irish Se7en) .

    Can you try to rename (not delete!) the folder named "YOUR_CATALOG_NAME Previews.lrdata" and restart Lightroom?

  • Upgraded to 5.4 when opening lightroom get a message "encountered an error when reading from its preview cache and need to quite" tried this several time but get the same eror message

    Upgraded to 5.4 when opening lightroom get a message "encountered an error when reading from its preview cache and need to quite" tried this several time but get the same error message.  Says Lightroom will attempt to fix the problem the next time it launches but that is not happening.  How do it fix this?

    Delete the preview cache using your operating system. It is a folder whose name ends with Previews.LRDATA. Do not delete the Lightroom catalog, which ends with .LRCAT

  • Lightroom encountered an error when reading from its preview cache and needs to quit.  Says Lightromm will attempt to fix the problem the next time it launches, but on every re-launch I get the same message.  Any clue as to how to fix this problem?

    I recently updated my HP laptop's OS from WIndows8 to WIndows8.1.  When I went attempted to open Lightroom5 I got the following message:
    "Lightroom encountered an error when reading from its preview cache and needs to quit. "
    "Lightroom will attempt to fix the problem the next time it launches"
    Every time I relaunch I  get the same message.  I'd like to understand what might be causing the problem so I can remedy and get back to my photo editing. Any clue as to how to fix this problem would be greatly appreciated.
    JPM

    reset your preferences, Resetting (or 'Trashing') the Lightroom Preferences file - Lightroom Forums

  • When backing up lightroom 4 catalog, get message "lightroom encountered an error when reading from its preview cache and needs to quit" this occurs during optimization stage of backup

    i upgraded from lightroom 4 to lightroom 5 and installed it on a separate hard drive. Initially had no problems util my computer crashed due to the failure of the drive on which Lightroom 5 was installed. Since having my computer rectified, i am unable to use lightroom 5 getting the message "lightroom encountered an error when reading from its preview cache and needs to quit"
    I can still use lightroom 4, however, i get the same message when i try to backup the catalog. This occurs during the optimisation phase of backup.
    I suspect it is related to Lightroom 5 creating a catalog from the Lightroom 4 files and cannot now locate those files or that they have been corrupted.
    Would appreciate any solutions / suggestions.

    You need to delete your preview cache and have Lightroom rebuild it.   Cache location can be found here.
    https://helpx.adobe.com/lightroom/kb/preference-file-locations-lightroom-41.html
    Why And How To Clear Your Lightroom Cache - Lightroom Fanatic

  • I have a question about Lightroom 5... I used it last night, I go to get on it today and its will not open. I have an error msg "Lightroom encountered an error when reading from its preview cache and needs to quit" Lightroom will attempt to fix the proble

    I have a question about Lightroom 5... I used it last night, I go to get on it today and its will not open. I have an error msg "Lightroom encountered an error when reading from its preview cache and needs to quit" Lightroom will attempt to fix the problem when reopened

    https://forums.adobe.com/message/6219922#6219922
    See if the issue in the thread above helps you to solve your problem.

  • When I tried to open Lightroom 5.4 today I got a msg that says "Lightroom encountered an error when reading from its preview cache and needs to quit. Lightroom will attempt to fix this problem the next time it lauches". What do I do? I get the msg each ti

    "Lightroom encountered an error when reading from its preview cache and needs to quit. Lightroom will attempt to fix this problem the next time it lauches". What do I do? I get the msg each time I try to open it.

    It isn't a file, it's a folder. It will have the same name as your catalog, but will have the extension data. It will be in the same folder along with your catalog. If you need to use the search feature to search for *.lrdata.

  • My computer crashed with lightroom open, since restart I get a msg LR encounted an error when reading from its preview cache and needs to quit

    Hi All
    My computer crashed with lightroom open, since restart I get a msg 'LR encounted an error when reading from its preview cache and needs to quit'
    I'd appreciate any suggestions
    Many thanks

    Many thanks for your help, at lease the LR is working now. How do I rebuild previews and smart previews or will this happen automatically?
    Many thanks

  • Everytime I open lightroom I get a pop up message saying "Lightroom encountered an error when reading from its preview cache and needs to quit" and it closes. Ive already tried reinstalling, nothing seems to work. Help please!

    Every time I open lightroom I get a pop up message saying "Lightroom encountered an error when reading from its preview cache and needs to quit" and it closes. Ive already tried reinstalling, nothing seems to work. Help please!

    Open the folder containing your catalog. In that folder you will find another folder with the extension .lrdata, and you need to delete that folder. After you do that, Lightroom should start normally and will create a new preview cache.

  • I run windows 7/8 and lightroom 5.7  i am getting an error message and here it is " lightroom encountered and error when reading from its preview cache and needs to quit". I am getting this message repeatly.  What do I need to do to fix it.

    I run windows 7/8 and lightroom 5.7  I am getting an error message and here it is  " lightroom encountered an error when reading from its preview cache and needs t quit"    How do I fix this.

    THANKS
    Hank Wilkinson
    Please visit my web site  <http://www.hankwilkinson.com/> www.hankwilkinson.com for the latest of my photos
    For information on any of these photos please email me or call 612-756-9970

  • Good Afternoon my computer had an unexpected restart while I was editing a picture in lightroom. Now when I try to open lightroom I get an error message stating " lightroom encountered an error when reading from its preview cache and needs to quit" Does a

    I keep getting an error message saying that lightroom encountered an error while reading from its preview cache and needs to quit. Can someone please help me fix this.

    Have a look at this previous thread: Re: "Lightroom encountered and error when reading from its preview cache and needs to quit"

  • Recently bought  a new computer and all my music appears in iTunes as well as on my computer in a saved folder. When I try to play the music in iTunes I get an error that reads"the song could not be used because the original file could not be found."

    Recently bought  a new computer and all my music appears in iTunes as well as on my computer in a saved folder. When I try to play the music in iTunes I get an error that reads"the song could not be used because the original file could not be found. Would you like to locate it?" Hope you can help me solve this issue.
    Thanks,
    Shellyboo

    This happens if the file is no longer where iTunes expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, or that the drive it lives on has had a change of drive letter. It is also possible that iTunes has changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place.
    Select a track with an exclamation mark, use Ctrl-I to get info, then cancel when asked to try to locate the track. Look on the summary tab for the location that iTunes thinks the file should be. Now take a look around your hard drive(s). Hopefully you can locate the track in question. If a section of your library has simply been moved, or a drive letter has changed, it should be possible to reverse the actions.
    Alternatively, as long as you can find a location holding the missing files, then you should be able to use my FindTracks script to reconnect them to iTunes .
    tt2

  • ?I am getting an error when installing on my dell inspiron with latest updates for drivers.  Error 1406.  I have the problem with Scan Snap software and a full version of reader.

    ?I am getting an error when installing on my dell inspiron with latest updates for drivers.  Error 1406.  I have the problem with Scan Snap software and a full version of reader.

    Error 1402 | Error 1406 | Acrobat, Reader

Maybe you are looking for

  • A/P Down Payment Invoice error....

    Hi all.... Please Help me... I done all setup relevant to Vendor/Supplier for Business Partner Data........... But whan I am creating A/PDown payment Invoice I got error... In Vendor AP Down Payment Invoice I got error i.e "No Matching Records Found"

  • Index on two columns

    Hi I have a table like create table tab1(tb1 number, tb2 varchar2(30), tb3 varchar2(30)) I have created two function indexes upper(tb2) and upper(tb3) on the table tab1 I have a select query like select tb1 from tab1 where upper(tb2) like upper('%tes

  • Two-dimensional array

    heLLo,,!! cAn u pLease givE mE thE codE of this oUtpUt usina two-dimensional array? thAnks a lot,,, @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  • Add Pic to a playlist?

    Is it possible? The album pic, only shows at the first track. So be able to add pics to a playlist would be great Someone who knows it is possible? Sorry for my bad English :P Hope for answers soon

  • R12 Upgrade issue

    Sawwan, I am doing R12 upgrade, as part of it, i have applied R12 AD patch, now when ever i am trying to appy English patch, i am getting below error, any ideas 1)sourced R12 envronment. [applmgr@appl]$ . *.env* /data/oracle/R12/apps/apps_st/appl/au/