Results 1 to 6 of 6

Thread: [RESOLVED] XML help: get subnode by value

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    2,012

    Resolved [RESOLVED] XML help: get subnode by value

    Suppose I have the following XML code:

    Code:
    Dim assembliesElement As XElement = <Job>
                                          <Assemblies>
                                           <Assembly>
                                             <Properties>
                                              <General>
                                                <Name>TS_Upper_1S</Name>
                                                <Type>Standard</Type>
                                              </General>
                                            </Properties>
                                          </Assembly>
                                          <Assembly>
                                            <Properties>
                                              <General>
                                               <Name>TS_Lower_2S</Name>
                                                <Type>Standard</Type>
                                              </General>
                                            </Properties>
                                          </Assembly>
                                          <Assembly>
                                            <Properties>
                                              <General>
                                                <Name>TS_Upper_1D</Name>
                                                <Type>Standard</Type>
                                              </General>
                                           </Properties>
                                          </Assembly>
                                          <Assembly>
                                           <Properties>
                                              <General>
                                                <Name>TS_Upper_3F</Name>
                                                <Type>Standard</Type>
                                              </General>
                                            </Properties>
                                          </Assembly>
                                        </Assemblies>
                                       </Job>
    I want to get the Assembly subnode by specifying the Name value. So for example, I want to specify "TS_Upper_1D" and get this subnode:

    Code:
                                          <Assembly>
                                            <Properties>
                                              <General>
                                                <Name>TS_Upper_1D</Name>  <-- retrieve by this value
                                                <Type>Standard</Type>
                                              </General>
                                           </Properties>
                                          </Assembly>
    There could be several dozen <Assembly> nodes under the <Assemblies> node. How would I do this? Thanks...
    Last edited by nbrege; Mar 20th, 2024 at 03:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width