473,394 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

problem rowfilter with xml

Hi! I need to search an xml file for a <symbol>FO</symbol> being passed from
a query string. here's my sample xml file (original xml file is generated
from a mainframe):

<stock>
<Filter>
<name>Filter1</name>
</Filter>
<Filter>
<name>Filter2</name>
</Filter>
<item>
<symbol>FO</symbol>
<comprating>91</comprating>
<epsrating>93</epsrating>
</item>
<item>
<symbol>CSL</symbol>
<comprating>81</comprating>
<epsrating>83</epsrating>
</item>
</stock>

query string ex.: http://localhost/SymbolRatings/default.aspx?s=FO
if i remove the <filter></filter> from the xml file and then load it into a
dataset, i can then use the dv.rowfilter = "symbol = 'FO'" to query the file
and display only the data that belongs to "FO" or whatever symbol is being
passed throught the query string and bind it to a datagrid.

my problem is that it doesn't work with the <filter> in at the top. =(

can anyone show me how or point me in the right direction on how i can
search the xml file without having to remove <filter></filter> because the
file needs that at the top. can it be done with the <filter> on top or do i
have to remove it because it doesn't match the <items> below?

thanks first!

phong
Nov 12 '05 #1
2 2083
hi phong, try this one:

using System;
using System.Drawing;
using System.Xml;

public class Tester
{
public static void Main()
{
string data = @"<stock>

<Filter>

<name>Filter1</name>

</Filter><Filter>

<name>Filter2</name>

</Filter>
<item>

<symbol>FO</symbol>

<comprating>91</comprating>

<epsrating>93</epsrating>

</item>
<item>

<symbol>CSL</symbol>

<comprating>81</comprating>

<epsrating>83</epsrating>

</item>
</stock>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(data);
XmlNode node = doc.SelectSingleNode
("//stock/item[symbol=\"FO\"]");
if (node != null)
Console.WriteLine("Found");

Console.ReadLine();
}
}
-----Original Message-----
Hi! I need to search an xml file for a <symbol>FO</symbol> being passed froma query string. here's my sample xml file (original xml file is generatedfrom a mainframe):

<stock>
<Filter>
<name>Filter1</name>
</Filter>
<Filter>
<name>Filter2</name>
</Filter>
<item>
<symbol>FO</symbol>
<comprating>91</comprating>
<epsrating>93</epsrating>
</item>
<item>
<symbol>CSL</symbol>
<comprating>81</comprating>
<epsrating>83</epsrating>
</item>
</stock>

query string ex.: http://localhost/SymbolRatings/default.aspx?s=FO

if i remove the <filter></filter> from the xml file and then load it into adataset, i can then use the dv.rowfilter = "symbol = 'FO'" to query the fileand display only the data that belongs to "FO" or whatever symbol is beingpassed throught the query string and bind it to a datagrid.
my problem is that it doesn't work with the <filter> in at the top. =(
can anyone show me how or point me in the right direction on how i cansearch the xml file without having to remove <filter></filter> because thefile needs that at the top. can it be done with the <filter> on top or do ihave to remove it because it doesn't match the <items> below?
thanks first!

phong
.

Nov 12 '05 #2
hi phong, try this one:

using System;
using System.Drawing;
using System.Xml;

public class Tester
{
public static void Main()
{
string data = @"<stock>

<Filter>

<name>Filter1</name>

</Filter><Filter>

<name>Filter2</name>

</Filter>
<item>

<symbol>FO</symbol>

<comprating>91</comprating>

<epsrating>93</epsrating>

</item>
<item>

<symbol>CSL</symbol>

<comprating>81</comprating>

<epsrating>83</epsrating>

</item>
</stock>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(data);
XmlNode node = doc.SelectSingleNode
("//stock/item[symbol=\"FO\"]");
if (node != null)
Console.WriteLine("Found");

Console.ReadLine();
}
}
-----Original Message-----
Hi! I need to search an xml file for a <symbol>FO</symbol> being passed froma query string. here's my sample xml file (original xml file is generatedfrom a mainframe):

<stock>
<Filter>
<name>Filter1</name>
</Filter>
<Filter>
<name>Filter2</name>
</Filter>
<item>
<symbol>FO</symbol>
<comprating>91</comprating>
<epsrating>93</epsrating>
</item>
<item>
<symbol>CSL</symbol>
<comprating>81</comprating>
<epsrating>83</epsrating>
</item>
</stock>

query string ex.: http://localhost/SymbolRatings/default.aspx?s=FO

if i remove the <filter></filter> from the xml file and then load it into adataset, i can then use the dv.rowfilter = "symbol = 'FO'" to query the fileand display only the data that belongs to "FO" or whatever symbol is beingpassed throught the query string and bind it to a datagrid.
my problem is that it doesn't work with the <filter> in at the top. =(
can anyone show me how or point me in the right direction on how i cansearch the xml file without having to remove <filter></filter> because thefile needs that at the top. can it be done with the <filter> on top or do ihave to remove it because it doesn't match the <items> below?
thanks first!

phong
.

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: CoreyMas | last post by:
Hello all, Here is my situation I am trying to create a dataview with the following rowfilter PMA_DatakeyId IN...
2
by: vbnetrookie | last post by:
In the dataview rowfilter property, how can I say that I just want Titles that start with 'A' to 'J' ?? ex: dv.rowfilter = " Country = ' France ' " I want dv.rowfilter = " Title = (from...
5
by: Jim Heimer | last post by:
When I use the dataview.rowfilter and I try to display the field value of the first row, the code doesn't seem to show the first row AFTER the rowfilter. This is my code: DataView...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
9
by: Marty McFly | last post by:
Greetings, I'm trying to let my users dynamically filter records from a table that relate to other tables. RELATIONSHIPS: . = . . = . There is a Many-to-Many relationship between...
11
by: Geoff Jones | last post by:
Hi I have a table that has a column with Date types. I am trying to view certain rows in the table using a DataView. Using the filter, I can view the rows with, for example, the date equal...
3
by: Catullus | last post by:
Hi everyone, I'm a n00b on VB.net programming and now I stumbled upon a problem I can't solve, even after browsing the net for hours.. I have a dataview witg 4 columns; 2 string columns and 2...
3
by: Anup Daware | last post by:
Abstract: I want to filter a dataview with a value where column name have a SPACE. Description:- I bind a dataview to a datagrid, The query which is fetching the results in Dataset is something...
1
by: AlexW | last post by:
Hi I am in the process of developing an inventory application in visual basic. I keep coming up against a problem with using the dataview.rowfilter property. Basically what happens is this: -a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.