I have a xml (stored in the variable report) which looks like this:
<wrapper>
<Sample Id="SomeId1">
<Tag Id="SomeTag">
<Lane Id="1">
[...]
</Lane>
</Tag>
</Sample>
<Sample Id="SomeId2">
<Tag Id="SomeTag">
<Lane Id="1">
[...]
</Lane>
</Tag>
</Sample>
</wrapper>
I want to extract the "Id" attribute from the "Sample" node. I read following article http://www.codecommit.com/blog/scala/working-with-scalas-xml-support and then tried with:
(report \\ "Sample" \ "@Id").text
I got an empty string as return:
scala> (report \\ "Sample" \ "@Id").text
res16: String = ""
But I should have "SomeId1SomeId2" as the return . What have I done wrong?
I found several questions which are similar to mine. Example: Scala: XML Attribute parsing