Filter Xml Using Xpath And Linq (price With Decimal Separator And Thousands Separator Spanish)?
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.
The xml structure is:
<RoomStays>
<RoomStay InfoSource="" Price="201,60" Discount="0" MealPlan="Sólo alojamiento" MealPlanId="1" Provider="Marsol" ProviderId="3" HotelName="HOTEL LA ESTACION" Rating="" Latitud="" Longitud="">
[code]....
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:
doc.XPathSelectElements(./RoomStays/RoomStay[translate(@Price,',','.')<=256.78])
But when there are prices above 1000 with thousands separator . it doesn't work, so I tried:
doc.XPathSelectElements(./RoomStays/RoomStay[translate(translate(@Price,'.',''),',','.')<=256.78])
But it returns 0 results (I tried to use replace function instead of translate to remove the . characters but I get an exception).
View 1 Replies
ADVERTISEMENT
Jul 1, 2011
In VB.Net, is there a way of auto-detecting the culture of a string representation of a number? I'll explain the situation:Our asp.net web site receives xml data feeds for boat data. Most of the time, the number format for the prices use either a simple non-formatted integer e.g. "999000". That's easy for us to process.Occaisionally, there are commas for thousands separators and periods for the decimal point. Also, that's fine as our data import understands this. Example "999,000.00".We're starting to get some data from France where some of the prices have been entered with the periods and thousands separators the other way around as that's the way it's done in many European countries. E.g. "999.000,00". This is where our system would interpret that as nine hundred and ninety nine pounds instead of the nine hundred and ninety nine thousand pounds that was intended.
View 2 Replies
Jul 31, 2009
Using VB.NET - I have a string:
"##RES00012##Some value ##RES00034##Another value"
That I want to split using the "##RES" as a seperator to:
"##RES00012## Some value " and "##RES00034## Another value"
The string.split function doesn't seem to offer an overload to split on multiple characters or array of characters and maintain the seperator, which is required for functional purposes.
I'm looking at simply searching for indexOf("##res") and using string manipulation to do this unless I'm missing something obvious? I've searched SO for a solution but unable to find anything that actually does what I'm after.
The following is the closest i've found: how-do-i-split-a-string-by-a-multi-character-delimiter-in-c
View 1 Replies
Jun 27, 2012
What is the cleanest, most readable way to String.Format a decimal with the following criteria
start with a sign symbol (+ or -)
a fixed number of fraction digits
no decimal separator
right aligned
pre-padded with "0"'s
View 3 Replies
Oct 19, 2010
OdbcDataReader in showing decimal fields Decimal separator disappear with DB2 dsn
View 3 Replies
May 14, 2008
I have a app that updates an Access Database via a datagrid view. I'm updating two column of type Single. The code works perfectely when the regional settings are default US-EN.For computers running in germany an update to the backend database throw a datatype mismatch error. I change the decimal separator on the computer with 'German' for region settings from Comma (,) to (.) period and everything works fine.I add thread culture to US-ENG at the startup of the application. Now the error disappears but then 2.5 is now stored as 25 in the access database.
I add these lines at the beginning of the application soon after the designer code
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US") System.Threading.Thread.CurrentThread.CurrentUICulture = New System.Globalization.CultureInfo("en-US")
This is a MDI app and this code is in the container window...
View 12 Replies
May 22, 2012
Is there a format string to format a decimal to 000000000,00. So first 9 digits, right padded with zeros if needed; a comma as fraction separator and two fraction digits.
0 => 00000000,00
12 => 00000012,00
987456,456 => 000987456,46
So something like myDecimal.ToString("D9") together with .ToString("F2").
View 3 Replies
Nov 15, 2011
I want to now how to place a separator in the form. The one which is available in Menus
Example:
Label1
Label2
Label3[code]....
View 5 Replies
Apr 21, 2010
I know how to add menu separator in under UI, but how can i add it programmatically.
View 3 Replies
Jun 21, 2010
I am developing a window based application. I want to show my menu to be separated by a vertical separator. Just like this:
View 6 Replies
Sep 8, 2011
I have a string variable with value "abcdefghijklmnop".now I want to split the string into string array with say 3 characters(last array element may contain less) in each array element from the right end.
[Code]...
View 4 Replies
Jun 22, 2010
Suppose I have a number[code]...
View 4 Replies
Jan 20, 2012
i need to comfine 3 string after i need to split it my problem is the 3rd string inside contains ,(Comma) so how to seperate by comma
View 16 Replies
Nov 12, 2009
i have a main menu and when the program and launched the contents are cleared then a few items are added before loading in all the favorite websites and such. I'm trying to find the code to inset a separator after the items i have defined are inserted.[code]
View 4 Replies
May 16, 2011
Where in VS2010 can I find a horizontal separator control, as can be found in Outlook settings (screenshots below)?[URL]..
View 3 Replies
Aug 1, 2011
Feel pretty stupid for asking this but I'm looki to add a very simple horizontal line/bar/separator to my GUI for a small project.I'm using Visual Basic 2010 Express. Last time I did any programming was with VB6 and I'm sure you could do this easily with that version but 11 years is a long time.
View 4 Replies
Feb 7, 2011
facing some problems to achieve what I want. I have this piece of code which is working fine. My problem is that I want to display the results of the Text Boxes 2, 5 and 8 with thousands separated by commas and only with two decimals separated by dot , e.g. 1,234,567.89. I tried using Format and other options but I was unable to get the correct result.
Public Class Form1
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not IsNumeric(TextBox1.Text) Or (ComboBox1.Text = "" And ComboBox2.Text = "") Then
MsgBox("Valores inv�lidos ou defini��es incompletas", MsgBoxStyle.Information)
TextBox1.Text = ""
[Code]...
View 5 Replies
Sep 22, 2009
say if I have a string 010451-09F2
How to I get left of - from the above string in vb.net
I want 010451
The left function doesn't allow me to specify separator character.
View 7 Replies
Aug 16, 2010
I am working on a site where I use the Split function on a string. To make sure I used a separator character that I do not use anywhere in the data I selected the character'£'. This worked fine in Firefox and Safari, but in IE8 I get an 'Index out of range' error, so apparently the '£' character is not handled correctly.
View 5 Replies
Jan 6, 2010
How to switch off the annoying (to me anyway) horizontal line that seperates procedures in Vb?
I've setup a new Dev machine for myself and for the life of me I can't figure out how to switch it off in VS2008.My mind is obviously failing with age, I know I did it on the old machine!
View 2 Replies
Jun 23, 2009
I want to achieve the same thing as highlighted in attached file, so called seperator or page break, but i'm unable to find this control in VS 2005, how to get this control?
View 3 Replies
Feb 7, 2012
In Window form. I want to add informative text to the Menu separator. Can anyone suggest how to do that?
for example separator should appear like below
Menu Item1
Menu Item2
----- Separator title -----
Menu Item3
Menu Item4
After Lots of attempts I am only able to add simple separator.
View 3 Replies
Dec 29, 2011
Since I am making a program with quite a few users with different access levels, I usually turn all the toolstripmenuitems to visible false first, before turning some of them to visible true again as specific to the users.[code]...
View 3 Replies
Dec 28, 2011
Argument matching parameter 'separator' narrows from 'String' to Ƈ-dimensional array of Char'. ERROR
View 7 Replies
Apr 11, 2011
I have an excel file i want to copy all the row of that excel file into a .txt file.In the txt file the separator is comma.
View 8 Replies
Nov 8, 2011
What my program does is load a file (password list), then progressively reads each line of text in the file whilst writing each line to a new file. After X amount of lines have been written, it should start writing the lines of text to a new document until the initial password list has been split into X amount of password lists. The problem I have is that after hours of tweaking, all I can get it to do is write either blank ocuments, or write all of the lines to only one file. I really need it to be able to split into multiple files, preferably at runtime rather than loading a whole text document into the program in a textbox or array then writing it to new files.Below is the source:
Imports System
Imports System.Windows.Forms
Imports System.IO
[code].....
View 11 Replies
Nov 1, 2011
I have the following XML from Amazon's Marketplace API. I need to sum all the values of Item/ItemPrice/Component[type='Principal']/Amount for all Items to compute an order total. Is this possible to do using LINQ to XML in VB.NET?
<?xml version="1.0"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
[code]....
View 1 Replies
Sep 10, 2009
Example-I have a person class
Public Class Person
Private _fname As String
Public Property Fname() As String
[Code]...
View 2 Replies
Nov 25, 2011
I am new to vb and I am having so much trouble with this. What I need to do is this: I have a form application for winter sports equipment rental.I have a listbox filled with the equipment for the user to choose from then I have a combobox for the user to select the duration they would like to rent it. The book that I am using has no examples I can refrence and i have had no luck online either. I am posting what I have so far. However, i think I am going in the wrong direction. I have been working on this for so long that I think I have over thought it and made a mess of it. I am thinking that I need to add a new class for rentalRates then use enum of durationType and equipmentType but I am unsure how to move that way. That is using a enum, a 2d array and a parallel array? [code]
View 1 Replies
Jan 24, 2012
PHP
Public Class GasPump
Private name As String
Private quan As Double
[Code].....
I get problem in the code when you going to pick y/n. how i going to get the price of the premium or Regular in Price per unite?
View 7 Replies