-1

I want to use JDOM, so I want to Know the equivalent to this code written by DOM:

DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
URL Url = new URL(url);
Document doc = builder.parse(Url.openStream());

I use this example:

//On crée une instance de SAXBuilder
 SAXBuilder sxb = new SAXBuilder();
 try
 {
     //On crée un nouveau document JDOM avec en argument le fichier XML
     //Le parsing est terminé ;)
     document = sxb.build(new File("Exercice2.xml"));
  }
  catch(Exception e){}

but I want to use an URL instead of an XML file.

skaffman
  • 398,947
  • 96
  • 818
  • 769
Marie
  • 137
  • 1
  • 3
  • 19

1 Answers1

0

So pass the URL to the SAXBuilder.build method. It's right there in the Javadoc.

skaffman
  • 398,947
  • 96
  • 818
  • 769