I am using LINQ-to-XSD to process XML elements named "labl", defined in the schema as follows:
<xs:complexType name="lablType" mixed="true">
...[definitions of optional elements and attributes]...
My actual XML file looks like this:
The text of the label
where <labl /> is defined in the schema as being of type "lablType". My current C# code using LINQ-to-XSD looks like this:
var lablNodes = from children in rootNode.Load("fileName").childNode
from labls in children.labl
foreach (lablType labl in lablNodes)
string label = ((XElement)labl).Value.Trim();
In other words, I am having to revert to untyped LINQ-to-XML to get the actual text of the <labl /> node, because the automatically generated class "lablType" does not seem to include a property for the text, only the attributes.
Is there a way to do this using typed variables/LINQ-to-XSD? Am I missing something simple?
Thanks in advance,