in ideaSupport/src/main/scala/org/jetbrains/sbtidea/download/plugin/PluginDescriptor.scala [82:109]
def load(str: String): PluginDescriptor =
load(XML.withSAXParser(createNonValidatingParser).loadString(str))
def load(url: URL): PluginDescriptor =
load(XML.withSAXParser(createNonValidatingParser).load(url))
def load(path: Path): PluginDescriptor =
load(XML.withSAXParser(createNonValidatingParser).load(Files.newInputStream(path)))
def load(stream: InputStream): PluginDescriptor =
load(XML.withSAXParser(createNonValidatingParser).load(stream))
//noinspection ExistsEquals : scala 2.10
def load(xml: Elem): PluginDescriptor = {
val id = (xml \\ "id").text
val version = (xml \\ "version").text
val name = (xml \\ "name").text
val vendor = (xml \\ "vendor").text
val since = (xml \\ "idea-version").headOption.flatMap(tag => Option(tag.attributes("since-build")).map(_.text)).getOrElse("")
val until = (xml \\ "idea-version").headOption.flatMap(tag => Option(tag.attributes("until-build")).map(_.text)).getOrElse("")
val dependencies = (xml \\ "depends").map { node =>
val id = node.text.replace(OPTIONAL_KEY, "")
val optional = node.text.contains(OPTIONAL_KEY) || node.attributes.asAttrMap.get(OPTIONAL_ATTR).exists(_ == "true")
Dependency(id, optional)
}
val idOrName = if (id.isEmpty) name else id
PluginDescriptor(idOrName, vendor, name, version, since, until, dependencies)
}