Xpath query #5

Given following XML:

<RESPONSE>
	<DATA
REQUEST_ID=3D"465466189C701F41E040007F01004D25E6B23D14793EB72753CE2387F85A5=
7E5">
	<ENTITY name=3D"Q_ARI_KLS">
	         <ATTRIBUTE name=3D"ID" value=3D"10000307968" />
         	<ATTRIBUTE name=3D"NOSAUKUMS" value=3D"ABAB=C4=BBEVA" />
       </ENTITY>
	<ENTITY name=3D"Q_ARI_KLS">
	         <ATTRIBUTE name=3D"ID" value=3D"10000323423" />
         	<ATTRIBUTE name=3D"NOSAUKUMS" value=3D"CITSKAUTKAS" />
       </ENTITY>
</RESPONSE>

How can I design XPath query, which would return whole <ENTITY>
element, if subelement <ATTRIBUTE> with attribute name=3D"ID" matches
some selected value.

Something like this doesn't work: //DATA/ENTITY[ATRIBUTE
[@value=3D"10000307968"]]


I will be thankfull for any suggestions!
Rgs,
 Andis
0
9/30/2009 10:21:51 AM
dotnet.xml 7266 articles. 0 followers. Follow

4 Replies
1182 Views

Similar Articles

[PageSpeed] 28

Btw, I am using XPathReader class, since I am working with large xml
document. I get "Can't get value" exception.
Thx,
 A



On Sep 30, 1:21=C2=A0pm, ciruliz <andis.ciru...@gmail.com> wrote:
> Given following XML:
>
> <RESPONSE>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <DATA
> REQUEST_ID=3D"465466189C701F41E040007F01004D25E6B23D14793EB72753CE2387F85=
A57E5">
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ENTITY name=3D"Q_ARI_KLS">
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<ATTRIBUTE =
name=3D"ID" value=3D"10000307968" />
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ATTRIBUTE name=
=3D"NOSAUKUMS" value=3D"ABAB=C4=BBEVA" />
> =C2=A0 =C2=A0 =C2=A0 =C2=A0</ENTITY>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ENTITY name=3D"Q_ARI_KLS">
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<ATTRIBUTE =
name=3D"ID" value=3D"10000323423" />
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ATTRIBUTE name=
=3D"NOSAUKUMS" value=3D"CITSKAUTKAS" />
> =C2=A0 =C2=A0 =C2=A0 =C2=A0</ENTITY>
> </RESPONSE>
>
> How can I design XPath query, which would return whole <ENTITY>
> element, if subelement <ATTRIBUTE> with attribute name=3D"ID" matches
> some selected value.
>
> Something like this doesn't work: //DATA/ENTITY[ATTRIBUTE
> [@value=3D"10000307968"]]
>
> I will be thankfull for any suggestions!
> Rgs,
> =C2=A0Andis

0
9/30/2009 10:32:51 AM
ciruliz wrote:
> Given following XML:
> 
> <RESPONSE>
> 	<DATA
> REQUEST_ID="465466189C701F41E040007F01004D25E6B23D14793EB72753CE2387F85A57E5">
> 	<ENTITY name="Q_ARI_KLS">
> 	         <ATTRIBUTE name="ID" value="10000307968" />
>          	<ATTRIBUTE name="NOSAUKUMS" value="ABABĻEVA" />
>        </ENTITY>
> 	<ENTITY name="Q_ARI_KLS">
> 	         <ATTRIBUTE name="ID" value="10000323423" />
>          	<ATTRIBUTE name="NOSAUKUMS" value="CITSKAUTKAS" />
>        </ENTITY>
> </RESPONSE>

Where is the closing </DATA>? Without it the sample above is not even 
well-formed so writing XPath against it is not possible.

> How can I design XPath query, which would return whole <ENTITY>
> element, if subelement <ATTRIBUTE> with attribute name="ID" matches
> some selected value.

/RESPONSE/DATA/ENTITY[ATTRIBUTE[@name = 'ID']/@value = 'foo']

-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/
0
mahotrash (1777)
9/30/2009 11:26:55 AM
On Sep 30, 2:26=C2=A0pm, Martin Honnen <mahotr...@yahoo.de> wrote:
> ciruliz wrote:
> > Given following XML:
>
> > <RESPONSE>
> > =C2=A0 =C2=A0<DATA
> > REQUEST_ID=3D"465466189C701F41E040007F01004D25E6B23D14793EB72753CE2387F=
85A57E5">
> > =C2=A0 =C2=A0<ENTITY name=3D"Q_ARI_KLS">
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ATTRIBUTE name=3D"ID" value=
=3D"10000307968" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<ATTRIBUTE name=3D"NOSAUKUMS" =
value=3D"ABAB=C4=BBEVA" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0</ENTITY>
> > =C2=A0 =C2=A0<ENTITY name=3D"Q_ARI_KLS">
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ATTRIBUTE name=3D"ID" value=
=3D"10000323423" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<ATTRIBUTE name=3D"NOSAUKUMS" =
value=3D"CITSKAUTKAS" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0</ENTITY>
> > </RESPONSE>
I only accidently deleted it from sample. closing DATA tag is where it
should be - at the end before RESPONSE.Andis

>
> Where is the closing </DATA>? Without it the sample above is not even
> well-formed so writing XPath against it is not possible.
>
> > How can I design XPath query, which would return whole <ENTITY>
> > element, if subelement <ATTRIBUTE> with attribute name=3D"ID" matches
> > some selected value.
>
> /RESPONSE/DATA/ENTITY[ATTRIBUTE[@name =3D 'ID']/@value =3D 'foo']
>
> --
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 Martin Honnen --- MVP XML
> =C2=A0 =C2=A0 =C2=A0 =C2=A0http://msmvps.com/blogs/martin_honnen/

0
9/30/2009 11:57:39 AM
Try this:
//ATTRIBUTE[@ID=3D'10000307968']

On Sep 30, 4:32=C2=A0am, ciruliz <andis.ciru...@gmail.com> wrote:
> Btw, I am using XPathReader class, since I am working withlargexml
> document. I get "Can't get value" exception.
> Thx,
> =C2=A0A
>
> On Sep 30, 1:21=C2=A0pm, ciruliz <andis.ciru...@gmail.com> wrote:
>
>
>
> > Given followingXML:
>
> > <RESPONSE>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 <DATA
> > REQUEST_ID=3D"465466189C701F41E040007F01004D25E6B23D14793EB72753CE2387F=
85A57E=C2=AD5">
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ENTITY name=3D"Q_ARI_KLS">
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<ATTRIBUT=
E name=3D"ID" value=3D"10000307968" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ATTRIBUTE name=
=3D"NOSAUKUMS" value=3D"ABAB=C4=BBEVA" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0</ENTITY>
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ENTITY name=3D"Q_ARI_KLS">
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<ATTRIBUT=
E name=3D"ID" value=3D"10000323423" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <ATTRIBUTE name=
=3D"NOSAUKUMS" value=3D"CITSKAUTKAS" />
> > =C2=A0 =C2=A0 =C2=A0 =C2=A0</ENTITY>
> > </RESPONSE>
>
> > How can I design XPath query, which would return whole <ENTITY>
> > element, if subelement <ATTRIBUTE> with attribute name=3D"ID" matches
> > some selected value.
>
> > Something like this doesn't work: //DATA/ENTITY[ATTRIBUTE
> > [@value=3D"10000307968"]]
>
> > I will be thankfull for any suggestions!
> > Rgs,
> > =C2=A0Andis- Hide quoted text -
>
> - Show quoted text -

0
Chris2692 (2)
10/16/2009 6:08:58 PM
Reply:

Similar Artilces:

use continouse paper size 5.5X8.5 inchs for invoice
hi i have transfered from old pos system to MS RMS ,i have too much invoice paper size 5.5 X 8.5 inchs i do not want to descard it,is any invice templete that work on this paper size. best reqards ...

Linking queries on a report
Hello all, I built a number of queries that all tie to the same table. Each query sorts the data differently, but comes from the same data source. I would like to show the results of these queries on the same report, but I get and error message that the wizard can't connect the queries. How can I display multiple queries on the same report. I've tried subreports, but they don't seem to export as well. Thanks b Brennan What does "export" have to do with this? If I have multiple sets of results I want to show in one place, I create an empty "main"...

Invoice designer #5
I am using Small Business 2005 and I am trying to change some of the invoice designs. I do manage to save them, but my problem is that the text boxes and labels starts "jumping" around when I try to resize or move them. Sometimes it works fine, but other times the boxes resizes or moves in a matter that I can not control. Any tips for this problem With all the cool products that Microsoft has, their invoice designer is the biggest piece of puke ever. Microsoft Word 1.0 was more friendly than the invoice designer. As is publisher and access and so on.... "japasu" wr...

As in GP ver7.5 allow the removal of the SQL user integration
Ver 10 of GP enrypts the user password in such a way that the user can't login using their profile to any other SQL process. Ver 7.5 allowed the detaching of this encryption facility in GP. Removing this ability is a backward step. The ability to detach the GP to SQL user integration should be reinstated. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion i...

min query
Hi, How do I get the 2nd minimum value and the 3rd minimum from a table after I have done MIN query for the 1st minimum value? SELECT dbo_CON.SC, dbo_CON.SN, Min(dbo_CON.SQ) AS MinOfSQ FROM dbo_CON GROUP BY dbo_CON.SC, dbo_CON.SN HAVING (((dbo_CON.SC)<>49)); Thanks, Hi Jerry, This will give me three different SC SN records. I am looking for same SC SN records that has next min SQ. table SC SN SQ 1 100 1 1 100 2 1 100 3 1 100 ...

Need help with query summing hours
Tring to get total worked hours and total maintenance hours summary. I have a table with the clock hours WorkID WorkDate WorkEmployeeID WorkHours And have a maintenace table MaintID MaintDate MaintEmployeeID MaintHours Needing help combining the information to get summary something like this.. Date - Employee - Clock Hours - Maintenance Hours 1/1/10 Joe Billy Bob 8 6 1/1/10 Billy Joe Bob 8 7 Whay type of query do I need to build, any help would be great. Thanks -- Message posted via http://www.accessmo...

Payroll Posting Accounts #5
v9.0 / SQL2000 When you have the payroll posting accounts set up, how does GP know where to post transactions to, if only 2 of the 3 segments match? We have our accounts set up according to the following examples: ACCOUNTING > ACCOUNTING > SALARY ACCOUNTING > ALL > SALARY ALL > ACCOUNTING > ALL ALL > ALL > ALL Say if an employee had a transaction, and only the first 2 of the 3 segments match (ACCOUNTING > ACCOUNTING) Where would GP post the transaction amounts ? ...

5.5 server move
Just in the process of working my way through the Ed Crowley server move FAQ off swinc. Been hit by brain fade though. Created the replicas of the public folders to the new server and from the exchange server admin program can see that they are being used instead of the ones on the original server. The bit thats causing brain fade is how do i delete the replicas from the old server? Done this once b4 but was over 2 years ago and have slept since then/got a kiddie/bought a big fast bike any clues most appreciated -- Robb '97 Firestorm I am assuming you are using 5.5 to remove the repli...

Moving Unix aliases to Exchange 5.5
Is there a way to emulate the unix aliases on exchange? By Unix aliases do you mean multiple email addresses? Nue "pcgirl" <pcgirl@discussions.microsoft.com> wrote in message news:8521D3E6-2F11-408E-863B-A9911850D19A@microsoft.com... > Is there a way to emulate the unix aliases on exchange? ...

Exchange 5.5 and Public Contact Folder
We have a public folder that contains contact items. We'd like to know who creates each contact in the folder. Is there anyway to see who created an item in there? thanks if you change the view on the folder and add the "from" field, you should be able to see... "Steve" <sschmeg@yahoo.com> wrote in message news:OVaz%23mnxEHA.2752@TK2MSFTNGP11.phx.gbl... > We have a public folder that contains contact items. We'd like to know who > creates each contact in the folder. Is there anyway to see who created an > item in there? > > thanks > >...

5.5 uninstall after 2k3 upgrade
After migration from 5.5 to 2003. I went to the 5.5 box, put the cd in and unistalled. It is still showing in 2k3 system manger and now im getting errors in app log from ldap, ad connector looking for the old box. Do i need to reinstall 5.5 on my old box and use 5.5 admin to delete? I installed 5.5 admin on my new 2k3 box but dont know where how to use. I am 5.5 newbie..only know 2k3 There are a number of steps to take prior to decomissioning a 5.5 server in your type of upgrade/migration. http://www.microsoft.com/technet/prodtechnol/exchange/guides/Ex2k3DepGuide/d91c2065-99af-405...

Renaming recipeint exchange 5.5
I renamed an old recipeint account so the new employee could still have access to their old email. The directory name is still the name of the old employee. Is there a way to get that to match with the new name? Thanks again, Aaron Neunz "Aaron Neunz" <apn@rrbiznet.com> wrote: >I renamed an old recipeint account so the new employee could still have >access to their old email. The directory name is still the name of the old >employee. Is there a way to get that to match with the new name? > >Thanks again, >Aaron Neunz > No. There's no need either...

OWA 5.5 to Exchange 2003 Server
I've customized OWA 5.5 to emulate the custom message form we use in OL. This doenst appear to be as doable in OWA 2003. Is there a way to run OWA 5.5 against the EX2003 server? On a clone of the old OWA 5.5 sever I've tried modifying the org, site, and server entries under the MSExchangeWEB\Parameters entries to point to the EX2003 server but I get "The Microsoft Exchange server is down or the HTTP service has been disabled...". Originally I tried it when I tried migrating and I thought it worked, but now I loaded EX2003 from scratch and subsequently it doesnt. If I ...

Unread Messages #5
Hello. For a few days now I've been having trouble with the view in the "unread messages" folder (I am using OL2003 in German so I don't know if unread messages is the correct name here, but it's the folder with the magnifying glass on the icon in the list of the favorite folders. Furthermore I'd like to apologize for my poor English). Usually I let Outlook show me all unread messages sorted by folders there, but when I view the "unread messages" now, all folders therein are "collapsed", therefor only the names of the folders are shown and ...

Moving CRM from one server to another error at step 5
I've only got one server on the network. I wanted to reinstall it from scratch as when CRM was installed Exchange had not been and is coming up with a corrupt metabase if I try to install. The server has 2 disks mirrored, so I've broken the mirror and now have the old installation on one disk and a brand new install on the other. The machine name, domain name etc are identical. I've gone through the redeployment guide, but on step 5 the process bombs with a series of errors: 06/14/2005 15:39:44 Backup BusinessUnitBase table. 06/14/2005 15:39:45 Could not use view or function...

Different queries but the same?
Hi Everyone, Access 2003. I accidently double clicked on the wrong thing in a new query based on another query. In the query grid, I added the qryVentThpyWithinLastArea and double clicked on the *. It only filled one column of my grid but when I ran the query, it showed all the fields from the query. I then dragged down Area field and added my criteria. I had been taught to double click on the blue title bar and then drag all the fields to the grid then add my criteria. Both ways give me the same data. What is the differnce? I pasted the sql below so you can see what's going...

macro #5
i want to make a macro record saving a file but it has to be differnet name file on the sheet. example if i change the name on the cell the save got to be the same name too when i click on save the macro would be asign to a picture. try activeworkbook.SaveAs Filename:=range("a1") "guest" <anonymous@discussions.microsoft.com> wrote in message news:047f01c39a78$28ce7d40$a301280a@phx.gbl... > i want to make a macro record saving a file but it has to > be differnet name file on the sheet. example if i change > the name on the cell the save got to be the s...

graphs #5
I have a graph that contains over 60 products being graphed. When the graph is completed it is all a big mess you cant see what is what - please help In article <41EC72A8-36FA-4381-9FCB-C2647D7D54E4@microsoft.com>, Shari@discussions.microsoft.com says... > I have a graph that contains over 60 products being graphed. When the graph > is completed it is all a big mess you cant see what is what - please help > Help with what? What do you expect someone to suggest? The only things that come to mind are: (1) Increase the size of the chart (2) Reduce the amount of informati...

trim in query
Hi All I am trying to trim a leading space at the start of each field in my "Customers" table which is an Exel spreadsheet imported using "TransferSpreadsheet" After researching the internet I have been able to get this to work using, for example: CustomerName: Trim([F3]) in the Field line of a select query ("CustomersTrimQry"). My promlem is that when I append the data from "CustomersTrimQry" to the "Customers" table the space returns. Prior to using trim I ran 3 queries from the original "CustomersImport" table, "C...

Database SQL query
Sorry for this post here. If someone knows a group I can go to for this question, please let me know. I have a program in MFC that accesses and updates an Access database. The problem is I can't figure out how to add a field which contains a word with a single apostrophe ie (St. Vincent's). I'm using the CDaoDatabase and CDaoRecordset classes. I understand that DAO is interpreting the apostrophe as some type of terminator but there must be a way around the issue. MS Access has information on how to do it in Access VB but that doesn't seem to work in MFC. Thanks Ughh ...

Printing Labels #5
Can you use a roll of labels with MS Office? Specifically, can you rip off 6 labels, which would be approximately half a piece of paper, and feed it through a printer, while using MS Publisher or MS Word? You probably can, it will take some effort to setup the page correctly. Merging would be questionable. In page setup, select custom, input the label width and length plus one label more for the margin. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "LACE" <LACE@discussions.microsoft.com> wrote in message news:52...

MS query and Firebird
I am accessing a Firebird data base with MS Query into Excel. I am trying to change the column heading (column name) but as I writte a "Newname" in Column Heading MS Query dont accept. I try to change directlly the SQL statement with "AS" clause and without "AS" clause but MS Query dont accept. I dont know if the format of select statement is different in Firebird data base or is a problem with MS Query. JC. ...

<> data query
I have two tables and both have a field called tag_id. The first table "my2003" has about 5000 records. The second table "monitor2003" is a subset of table "my2003" and has about 3000 records. I need help building a query that will give me the records in table "my2003" where the "tag_id" field is <> to the "tag_id" field in the "monitor2003" table. Also which type of joining of the two tables is needed? Use the query wizard to create an unmatch record query that will list all the records in my2003 but are n...

Lookup #5
I am trying to label my bank info that I import into Excel. I have a column with the charge amount and a column with the recipient. I think a lookup table would work for this, but I need to have it check for wildcards. For example, the grocery chain is numbered here, so one might be GROCER 5454 and one may be GROCER 8724, so I need the function to look for GROCER*, right? Also, if it does not fit any category, how can I get it to use "Other"? Do I make that one just "*"? Mine is not working very well. Maybe my syntax is wrong. Any ideas? TIA ...

Upgrade 6.0->7.5->8.0 with PA
I am conducting a test upgrade from 6.0 to 8.0 through 7.5 with Project Accounting on a test server. The PA conversion to 7.5 took about 11 hours which is manageable but the conversion to 8.0 has already taken 3 days! and is still running. It has spent most of the time on one particular task and I wondered if anyone else has experienced this and if there is any way to improve the situation. All I can see from SQL Profiler is that the auto-procedure zDP_RM00401SS_1 is being called for each row of that table in turn sometimes many times for the same row. There are about 28000 rows and I&...