Hi
I have write a program on java how let me to read an XML file. the
address of my file is "http://localhost:8080/webdav/user.xml";. this is
my program:
import java.io.File;
import java.net.URI;
import java.net.URL;
import java.util.List;
import java.util.Vector;

import org.jdom.Element;
import org.jdom.input.SAXBuilder;

public class TestXML {

        public org.jdom.Document document;
        public Element racine;
    public  Vector<Object> h;
    String nom, cin;
   String path="http://localhost:8080/webdav/user.xml";;
        public static void main(String[] args) {
                try {
                        TestXML test = new TestXML();
                         URL url=new URL(test.path);
                         URI uri=url.toURI();
                        // On crée une instance de SAXBuilder
                        SAXBuilder sxb = new SAXBuilder();


                        // On crée un nouveau document JDOM avec en argument le 
fichier
                        // XML
                        // Le parsing est terminé
                        test.document = sxb.build(new File(uri));

                        // On initialise un nouvel élément racine avec 
l'élément racine du
                        // document.
                        test.racine = test.document.getRootElement();

                //      System.out.println(test.racine);
            test.h= new Vector<Object>();
                        //on recupere l'element results
                        Element results = 
(Element)test.racine.getChildren().get(1);
                        //System.out.println(results);
                        Element result = (Element)results.getChildren().get(0);
                        //on a recupere les binding
                        List<Element> listparam = result.getChildren();

                        for (Element e : listparam)
                        {
                                // On affiche le nom de l'element courant
                                //System.out.println(e);
                                for(Element el : (List<Element>)e.getChildren())
                                        {
                                                
if(el.getName().equals("literal"))
                                                {

                                                        
System.out.println(el.getText());

                                                        }//fin if

                                        }//fin for

                                }//fin for

                } catch (Exception e) {
                        e.printStackTrace();
                }
        }

}
but when i run it i get this error :
java.lang.IllegalArgumentException: URI scheme is not "file"
        at java.io.File.<init>(File.java:383)
        at xml.TestXML.main(TestXML.java:37)
when i look to to the error i understund that it focus in this line of
code: test.document = sxb.build(new File(uri));
Please help me.
thanks for help

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to