khaled_jawaher -2 Junior Poster in Training

i've posted a thread about reading xml file from remote machine.
i've used JDOM to read xml file.bcs as someone has told me,it is really easy and flexible.now i am using it normally in local machine.i've opened a socket connectio between server and client machine.then i use JDOM to read xml file remotely.
i am wondering if it is possible to read xml file using JDOM or any method other than opening a socket connection between client and server.
for example the code in the server that provides the client with xml file is

import java.io.*;
import java.net.*;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
public class Provider{
ServerSocket providerSocket;
Socket connection = null;
ObjectOutputStream out;
ObjectInputStream in;
String message,message1;
int i;
Provider(){}
void run()
{
try
{ try{
  SAXBuilder builder = new SAXBuilder();
  File xmlFile = new File("build.xml");
  Document document = (Document) builder.build(xmlFile);
  Element rootNode = document.getRootElement();
  List list = rootNode.getChildren("book");
   for (int i=0; i< list.size(); i++)
   {
  Element node = (Element) list.get(i);
  message1+=node.getChildText("title");
   }
     }
catch(JDOMException jdomex){
    		System.out.println(jdomex.getMessage());
}  
try
{
providerSocket = new ServerSocket(2004,10);
connection = providerSocket.accept();
out = new ObjectOutputStream(connection.getOutputStream());
in = new ObjectInputStream(connection.getInputStream());
message = (String)in.readObject();
System.out.println("client>" + message);
out.writeObject(message1);
out.flush();
}
catch(ClassNotFoundException classnot)
{
System.err.println("Data received in unknown format");
}
try
{
in.close();
out.close();
providerSocket.close();
}
catch(IOException ioException)
{
ioException.printStackTrace();
}
}
catch(IOException ioException)
  {
    ioException.printStackTrace();
  }

}
public static void main(String args[])
{
  Provider server = new Provider();
  while(true)
  {
  server.run();
  }
}
}

thanx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.