Error selecting nodes
- From: "barbaraann"<hjdhf@xxxxxxxxx>
- Date: Wed, 31 May 2006 14:56:56 -0500
I am new to dotnet and I am having trouble reading an xml file.
"The expression passed to this method should result in a NodeSet."
Here is my xml file:
<?xml version="1.0" encoding="Windows-1252" ?>
<root>
<Prov>
<Abrev>AB</Abrev>
<Postals>
<Postal>T</Postal>
</Postals>
</Prov>
<Prov>
<Abrev>BC</Abrev>
<Postals>
<Postal>V</Postal>
</Postals>
</Prov>
....
<Prov>
<Abrev>ON</Abrev>
<Postals>
<Postal>K</Postal>
<Postal>L</Postal>
<Postal>M</Postal>
<Postal>N</Postal>
<Postal>P</Postal>
</Postals>
</Prov>
</root>
I want to read through it for the Abrev and get all the Postal values for it.
I load my file into an xml document and use
XmlNodeList nodeList = xml.SelectNodes("/root/Prov/[@Abrev='" + strProv +
"']/Postals");
to retrieve the node for the variable passes to this function.
Is my syntax incorrect or my xml baddly formed or am I just barking up the
wrong tree?
Thanks in advance.
.
- Prev by Date: xsd enumeration and pattern
- Next by Date: C# windows service freezes on System.Diagnostics.Process.Start(info)
- Previous by thread: xsd enumeration and pattern
- Next by thread: C# windows service freezes on System.Diagnostics.Process.Start(info)
- Index(es):
Relevant Pages
|