How do I parse an xml document as a stream using Scala?
I’ve used the Stax API in java to accomplish this, but I’d like to know if there is a “scala” way to do this.
How do I parse an xml document as a stream using Scala? I’ve used
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.
Use package scala.xml.pull. Snippet taken from the Scaladoc for Scala 2.8:
You can call
toIteratorortoStreamonerto get a trueIteratororStream.And here’s the 2.7 version, which is slightly different. However, testing it seems to indicate it doesn’t detect the end of the stream, unlike in Scala 2.8.