Here is the XML that's returned by my web server
<root>
<item attr="test1">
<item attr="test2">
</root>
Here is the Scala Code
var url = "http://mywebserver/my.xml"
val xml = XML.load(url)
logger.info(s"The XML is: $xml")
var items = xml.child
logger.info(s"items: $items")
items.foreach(item => {
logger.info(item.toString())
val attr = item.attribute("attr")
logger.info(s"Attribute: $attr")
})
The XML logged is the copy of the XML returned by the web server However the foreach loop prints
INFO myclassName -
INFO myclassName - Attribute: None
INFO myclassName - <item attr="test1">
INFO myclassName - Attribute: test1
INFO myclassName -
INFO myclassName - Attribute: None
INFO myclassName - <item attr="test2">
INFO myclassName - Attribute: test2
Where are the extra blank nodes coming from? Am I missing any configuration?