I have a big array of data that I imported from a lot of XML files. To get the data, among other manipulations, I use this function:
Cases[xml,XMLElement[nodeName,_,a_]-> a,\[Infinity]]
When I get my final array, I have a lot of number fields that are as String and that I need to convert into Number. To do that I created this function:
clean[data_]:=Map[If[NumberQ@ToExpression[#],ToExpression[#],#]&,data,{-1}]
The problem is that I have strings with "??" characters, so if o use clean on it as for example:
clean[{"asd??asd", "123.3"}]
Mathematica try to interpret the first element as context ones. And I get:
Global`asd
How to avoid it? How can I improve my clean function, or the way I load de XML?