Consider the following two pieces from an XSD.
1.
<xs:complexType name="CurrencyAndAmount">
<xs:simpleContent>
<xs:extension base="ActiveOrHistoricCurrencyAndAmount_SimpleType">
<xs:attribute name="Ccy" type="CurrencyCode" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
2.
<xs:simpleType name="CurrencyCode">
<xs:restriction base="xs:string">
<xs:maxLength value="3"/>
<xs:pattern value="[A-Z]{3,3}"/>
</xs:restriction>
</xs:simpleType>
I have the value of the "type" attribute in the first complexType
element group.
I am trying to get the element group where the "name" attribute has the same value than the the "type" attribute in group 1.
I have this LINQ query...
IEnumerable<XElement> a = xsdDocument.Descendants()
.Where(x => x.Attribute("name").Value == "CurrencyCode");
... but it throws a NullReferenceException