problem z odczytaniem xmla

0

Witajcie.
Jak dobrac się do wyróżnionych na czerwono wartości w pponiższym dokumencie xml? prouje probuje i mi nie wychodzi :/
Bede wdzięczny za pomoc.

<?xml version="1.0" ?>
  • <sensorml xmlns="http://www.opengis.net/sensorML" xmlns:swe="http://www.opengis.net/swe" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" xsi:schemalocation="http://www.opengis.net/sensorML http://vast.uah.edu/schemas/sensorML/1.0.30/base/sensorML.xsd">
  • <system id="STACJA_POGODOWA"> <stacja xlink:href="DS1WW.xml" />
  • <product id="temperature">
  • <identifiedas> <identifier type="shortName">Temperatura</identifier> </identifiedas> <observable xlink:href="DS1WW.xml#temperature" /> <locatedusing xlink:href="#sensorLocation" />
  • <derivedfrom>
  • <responsemodel id="temperature">
  • <usesparameters>
  • <basicresponse>
  • <dynamicrange> <typedquantityrange uom="DS1WW.xml#celsius" type="DS1WW.xml#temperature">- 55 +125</typedquantityrange> </dynamicrange>
  • <relativeaccuracy> <typedquantityrange uom="DS1WW.xml#units" type="DS1WW.xml#temperature">-0.5 +0.5</typedquantityrange> </relativeaccuracy>
  • <resolution> <typedquantity uom="DS1WW#celsius" type="DS1WW#temperature">0.1</typedquantity> </resolution>
  • <sampleperiod> <quantity uom="DS1WW#seconds">-1.4</quantity> </sampleperiod> </basicresponse> </usesparameters> </responsemodel> </derivedfrom> </product>
  • <measures>
  • <product id="windSpeed">
  • <identifiedas> <identifier type="shortName">Predkosc wiatru</identifier> </identifiedas> <observable xlink:href="DS1WW.xml#windSpeed" /> <locatedusing xlink:href="#sensorLocation" />
  • <derivedfrom>
  • <responsemodel id="windSpeed">
  • <usesparameters>
  • <basicresponse>
  • <dynamicrange> <typedquantityrange uom="DS1WW.xml#meterPerSecond" type="DS1WW.xml#windSpeed">0 100</typedquantityrange> </dynamicrange>
  • <relativeaccuracy> <typedquantityrange uom="DS1WW.xml#percentage" type="DS1WW.xml#windSpeed">-5 +5</typedquantityrange> </relativeaccuracy>
  • <resolution> <typedquantity uom="DS1WW#metersPerSecond" type="DS1WW#windSpeed">0.1</typedquantity> </resolution>
  • <sampleperiod> <quantity uom="DS1WW#seconds">0.4</quantity> </sampleperiod> </basicresponse> </usesparameters> </responsemodel> </derivedfrom> </product>
  • <product id="windDirection">
  • <identifiedas> <identifier type="shortName">Kierunek wiartru</identifier> </identifiedas> <observable xlink:href="DS1WW.xml#windDirection" /> <locatedusing xlink:href="#sensorLocation" />
  • <derivedfrom>
  • <responsemodel id="windDirection">
  • <usesparameters>
  • <basicresponse>
  • <dynamicrange> <typedquantityrange uom="DS1WW.xml#rhumb" type="DS1WW.xml#windDirection">0 15</typedquantityrange> </dynamicrange>
  • <relativeaccuracy> <typedquantityrange uom="DS1WW.xml#units" type="DS1WW.xml#windDirection">-1 +1</typedquantityrange> </relativeaccuracy>
  • <resolution> <typedquantity uom="DS1WW#rhumb" type="DS1WW#windDirection">1</typedquantity> </resolution>
  • <sampleperiod> <quantity uom="DS1WW#rhumb">16</quantity> </sampleperiod> </basicresponse> </usesparameters> </responsemodel> </derivedfrom> </product> </measures> </system> </sensorml>

mam nadzieje ze cos z tego widac, ale nie wiedzialem jak to lepiej wstawic...
Pozdrawiam

0

System.Xml.XmlDocument + GetElementsByTagName("Quantity").

0

Jeśli wiesz dokładnie gdzie chcesz się dostać to myślę, że to powinno pomóc
string Opis = null;
XmlDocument doc = new XmlDocument();
doc.Load(@XmlPath); //np: doc.Load(@"C:\MojXml.xml")

        XmlNode xn = doc.SelectSingleNode("/System/Product[id='temperature']/deriverForm/ResponseModel[id='temperature']/usesParameters/BasicResponse/samplePeriod/Quantity[uom='DS1WW#seconds']");
        if (xn != null)
            Opis = xn.InnerText;

1 użytkowników online, w tym zalogowanych: 0, gości: 1