In all programs under SOA, the fields fetched from the XML file are converted to strings before performing other transformations on them. Rest of the transformations don’t work if the conversion to string is not done first. Does this have to do with the output format of ‘loadString’ or ‘attribute’ methods in XML? What are the output formats of these methods?
As an example, consider the below code snippet from ‘ScoreAnalysis’ program.
.map {line => {
val xml = XML.loadString(line)
(0, Integer.parseInt(xml.attribute(“Score”).getOrElse(0).toString()), line)
}
As ‘Score’ inside the XML file is supposedly an integer, I tried using it directly in my code without converting it to String and then to Integer using ‘parseInt’. But it was throwing error at the subsequent steps.