parsing list of files
Hi
this is a repost of my question at stackoverflow http://stackoverflow.com/questions/10444188/parsing-a-list-of-xml-files-with-scala.
As I guess that something weird is going on, asking the experts might be better. Here we go:
----
I have a list of files (produced by find). I read this file, line by line, and call XML.loadFile(line) and subsequently my own simple "fromXML" method on the resulting XML-element.
The for/yield that goes through the lines dies with "The processing instruction target matching "[xX][mM][lL]" is not allowed." for one of the files (reproducible). Note, that the xml-file in question works fine (with XML.loadFile and fromXML) when treated individually.
To me this sounds like a nasty side-effect in otherwise pure code. Could it be that some InputStream is reused somehow ?
Thanks, Sebastian.Exception in thread "main" org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPIData(XMLScanner.java:701)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanPIData(XMLDocumentFragmentScannerImpl.java:1020)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanPI(XMLScanner.java:669)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:954)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808) com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
at scala.xml.factory.XMLLoader$class.loadXML(XMLLoader.scala:40)
at scala.xml.XML$.loadXML(XML.scala:40)
at scala.xml.factory.XMLLoader$class.loadFile(XMLLoader.scala:49)
at scala.xml.XML$.loadFile(XML.scala:40)
at de.company.scala.mvndeps.Cli$$anonfun$fs2ms$1.apply(Cli.scala:17)
at de.company.scala.mvndeps.Cli$$anonfun$fs2ms$1.apply(Cli.scala:16)
at scala.collection.Iterator$$anon$19.next(Iterator.scala:401)
at scala.collection.Iterator$$anon$19.next(Iterator.scala:401)
at scala.collection.Iterator$class.foreach(Iterator.scala:772)
at scala.collection.Iterator$$anon$19.foreach(Iterator.scala:399)
at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:48)
at scala.collection.mutable.ListBuffer.$plus$plus$eq(ListBuffer.scala:130)
at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:242)
at scala.collection.Iterator$$anon$19.toList(Iterator.scala:399)
at de.company.scala.mvndeps.Cli$.fs2ms(Cli.scala:23)
at de.company.scala.mvndeps.Cli$delayedInit$body.apply(Cli.scala:26)
at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
RSS Feed