Multiple attribute value

C#, web form, VS 2005.  Thank you in advance for reading/helping.

Working with XML returned from a web service,  have some nodes that have the same name but different attribute values.

Ex.
<ReceivedRecords pk=""/>
<ReceivedRecords pk="1234.56"/>
<ReceivedRecords pk="789.00"/>

I'm setting the value of the XML to a text box using xPath...here is the code:

//Grab value of returned XML at this location.
XmlNodeList xmn30 = mydoc.SelectNodes("/Envelope/Body/Response/Contract/ReceivedRecords/@pk");
//Output the results to a text box
txtReceivedRecords.Text = (xmn30[0].InnerText);

Nothing appears in the box...normally, using this same code on different nodes MINUS the /@pk, I get a value...

Ex
<ContractNumber>12345</ContractNumber>

//Grab value of returned XML at this location.
XmlNodeList xmn10 = mydoc.SelectNodes("/Envelope/Body/Response/Contract/ContractNumber");
//Output the results to a text box
txtContractNumber.Text = (xmn10[0].InnerText);

Now I know that the xmn30 from above does indeed contain something...in fact, I know it contains at least 2 items....to test this, I have tried setting testvalue below to 0,1, 2, and 3....I get my "something is here bigger" up until I change testvalue to 3 or greater...

        if (xmn30.Count > testvalue)
        {
            txtReturned.Text = "";
            txtReturned.Text = "something is here bigger",;
       
        }

So I guess, how the heck do I get the values of the "pk"...the attribute of the node?  Especially since there are more than 1 but with the same attribute name?

Any help would really help.  Thank you all!

-Corby-

-Corby-
0
Corby
8/10/2006 1:12:50 PM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

2 Replies
699 Views

Similar Articles

[PageSpeed] 22
Get it on Google Play
Get it on Apple App Store

If the first @pk attribute value is indeed an empty string, as you show in your sample XML, then it would make sense that your xmn30[0].InnerText would not put anything into the textbox (because it's only showing the value of your NodeList element #0, which would be an empty string). 

Have you tried with xmn30[1].InnerText (or, as I would prefer for attributes, xmn30[1].Value)?


JasonF
A View Inside My Head
0
JasonFollas
8/14/2006 2:51:00 PM
Worked great!  Thanks so much for the tip!

-Corby-
0
Corby
8/14/2006 7:51:11 PM
Reply:

Similar Artilces:

add values to multiple-valued attribute error
try add multiple values to a mulitple-valued attribute (that can be done with a GUI / LDIF).However, use following code, I get error when insert multiple values for Properties("mgrpRFC822MailMember") (but it works with only one entry)Any help is very welcome.Thx Dim de1 = New DirectoryEntry("LDAP://" & ldapServerName & _            "/ou=MailGroup,dc=pcihl,dc=com", "cn=Manager,dc=pcihl,dc=com", "secret", AuthenticationTypes.ServerBind)            Dim newLstEntry As Direct...

Multiple values for multiple items insert using c#.net
Hello, I have an application that allows the user to insert multiple values all related to the same item that reside in multiple tables. example base information, style general details, parts of a style etc. a single table binds them all together using foreignkeyid's. This is kind of a slow process, because they might have to create a set of styles in different colors etc on the same day. say 15 items which are different only in color. Now, I' m having to design a form which will let them insert all 15 items at once.  I dont know how to show you the lay out I have?? My idea abo...

Mutli-valued attribute to multi-valued attribute
We want to synchronize a multi-valued attribute (created by our own) to a multi-valued attribute in the other edirectory store. But when we are adding attributes we only have the changed values. The previous one is lost. When deleting one value in the Identity Vault then it removes the attribute from the object. Any ideas ? > We want to synchronize a multi-valued attribute (created by our own) to a > multi-valued attribute in the other edirectory store. But when we are > adding attributes we only have the changed values. The previous one is > lost. When deleting ...

Need to parse XML file based on tag values and after matching inital attributes and values
 If I have the following XML File<AccountRequest StaffID="1234">    <KeyValue>1367932986</KeyValue>    <RequestorName>sam1</RequestorName>    <LoginName>Sam</LoginName>    <Extension>Sam</Extension>    <MailStop>Sam</MailStop>    <Date>Sam</Date>    <JobTitleTextBox>Sam</JobTitleTextBox>    <EmploymentType>    </EmploymentType>    <DeptNo>Sam</DeptNo>    &l...

How to retrive multiple XML node values from SQL2005 XML datatype? (Sample DB Schema Given)
Hi all,  I'm having two tables in SQL 2005 as below and column SearchCriteriaXML in SearchCriteria table is in XML datatype Table : SearchCriteria     SearchCriteriaId SearchName SearchCriteriaXML 1 Company Name <Criterias><Criteria><ColumnName>Company.CompanyName</ColumnName><Condition>LIKE</Condition></Criteria><Criteria>><ColumnName>Company.CountryId</ColumnName><Condition>=</Condition></Criteria></Criterias> 2 Project Name <XML><Field...

One attribute value to two attributes/ values in eDir
Collective, I have a very interesting issue. I have the need to break one attribute that is in AD (ADval1) to two attributes in eDir (attrval1 and attrval2) . Basically what I want to do is take ADval1 and break that data into the two other attributes, attrval1 and attrval2. The attribute in AD looks like this: AD attribute value data 1 | value data 2 In eDir it looks like this: eDir attribute 1 vlaue data 1 eDir attribute 2 value data 2 I don't know if that's clear, when it was explained to me it was a white board. Has anyone tried this or have any id...

Problem with displaying attributes of xml into nested repeater..How to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure)
Hello every one I am facing a problem to display attribute of parent node and corresponding child nodes.Suppose I have to display Label attributes of all <ScreenToSupport>. There can be multiple <ScreenToSupport> inside parent node <ScreensToSupport>. In this case I have to display Label 'rediffHomePage' and 'rediffHomePage1' of both <ScreenToSupport> node. There is no issue to diplay these two Label. I done this by taking a repeater control.But problem arrises when I have to display corresponding Label of 'FieldsToSupport/FieldToSupport' of &l...

How to get XML attribute value from smart tag e.g '<thistag value = "xyz" />'
Hi all, I am still new in C# xml progamming.... I will like to retrieve the values of an xml tag attibutes with multiple start/abrreviated tags.....  E.g..... My string XML looks like  the following..... : <root> <persons>    <person name = 'name1' age='21'/>   <person name = 'name2 ' age='22'/>     <person name = 'name3' age='23'/>   </persons> </root> I want to loop through all person tag and  retrieve the name a...

I cannot list multiple values for the same attribute
--00504502e1b31c762a04aa3cd03d Content-Type: text/plain; charset=ISO-8859-1 Hi everyone, I am new to perl-ldap and like it very much, however I have a problem I cannot solve by myself (or using google). I have some attributes with multiple values in the same entry, such as: description: abc description: def description: ghi .... I perform a search using a base & filter, then try to list all attributes and their values in a foreach loop: foreach my $entry ($searchResults->entries) { foreach my $attr ($entry->attributes) { for ($attr) { if (/^...

How to replace multiple values of an attribute
Hi, I spent my whole afternoon searching for a solution for replacing all values of an attrbute by an array. So what i got is basicly an reference $values to an array of my new values. I could iterate through the array using foreach my $value (@$values) {...} The code that works is: my $mesg1=$backendConn->modify($dn, replace => [$attr, ["Hello", "Test"]] ); But i need to be more flexible and tried today a lot of variations of... my $mesg1=$backendConn->modify($d...

Adding an attribute with multiple values.
Hi, It maybe a simple question. But I'm having some troubles with it. I'm using Net::LDAP::Entry and I'm trying to add an attribute with multiple values. Unfortunately, until now it didn't work out. A simple example: attr: value1 attr: value2 Just calling entry's add method multiple times does not worked out. Replace method didn't work out ether. Maybe I'm doing something wrong. Could someone give me an better idea or exemple on how to solve this problem? Thanks in advance, -- Relho de Couro On 11/11/04 8:15 pm, Relho de Couro <r...

Returning Multiple Value Attributes
--LTeJQqWS0MN7I/qa Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi List, I am using Net::LDAP and i am trying to return an attribute in a d= n that has multiple values. When I do the search and use $entry->get_value(= $attr ) it only returns the one value. Is there a way returning multiple a= ttribute values? Many thanks --=20 slr, ISP Systems Specialist Telkom Internet #qmail-ldap @ irc.freenode.net This message has been made from 100% recycled bits. ----BEGIN GEEK CODE BLOCK----- Version: 3.12...

Increment value of attribute in XML
Hi, I have the following XML file: <persits> <counter hits="1105" lasthit="24-mar-06 09:00" prevhit="23-mar-06 19:00" lastreset="14-feb-06 12:00" /></persist> I would like to read this file, increment the value of the 'Hits' attribute, then write the amended file back. So far, I have got: Const HITCOUNTERXMLFILE = "C:\App_Data\Counter.xml" Dim myDS = New XmlDataSource()    myDS.readxml(HITCOUNTERXMLFILE, XmlReadMode.ReadSchema)    ...    myDS.writexml(HITCOUNTERXMLFILE, XmlWriteMode.WriteSchema) This works fi...

.NET XML attribute question
I'm creating a Soap Envelope and I've run into a small problem.  Here is some code : Dim se as New SoapEnvelope se.loadXml(xmlStr) Dim rootElem as XmlElement = se.DocumentElement rootElem.SetAttribute("version", "2.0") rootElem.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance") rootElem.SetAttribute("xsi:schemaLocation","http://somewhere.com") ' More elements added here  When the Docuement is created and saved it is missing the "xsi" prefix on the schemaLocation attribute.  So instead of  xsi:schemaLocation="blah blah blah" , I...

Web resources about - Multiple attribute value - asp.net.xml-datasource

Attribute - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Template:Attributes of God - Wikipedia, the free encyclopedia
Language: English Română Home Random Template:Attributes of God Part of a series on the Attributes of God Aseity Eternity Graciousness Holiness ...

Six Attributes Of The Perfect Facebook Page Administrator
So, here’s the thing: In many ways, hiring a Facebook page administrator is akin to hiring a poster child for your brand. This trusted manager ...

PANDA: Pose Aligned Networks for Deep Attribute Modeling - Facebook
We propose a method for inferring human attributes (such as gender, hair style, clothes style, expression, action) from images of people under ...

Facebook announces data partnerships to help advertisers target users by offline purchases and attributes ...
... will anonymously match data from consumer loyalty programs with user profiles in order to target ads by offline purchase habits and other attributes. ...

New Study Attributes Rapid Ageing Mainly To Environment Factors
New study explains why some people age faster than others.

Should I use the nofollow attribute on internal links? - YouTube
Regarding "nofollow" on internal links: Does it hurt? Does it help? I read different comments from Matt on this matter over time. What's the ...

Justin Trudeau attributes abortion stance to father's example
Liberal Leader Justin Trudeau says he is following an example set by his famous father when it comes to his position on election candidates and ...

Obama attributes western U.S. wildfires to climate change
... that has burned nearly 400 square miles in the north-central part of Washington state, along with blazes in other Western areas, can be attributed ...

Fifty Shades Of Grey Baby Births: Windsor Hospital Sees Spike In Births, Attribute Book
A significant spike in baby births at a hospital in Windsor, Ontario, has been attributed to the book Fifty Shades of Grey, which has become ...

Resources last updated: 12/14/2015 6:05:14 AM