私の目標は、ValueReferenceノード、TimeInstant属性、およびtimePositionノードに含まれるデータを変数に保存することです。valueReferenceノードの値を取得できます(コメントされていないセクションは機能します)が、他の2つは取得できません。どんな助けでも大歓迎です。
これが私が取り組んでいるコードです:
public void LinqToXml()
{
    XNamespace sosNamespace = XNamespace.Get("http://www.opengis.net/sos/2.0");
    XNamespace fesNamespace = XNamespace.Get("http://www.opengis.net/fes/2.0");
    XNamespace gmlNamespace = XNamespace.Get("http://www.opengis.net/gml/2.0");
    var root = XElement.Load(@"C:\Working Directory\OGCSOS.Service\OGCSOS.Service\Resources\GetObservation_TemporalFilter.xml");
    var a = (from level in root.Descendants(sosNamespace + "temporalFilter")
             select new
             {
                 valueReference = (string)level.Descendants(fesNamespace + "After")
                                               .Elements(fesNamespace + "ValueReference")
                                               .First(),
                 /*timeInstant = (string)level.Descendants(fesNamespace + "After")
                                               .Elements(gmlNamespace + "TimeInstant")
                                               .Attributes(gmlNamespace + "id")
                                               .First()*/
                 /*timePosition = (string)level.Descendants(fesNamespace + "After")
                                             .Elements(gmlNamespace + "TimeInstant")
                                             .First()*/
             }).ToList();
そして、これが私が読み込もうとしているXMLです。
    <?xml version="1.0" encoding="UTF-8"?>
<sos:GetObservation xmlns="http://www.opengis.net/sos/2.0" service="SOS" version="2.0.0" 
                    xmlns:sos="http://www.opengis.net/sos/2.0" xmlns:fes="http://www.opengis.net/fes/2.0" 
                    xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:swe="http://www.opengis.net/swe/2.0" 
                    xmlns:swes="http://www.opengis.net/swes/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sos/2.0
http://schemas.opengis.net/sos/2.0/sos.xsd">
    <!--identifier of an offering-->
    <offering>HG.Logger@DJK001</offering>
    <!--identifier of an observed property-->
    <observedProperty>HG</observedProperty>
    <!--optional temporal filter restricting the results which shall be returned-->
    <temporalFilter>
        <fes:After>
            <fes:ValueReference>phenomenonTime</fes:ValueReference>
            <gml:TimeInstant gml:id="startPosition">
                <gml:timePosition>2008-03-01T17:44:15.000+00:00</gml:timePosition>
            </gml:TimeInstant>
        </fes:After>
    </temporalFilter>
    <featureOfInterest>DJK001</featureOfInterest>
</sos:GetObservation>