I am trying to load an xml file using scala-xml_2.12-1.0.6.jar
but it gives me NullPointerEexception
while loading
Following is my line of code to load xml
import scala.xml.XML
val xml = XML.loadFile("sample.xml")
I have decompiled this jar and is method is present in that jar but for some reasons it is unable to find it in code.
I have Scala 2.13.1
on my system but for this project I am using scala 2.12.1
and it is mentioned in mu built.sbt
scalaVersion := "2.12.1"
I have following dependency in my built.sbt
for this xml package
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.0.6"
If I copy and paste the same code to Scala
interactive shell( scala 2.13.1
) I get following error
import scala.xml.XML
^
error: object xml is not a member of package scala
did you mean Nil?
Can anyone please identify what am i doing wrong?
Thanks in advance.