I’m relatively new to working with Scala having recently come from a java background.
I’m seeking advice on creating an efficient s means of reading an XML file and extracting element names and properties contained within where the data is enclosed between parentheses.
For example
< some name >{property}< some name/ >
So the key is where there is data contained within {}
I then want to populate a hash map with the actual element names and property values contained between {}.
I’m sure this is not overly complex but given my limited Scala expertise at this time I’d like to bounce this question off the expertise within the forum.
Many thanks to anyone taking time to answer.
[UPDATED]
Just realized that you’ve asked about braces in text, not about xml-related syntax braces.
The possible answer is:
I’ve doubled
{and}to escape braces, because Scala treat{variable}as a substitute:Now back to work.
To take only
prop'suse\projection operator, which takes subnodes with a given name. To take all sub-sub-…-sub nodes in xml tree use instead\\.Actually, i’m cheated here, and supposed that non-desired property field cannot exist in form {notkey. You can rewrite code to filter keys in another manner (e.g. using regexp’s)