Is it possible to use SAXParser to parse xml file line by line?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The simplest way to do this is to pass each line to a second thread. e.g. through a PipedInputStream.
In the future you might be able to use continuations in Java 8 or 9 or ? to use the parser in the same thread.
The SAX parser should give you each complete event it can for the lines you have given it.
BTW: In the past I have written a “push” parser to do this, but I don’t know of any standard SAX parse which will do this in one thread.