Jun 7, 2012
I'm trying to filter the results of a xml file. One of the fields I've been requested to filter is the attribute price of each node. The problem is the xml is from a spanish source and the prices are with decimal separator being , instead of . and thousands separator is , instead of .I'm trying to get an xml file filtered where only nodes withprices lower than one supplied appear.
View 1 Replies
The xml structure is:
<RoomStay InfoSource="" Price="201,60" Discount="0" MealPlan="SÃ³lo alojamiento" MealPlanId="1" Provider="Marsol" ProviderId="3" HotelName="HOTEL LA ESTACION" Rating="" Latitud="" Longitud="">
I've tried to filter using XPath and Linq2Xml. I've come to the conclussion I have to replace , with . and . with , but I get 0 results.With values below 1000 where there is only , I've got it using:
But when there are prices above 1000 with thousands separator . it doesn't work, so I tried:
But it returns 0 results (I tried to use replace function instead of translate to remove the . characters but I get an exception).