Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 

Go Back   XSL - XML - RSS Forums > XML General > .NET and XML

Tags:



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2008, 03:15 PM
Simon Woods
 
Posts: n/a

Default Re: Traversing XML with Linq to XML - newbie q





l_testSchema.Descendants("Column").Count gives me what I was after.

Thx


Simon Woods wrote:
> Hi
>
> I am struggling to navigate an XElement and I'm not sure what is going
> wrong. Here's my XML via vb's xml literals
>
> Dim l_testSchema = _
> <Mappings>
> <Definitions>
> <ItemGroup>
> <Parent>Table</Parent>
> <Name>Name</Name>
> </ItemGroup>
> <Item>
> <Parent>Column</Parent>
> <Name>Name</Name>
> <Type>Type</Type>
> </Item>
> </Definitions>
>
> <Data>
> <Table>
> <Name>MyTable</Name>
> <Columns>
> <Column>
> <Name>MyColumn1</Name>
> <Type>String</Type>
> </Column>
> <Column>
> <Name>MyColumn2</Name>
> </Column>
> <Column>
> <Name>MyColumn3</Name>
> </Column>
> <Column>
> <Name>MyColumn4</Name>
> </Column>
> <Column>
> <Name>MyColumn5</Name>
> </Column>
> <Column>
> <Name>MyColumn6</Name>
> </Column>
> </Columns>
> </Table>
> </Data>
> </Mappings>
>
> I'm basically wanting to use linq to traverse this but I'm struggling to
> get anything back
>
> e.g.
> l_testSchema.Elements("Columns").Count returns 0
> l_testSchema.Descendents(Columns").Count returns 1
>
> In fact I'm struggling to get any other result other than 0 or 1.
>
> Why is that the case? What am I missing?
>
> Thx
>
> Simon





Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Contact Us -|- XSL - XML - RSS Forums -|- Archive -|- Top -|-Rules/Disclaimer-|-Help/Support -|-Advertise
© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
All times are GMT. The time now is 12:17 PM.
Style Developed by Epic Designz