Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
First Linq To XML query - having problems
Message
 
À
14/04/2009 14:21:36
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Divers
Thread ID:
01394795
Message ID:
01394804
Vues:
56
>Here's my query:
>
>            var query = from m in _AdministrativeTabMappings.Elements("Mappings").Elements("Mapping")
>                        where m.Attribute("Page").Value == page
>                        select m;
>
>
>Query always returns a NullReferenceException. This works without the where clause. Page is a variable which I confirmed equals "bonds/administrator/AdministratorHome.aspx".

Page isn't an attribute, it's an element. An attribute would be something like:
<Page name="MyNameAttribute"Value</Page
I can't test this, but maybe something like this would work?
var query = from m in _AdministrativeTabMappings.Elements("Mappings").Decendants("Page")
                        where m.Value == page
                        select m;
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform