I am trying to validate stuff against an xml schema. I am getting an input from user and checking to see if that value exist as a value for the name attribute. If it does i am returning true or if not false. Ive loaded the schema into a val and selected the nodes that i want like
val a = XML.load("schema.xml")
val nodes = (a \\ "Items")
Now a has the following
<Items name="name1" type="type1" />
<Items name="name2" type="type2" />
<Items name="name3" type="type3" />
<Items name="name4" type="type4" />
The user inputs the value name1
I tried doing
nodes.foreach(checkattr(_))
checkattr(val : elem)
{
if(elem@name == userinput) { true } else { false }
}
But this is nt working and even if it does it seems the wrong way to do it as i want to return true or false only once for the entire traversal instead of the likes of waht i have specified above.
Any pointers would be useful for me.