XPath Query into Datagrid

Hello,
I have a XML File that looks something like this.
<ItemList>
<ProductType>Google</ProductType>
<EmployeeName>John,X,Doe,john.doe@domain.com</EmployeeName>
<EmployeeName>Jane,X,Doe,jane.doe@domain.com</EmployeeName>
<EmployeeName>Larry,X,Doe,larry.doe@domain.com</EmployeeName>
</ItemList>

What I am trying to accomplish is do an XPath Query that finds all
employees where the ProductType is swTitle.Text(Product Name that a
user enters into a form). But I want to display the result into a
datagrid with 4 columns ( FN, MI, LN, EMAIL ) so for example:

If some enters 'Google' the result will be the following style:

First Name     MI    Last Name    Email
John           X     Doe          john.doe@domain.com
Jane           X     Doe          jane.doe@domain.com
Larry          X     Doe          larry.doe@domain.com

Here is the code that I am using:

	void GetUserList()
	{

	XmlDocument doc = new XmlDocument();
	doc.Load(Server.MapPath("software.xml"));

	//XmlNode sw;
    XmlNodeList sw;
	XmlNode root = doc.DocumentElement;

	// SEARCH XML FILE
	string t = "'" + swTitle.Text + "'";
	sw=root.SelectNodes("//EMPProductType[ProductType=" + t + "
]/EmployeeName");
	int total = sw.Count;
	// RETURN DATA FROM XPATH
	if(sw != null)
	{
	 for (int i=0; i < total; i++)
     {

	temp = temp + "<br> " + sw[i].OuterXml;
	 }

	  test.Text = temp;
	  usedCount.Text = total.ToString();

}


Any Help would be gratefull

0
10/13/2005 1:41:58 AM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
445 Views

Similar Articles

[PageSpeed] 43

Did you get it working?

<manmit.walia@gmail.com> wrote in message
news:1129167718.012511.10920@g47g2000cwa.googlegroups.com...
> Hello,
> I have a XML File that looks something like this.
> <ItemList>
> <ProductType>Google</ProductType>
> <EmployeeName>John,X,Doe,john.doe@domain.com</EmployeeName>
> <EmployeeName>Jane,X,Doe,jane.doe@domain.com</EmployeeName>
> <EmployeeName>Larry,X,Doe,larry.doe@domain.com</EmployeeName>
> </ItemList>
>
> What I am trying to accomplish is do an XPath Query that finds all
> employees where the ProductType is swTitle.Text(Product Name that a
> user enters into a form). But I want to display the result into a
> datagrid with 4 columns ( FN, MI, LN, EMAIL ) so for example:
>
> If some enters 'Google' the result will be the following style:
>
> First Name     MI    Last Name    Email
> John           X     Doe          john.doe@domain.com
> Jane           X     Doe          jane.doe@domain.com
> Larry          X     Doe          larry.doe@domain.com
>
> Here is the code that I am using:
>
> void GetUserList()
> {
>
> XmlDocument doc = new XmlDocument();
> doc.Load(Server.MapPath("software.xml"));
>
> //XmlNode sw;
>     XmlNodeList sw;
> XmlNode root = doc.DocumentElement;
>
> // SEARCH XML FILE
> string t = "'" + swTitle.Text + "'";
> sw=root.SelectNodes("//EMPProductType[ProductType=" + t + "
> ]/EmployeeName");
> int total = sw.Count;
> // RETURN DATA FROM XPATH
> if(sw != null)
> {
> for (int i=0; i < total; i++)
>      {
>
> temp = temp + "<br> " + sw[i].OuterXml;
> }
>
>   test.Text = temp;
>   usedCount.Text = total.ToString();
>
> }
>
>
> Any Help would be gratefull
>


0
10/14/2005 9:50:35 AM
No....

I get the data but I do not know how to pass it to a datagrid.

0
10/14/2005 2:29:42 PM
Reply:

Similar Artilces:

Multi dimensional Analysis- Query
can we split the expenses based on projects thru MDA. tho: my COA is not designed based on projects. ...

Excel query is returning only part of the data from a column
Even while previewing while still in the query, data is previewing as 5 numerals with a decimal point, e.g., 5555.0, when numbers are in format of 4 numerals, or 4 numerals and a letterin the original spreadsheet. Those with letters are not showing at all. Have tried formatting the original column as text, or general, but this has no effect. ?? amanda <amanda@discussions.microsoft.com> wrote ... > Even while previewing while still in the query, data is previewing as 5 > numerals with a decimal point, e.g., 5555.0, when numbers are in format of 4 > numerals, or 4 numeral...

Re: Formula in MS Query
Unfortunately the format command wiill not allow grouping of the dates, since time is appended with date in every field. You could import the Time field in its Date/Time format, then reformat the column in Excel (Format>Cells, Number tab -- Date category) Krish wrote: > I am trying to import external data into Excel spreadsheet. One of the > tables in the external data has a field "Time" for Date and time of > transaction. In MS query I inserted a new column with a new name and > inserted a formula Left(Filename.Time,11). The result came as "Dec 2,2003",...

Append Query problem
I have created an append query in vba code which is inside a For...Next loop. I create an SQL statement to find matching related records in one table, and then insert these matching records into a temporary table. I repeat for each value of unique primary key that is provided (in an array). The issue I have is that the append query only works for the first matching record, not the subsequent records. I have verified that correct SQL statements are generated during each iteration of the loop, but for some reason no inserts occur after the first one. The temp table is cleared at the beginning o...

A/P and A/R SQL Query
We're running GP80 and I have some managment that is interested in a custom report that is not embedded inside of GP, hence no using the report writer. I have not had much experience digging around in the tables GP either. One of the items they are interested in is the total A/R and A/P outstanding as well as those same items aged 30 60 90 days. Ive been looking thru the tables in the database and am having some trouble getting a query together that matches what GP reports those values should. Basically what i am looking for is a query t hat will produce the Totals row that shows...

GETPIVOTDATA query
The formula below works. It gets the VAT value from the pivot table for TP = 1. GETPIVOTDATA($B$5,"TP['1'] VAT") Is there a way that I can reference the TP outside the formula - something like GETPIVOTDATA($B$5,"TP[' & A1 & '] VAT") so that I can choose which TP to see by changing the value in A1. Thanks Laurence Lombard Add some quotation marks, and it should work: =GETPIVOTDATA($B$8,"TP " & A1 & " VAT") It should work without the square brackets and single quotes around the number. Laurence Lombard wro...

Problem with updating connection string to embedded MS query
I have an Access 2007 db that allows the user to combine data from various sources and then updates queries embedded in an Excel 2007 spreadsheet. I update the connection string and the command text with the details of the path and database name and then refresh the queries, so it doesn't matter where the user puts the database or if they change the name. This all works on my local machine, no matter where I place the db and Excel template. However, over a network a type mismatch error is raised when the connection string is changed. In the same environment one person can...

Custom xpath function, ResolveFunction called but not Invoke...
Hi... We have an XsltContext object on our code to support some custom functions. I just went to add one and oddly I find XsltContext.ResolveFunction() is being called but Invoke() isn't. ResolveFunction returns return new XPathExtensionFunction(name, 2, 4, new XPathResultType[] { XPathResultType.String, XPathResultType.String, XPathResultType.String, XPathResultType.Boolean }, XPathResultType.Boolean); where class XPathExtensionFunction : IXsltContextFunction. From what's returned, I see that the ReturnType property is called a couple times but it's never followed up wit...

formating Union Query
I have a Union Query that displays correct values but in an unformatted table. Is there any way I can format these fields (they are correctly formatted in the original queries) and also change the displayed field names ? Thank you ! Don't do formatting in tables or queries. Do the formatting in the form or report. As to changing displayed field names, create alias names like this: Select FooBah As Dinky The original table field is FooBah, but when displayed will say Dinky -- Dave Hargis, Microsoft Access MVP "Rick Stahl" wrote: > I have a Union Query that disp...

MONSTER QUERY
Hi Guys, I need help with this. I needed to display all transactions in an outfit. So I designed a union query to combine all the transactions. The result worked, but only after a long lunch break so the query would open; it was that slow. So I decided to break the query into smaller bits and use them in sub-forms. I made a smaller union query combining cash donations (positive figures) with cash expenses as negative. When I used this union query to build another one so that I could retrieve the sum (or net) of the cash column, I got two records, one each for the donations and expenses. ...

update query 01-11-08
I tried to use update query to update data that I didn't have prior to inputting the rest. I get the data whenever my supervisor can give it to me which is hours worked. I made a query with the criteria as null hours. When I change the query to update query the date and employee id fields ( which is part of the original query field) disappeared. It only left the worked hours field which I can't update because the date and employee id field disappears so I don't know who's hours or what date I am updating. Hi, it's always a good idea to have a backup of your data. You could...

Coded Append Query doesn't append all info?
I have an append query that moves all of the records from one table to another and it works fine. However, in my form when I code the query to run, not all of the fields get moved. All of the records are there, but some of the fields aren't. Help???? Sorry, for got the code I am using. Dim strAppend as String strAppend = "Append" 'Name of Query DoCmd.SetWarnings False DoCmd.OpenQuery strAppend, acNormal, acEdit DoCmd.SetWarnings True "Bumbino" wrote: > I have an append query that moves all of the records from one table to > another and it works...

Parameter queries that allow users to choose items from a list
Dear Access 2007 VBA Gurus, I have a "Worship Song" database. The tables are: tblWorshipSongs tblAuthorFirstNames tblAuthorLastNames tblCopyrightHolders tblKeys tblTempos tblSongThemes tblSongTypes I would like to create parameter queries that allow users to choose their parameter from a list, preferably the entries from one of the tables. For example, suppose I wanted to query all the songs by a particular author's last name. I don't just want users to type in a last name, in which case they might misspell it and return no records, or type in an entr...

update query help 07-14-10
sql 2000 i have three tables 1- create table mytab(id_no varchar(5), Counter smallint)) 2- create table Rectab(id_no varchar(5), refno smallint)) 3- create table Lib_tab(refno smallint) insert into mytab values(1,null) insert into mytab values(2,null) insert into mytab values(3,null) insert into mytab values(4,null) -- Rectab has duplicate values insert into Rectab values(1,1) insert into Rectab values(1,1) insert into Rectab values(1,2) insert into Rectab values(1,2) insert into Rectab values(1,2) insert into Rectab values(1,3) insert into Rectab values(2,1) ins...

How do I get a web query to auto-refresh before a pivot table aut.
I have html data stored on an intranet site that I want to auto-refresh when the user opens the Excel file. I then want a pivot table in the file to also auto-refresh. Excel is updating the pivot table before it's refreshing the data which is the reverse order of what I need. I can't figure out how I change the order of the auto tasks. Thanks. ...

Query/Expression Help Required!
Hello, i would appreciate any help in regards to the problem i am having. I will try and explain it to the best of my ability (im a newbie to Access 2000) Here is a snipt of the information i have extracted via a query. I have been able to work out Duration via a calculation. "Agent Pin" "Start Time" "AUX Name" "End Time" "Duration" "7015" "13:45:21" "After Call Work" "13:54:18" "537" "7015" "14:30:25" "After Call Work" "14:31:03" &...

Access Query w/ Unix Date Criteria
I have a pass through query that pulls information from an oracle datasource. I need to be able to set a date critera for a field in my query. For Example I want to only pull data where RES_DATE is greater than 12/01/2003. The RES_DATE field type is some unix time (example- 1072881348) I have tried just setting normal data critera in the access query but it doesnt like the format. Does anybody know how to set this type of criteria? Any help is appreciated-Corey The Unix Date is the number of seconds since January 1st, 1970. To convert from a regular date to a Unix date, use DateDiff(&q...

using field name as value in query
I have a "contractor" table with names and phone numbers and .. many yes/no fields which bear the names of Counties. I want to be able to search for contractors who work in those counties checked yes. I know the value in the field will be -1. I want to be able to select a field name (such as Boone county) from a list and query for contractors who work in "Boone county" as result. I know this is not really the best way to use a rdb.. and I could simply have a "County field" with multiple records with cifferent county names attached to eac...

how do i perform a Count(Distinct) query for 2 different column va
how do i perform a Count(Distinct) query for 2 different column values using GROUP BY I have this "source" table like this.... |------------------------------------------| |ROLLUP_ID | GAP_ID | REQ_ID | COST| |------------------------------------------| |001 | 001 | 002 | 12.00 | |001 | 002 | 002 | 15.00 | |005 | 005 | 009 | 9.00 | |------------------------------------------| I need a group by query with distinct for ms access 2007... to make the following...aggregate query |----...

howto convert a table field from double precision into long integer with a query
I have to convert the source table field to the exact same destination table with conversion of 1 field double percision into long integer Can someone help me out? Thanx Here's a Data Definition Language (DDL) query example: http://allenbrowne.com/func-DDL.html#ModifyFieldDDL -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Bart" <vdb@telenet.be> wrote in message news:6aef4c39-557c-4401-841a-efba8af6d7db@c16g2000yqd.googlegroup...

Query to extract data on the basis of date
hi, I have created a query to extract the details of data on the basis of date in the table. The problem is the query is not giving the correct details. Can you pls let me know how to solve this problem? Thanks in Advance for the help!!!! Regards, Karthik.... Hi Karthik, I'm sure you know exactly what result you want, based on your data, but keep in mind that no one else has this benefit. You will need to explain in more detail what your problem is, if you have any hope of getting your question answered here. Is the date in your table stored in a Date/Time data type, or in a tex...

query 06-07-07
my query is about studentinfo ...

strange query sort behaviour
access 2003 problem SELECT * INTO [test_table] FROM [old_table] ORDER BY [PH_ORDER]; (PH_ORDER is a unique numeric field) I thought this would be straight forward, but in some cases (particularly tables > 10,000 records) the resulting table will have some blocks of records (about 20) out of order. Typically when this occurs the table when opened will start with ,say, records 40-60 and then go back to 1. Does anyone have an explanation as to why this might be happening? Try a compact/repair, in case there is a damaged index: Tools | Database Utilities | Compact/Repair or in Acce...

Web Query #4
Thank you in advance for any help provided to the subject question. I am operating Excel 2003. A data query has been established to pull investment data from finance.yahoo.com (i.e. stock volume, % ownership of management, etc.). The query works fine and pulls approximately 50 values from the webpage. My questions is this: If I have a list of 100 stock symbols how can I link that list to the web based data query to automatically insert each symbol into the data query individually and then dump that data automatically to another worksheet within the same workbook. Should I use a ma...

Variable (select) TABLE name in query
I am looking for a solution to create a single query which allows a user to select from a Form which Table to use. Presently, I have queries which point to each table directly (This was ok when it was only two tables but this has grown very quickly to 11 Sharepoint Lists) I am getting tired of manualy updated each query and related report form. My idea is to have a simple Form to allow the user to select which Table to use as the source. This is what I have now: Several SharePoint lists. All the lists use the same exact table structure Three queries for each list One report for each que...