Jemper
02-19-2009, 09:59 AM
Hi,
I have a problem with parsing, that is the parse loops forever and i never get the results.
i send the xml file from the client to the server via socket
OutputStream output = socket.getOutputStream();
PrintStream print = new PrintStream(output, true);//write to socket.
print.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Personnel><Employee type=\"permanent\"><Name>Seagull</Name><Id>3674</Id><Age>34</Age></Employee></Personnel>");
The print with line 117 never gets printed because the document is never created because the parse loops forever so why is that, i even made a new BufferedReader the see that the inputstream is not empty so no problem there, i can even put junk instead of an xml file and still it loops, also tried to flush the data no good...
can anyone point the problem with parsing and inputstream?
public String parsingInputStream(InputStream in) throws ParserConfigurationException, SAXException, IOException {
Document doc = null;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
System.out.println("XMLParser class. Line 115. Test.");
//BufferedReader reader = new BufferedReader(new InputStreamReader(in));
//System.out.println(reader.readLine());
doc = docBuilder.parse(in);//???
System.out.println("XMLParser class. Line 117. Test.");
I have a problem with parsing, that is the parse loops forever and i never get the results.
i send the xml file from the client to the server via socket
OutputStream output = socket.getOutputStream();
PrintStream print = new PrintStream(output, true);//write to socket.
print.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Personnel><Employee type=\"permanent\"><Name>Seagull</Name><Id>3674</Id><Age>34</Age></Employee></Personnel>");
The print with line 117 never gets printed because the document is never created because the parse loops forever so why is that, i even made a new BufferedReader the see that the inputstream is not empty so no problem there, i can even put junk instead of an xml file and still it loops, also tried to flush the data no good...
can anyone point the problem with parsing and inputstream?
public String parsingInputStream(InputStream in) throws ParserConfigurationException, SAXException, IOException {
Document doc = null;
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
System.out.println("XMLParser class. Line 115. Test.");
//BufferedReader reader = new BufferedReader(new InputStreamReader(in));
//System.out.println(reader.readLine());
doc = docBuilder.parse(in);//???
System.out.println("XMLParser class. Line 117. Test.");