Как найти конкретный узел в XML с помощью VB.NET
У меня есть xml-файл, как указано ниже.
<?xml version="1.0"?> <CableSystem xmlns="http://pkinetics.com/oasys.net"> <Cable ID="23646_00_M727440" Desc="Cable" AnalysisSetup="OFCData1"> <CableSetup> <OTDRSetups> <OTDRSetup ID="SM 2 Wavelength"> <AdditionalRange>5000</AdditionalRange> <Range>0</Range> <RangeMode>LengthBased</RangeMode> <OTDRWavelengthSetup Availability="EnabledAlways" WavelengthID="1310"> <AverageCounts>256</AverageCounts> <AverageMode>NoiseBased</AverageMode> <AverageNoise>0.01</AverageNoise> <AverageNoiseLocation>500</AverageNoiseLocation> <AverageNoiseTimeout>3</AverageNoiseTimeout> <AverageTime>1</AverageTime> <Bandwidth>1</Bandwidth> <Gain>-1</Gain> <PointSpacing>4</PointSpacing> <Pulsewidth>10</Pulsewidth> <Wavelength>1310</Wavelength> </OTDRWavelengthSetup> <OTDRWavelengthSetup Availability="EnabledAlways" WavelengthID="1550"> <AverageCounts>256</AverageCounts> <AverageMode>NoiseBased</AverageMode> <AverageNoise>0.01</AverageNoise> <AverageNoiseLocation>500</AverageNoiseLocation> <AverageNoiseTimeout>3</AverageNoiseTimeout> <AverageTime>1</AverageTime> <Bandwidth>1</Bandwidth> <Gain>-1</Gain> <PointSpacing>4</PointSpacing> <Pulsewidth>10</Pulsewidth> <Wavelength>1550</Wavelength> </OTDRWavelengthSetup> </OTDRSetup> </OTDRSetups> <AnalysisSetups> <AnalysisSetup ID="OFCData1"> <AnalysisWavelengthSetup WavelengthID="1310"> <AnalysisParams> <EndLossThresh>3</EndLossThresh> <MaxAttenuation>0.69999999999999984</MaxAttenuation> <MinAttenuation>0.1</MinAttenuation> <Sensitivity>0.01</Sensitivity> <Wavelength>1310</Wavelength> <WindowWidth>1000.0000000000002</WindowWidth> <WindowStep>200.00000000000003</WindowStep> <WindowStartOffset>300.00000000000006</WindowStartOffset> <WindowStopOffset>100.00000000000001</WindowStopOffset> <WindowStepAround>true</WindowStepAround> </AnalysisParams> <Limits Aspect="Unidirectional"> <Attenuation> <MaxFail>0.4</MaxFail> <MaxFlag>0.37999999999999995</MaxFlag> <MinFlag>0.31999999999999995</MinFlag> <MinFail>0.29999999999999993</MinFail> </Attenuation> <BufferLoss> <MaxFail>1.5</MaxFail> <MaxFlag>1</MaxFlag> <MinFlag>-0.08</MinFlag> <MinFail>-1</MinFail> </BufferLoss> <BufferReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </BufferReflectance> <FiberLength> <MaxFail>0.05</MaxFail> <MaxFlag>0.015</MaxFlag> <MinFlag>-0.015</MinFlag> <MinFail>-0.05</MinFail> </FiberLength> <LsaPointDeviation> <MaxFail>1</MaxFail> <MaxFlag>0.04</MaxFlag> </LsaPointDeviation> <EventLoss> <MaxFail>0.08</MaxFail> <MaxFlag>0.05</MaxFlag> <MinFlag>-0.05</MinFlag> <MinFail>-0.08</MinFail> </EventLoss> <EventReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </EventReflectance> <WindowAttenuation> <MaxFail>0.4</MaxFail> <MaxFlag>0.37999999999999995</MaxFlag> <MinFlag>0.31999999999999995</MinFlag> <MinFail>0.29999999999999993</MinFail> </WindowAttenuation> <WindowUniformity> <MaxFail>0.019999999999999997</MaxFail> <MaxFlag>0.0099999999999999985</MaxFlag> <MinFlag>-0.0099999999999999985</MinFlag> <MinFail>-0.019999999999999997</MinFail> </WindowUniformity> </Limits> <Limits Aspect="Bidirectional"> <Attenuation> <MaxFail>0.4</MaxFail> <MaxFlag>0.37999999999999995</MaxFlag> <MinFlag>0.31999999999999995</MinFlag> <MinFail>0.29999999999999993</MinFail> </Attenuation> <BufferLoss> <MaxFail>1.5</MaxFail> <MaxFlag>1</MaxFlag> <MinFlag>-0.08</MinFlag> <MinFail>-1</MinFail> </BufferLoss> <BufferReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </BufferReflectance> <FiberLength> <MaxFail>0.05</MaxFail> <MaxFlag>0.015</MaxFlag> <MinFlag>-0.015</MinFlag> <MinFail>-0.05</MinFail> </FiberLength> <LsaPointDeviation> <MaxFail>1</MaxFail> <MaxFlag>0.04</MaxFlag> </LsaPointDeviation> <EventLoss> <MaxFail>0.08</MaxFail> <MaxFlag>0.05</MaxFlag> <MinFlag>-0.05</MinFlag> <MinFail>-0.08</MinFail> </EventLoss> <EventReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </EventReflectance> <WindowAttenuation> <MaxFail>0.4</MaxFail> <MaxFlag>0.37999999999999995</MaxFlag> <MinFlag>0.31999999999999995</MinFlag> <MinFail>0.29999999999999993</MinFail> </WindowAttenuation> <WindowUniformity> <MaxFail>0.019999999999999997</MaxFail> <MaxFlag>0.0099999999999999985</MaxFlag> <MinFlag>-0.0099999999999999985</MinFlag> <MinFail>-0.019999999999999997</MinFail> </WindowUniformity> </Limits> </AnalysisWavelengthSetup> <AnalysisWavelengthSetup WavelengthID="1550"> <AnalysisParams> <EndLossThresh>3</EndLossThresh> <MaxAttenuation>0.5</MaxAttenuation> <MinAttenuation>0.1</MinAttenuation> <Sensitivity>0.01</Sensitivity> <Wavelength>1550</Wavelength> <WindowWidth>999.52273811958833</WindowWidth> <WindowStep>199.90454762391769</WindowStep> <WindowStartOffset>299.85682143587655</WindowStartOffset> <WindowStopOffset>99.952273811958847</WindowStopOffset> <WindowStepAround>true</WindowStepAround> </AnalysisParams> <Limits Aspect="Unidirectional"> <Attenuation> <MaxFail>0.24999999999999997</MaxFail> <MaxFlag>0.22999999999999998</MaxFlag> <MinFlag>0.16999999999999998</MinFlag> <MinFail>0.14999999999999997</MinFail> </Attenuation> <BufferLoss> <MaxFail>1.5</MaxFail> <MaxFlag>1</MaxFlag> <MinFlag>-1</MinFlag> <MinFail>-2</MinFail> </BufferLoss> <BufferReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </BufferReflectance> <FiberLength> <MaxFail>0.05</MaxFail> <MaxFlag>0.015</MaxFlag> <MinFlag>-0.015</MinFlag> <MinFail>-0.05</MinFail> </FiberLength> <LsaPointDeviation> <MaxFail>0.05</MaxFail> <MaxFlag>0.04</MaxFlag> </LsaPointDeviation> <EventLoss> <MaxFail>0.25</MaxFail> <MaxFlag>0.05</MaxFlag> <MinFlag>-0.05</MinFlag> <MinFail>-0.08</MinFail> </EventLoss> <EventReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </EventReflectance> <WindowAttenuation> <MaxFail>0.24999999999999997</MaxFail> <MaxFlag>0.22999999999999998</MaxFlag> <MinFlag>0.16999999999999998</MinFlag> <MinFail>0.14999999999999997</MinFail> </WindowAttenuation> <WindowUniformity /> </Limits> <Limits Aspect="Bidirectional"> <Attenuation> <MaxFail>0.24999999999999997</MaxFail> <MaxFlag>0.22999999999999998</MaxFlag> <MinFlag>0.16999999999999998</MinFlag> <MinFail>0.14999999999999997</MinFail> </Attenuation> <BufferLoss> <MaxFail>1.5</MaxFail> <MaxFlag>1</MaxFlag> <MinFlag>-1</MinFlag> <MinFail>-2</MinFail> </BufferLoss> <BufferReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </BufferReflectance> <FiberLength> <MaxFail>0.05</MaxFail> <MaxFlag>0.015</MaxFlag> <MinFlag>-0.015</MinFlag> <MinFail>-0.05</MinFail> </FiberLength> <LsaPointDeviation> <MaxFail>0.05</MaxFail> <MaxFlag>0.04</MaxFlag> </LsaPointDeviation> <EventLoss> <MaxFail>0.08</MaxFail> <MaxFlag>0.05</MaxFlag> <MinFlag>-0.05</MinFlag> <MinFail>-0.08</MinFail> </EventLoss> <EventReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </EventReflectance> <WindowAttenuation> <MaxFail>0.24999999999999997</MaxFail> <MaxFlag>0.22999999999999998</MaxFlag> <MinFlag>0.16999999999999998</MinFlag> <MinFail>0.14999999999999997</MinFail> </WindowAttenuation> <WindowUniformity /> </Limits> </AnalysisWavelengthSetup> <AnalysisWavelengthSetup WavelengthID="1625"> <AnalysisParams> <EndLossThresh>3</EndLossThresh> <MaxAttenuation>0.5</MaxAttenuation> <MinAttenuation>0.10000000000000002</MinAttenuation> <Sensitivity>0.01</Sensitivity> <Wavelength>1625</Wavelength> <WindowWidth>999.1821155943295</WindowWidth> <WindowStep>199.8364231188659</WindowStep> <WindowStartOffset>299.75463467829883</WindowStartOffset> <WindowStopOffset>99.918211559432947</WindowStopOffset> <WindowStepAround>true</WindowStepAround> </AnalysisParams> <Limits Aspect="Unidirectional"> <Attenuation /> <BufferLoss> <MaxFail>1.5</MaxFail> <MaxFlag>1</MaxFlag> <MinFlag>-1</MinFlag> <MinFail>-2</MinFail> </BufferLoss> <BufferReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </BufferReflectance> <FiberLength> <MaxFail>0.05</MaxFail> <MaxFlag>0.015</MaxFlag> <MinFlag>-0.015</MinFlag> <MinFail>-0.05</MinFail> </FiberLength> <LsaPointDeviation> <MaxFail>0.05</MaxFail> <MaxFlag>0.04</MaxFlag> </LsaPointDeviation> <EventLoss> <MaxFail>0.25</MaxFail> <MaxFlag>0.05</MaxFlag> <MinFlag>-0.05</MinFlag> <MinFail>-0.08</MinFail> </EventLoss> <EventReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </EventReflectance> <WindowAttenuation> <MaxFail>0.25</MaxFail> <MaxFlag>0.23</MaxFlag> <MinFlag>0.17</MinFlag> <MinFail>0.15</MinFail> </WindowAttenuation> <WindowUniformity /> </Limits> <Limits Aspect="Bidirectional"> <Attenuation> <MaxFail>0.25</MaxFail> <MaxFlag>0.23</MaxFlag> <MinFlag>0.17</MinFlag> <MinFail>0.15</MinFail> </Attenuation> <BufferLoss> <MaxFail>1.5</MaxFail> <MaxFlag>1</MaxFlag> <MinFlag>-1</MinFlag> <MinFail>-2</MinFail> </BufferLoss> <BufferReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </BufferReflectance> <FiberLength> <MaxFail>0.05</MaxFail> <MaxFlag>0.015</MaxFlag> <MinFlag>-0.015</MinFlag> <MinFail>-0.05</MinFail> </FiberLength> <LsaPointDeviation> <MaxFail>0.05</MaxFail> <MaxFlag>0.04</MaxFlag> </LsaPointDeviation> <EventLoss> <MaxFail>0.08</MaxFail> <MaxFlag>0.05</MaxFlag> <MinFlag>-0.05</MinFlag> <MinFail>-0.08</MinFail> </EventLoss> <EventReflectance> <MaxFail>-45</MaxFail> <MaxFlag>-50</MaxFlag> </EventReflectance> <WindowAttenuation> <MaxFail>0.25</MaxFail> <MaxFlag>0.23</MaxFlag> <MinFlag>0.17</MinFlag> <MinFail>0.15</MinFail> </WindowAttenuation> <WindowUniformity /> </Limits> </AnalysisWavelengthSetup> </AnalysisSetup> </AnalysisSetups> <FiberTypes /> <RibbonTypes /> </CableSetup> <CableInfo> <FiberLength>8170</FiberLength> <FiberID Label="Cable ID">23646_00_M727440</FiberID> <FiberID Label="Operator ID">843</FiberID> </CableInfo> <Group ID="54477_00_BLUE" Desc="Tube" OTDRSetup="SM 2 Wavelength"> <Fiber ID="118COR024376T00BE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024456T00OE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024139T00GN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023866T00BN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023761T00GY0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024200T00WE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023708T00RD0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024098T00BK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023960T00YW0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024416T00VT0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024214T00PK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024208T00TE0" Desc="Fiber" FiberType="SM" /> </Group> <Group ID="54478_00_ORANGE" Desc="Tube" OTDRSetup="SM 2 Wavelength"> <Fiber ID="118COR024349T00BE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024437T00OE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024083T00GN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023905T00BN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023795T00GY0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024257T00WE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023711T00RD0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024013T00BK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024045T00YW0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024421T00VT0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024278T00PK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024174T00TE0" Desc="Fiber" FiberType="SM" /> </Group> <Group ID="54479_00_GREEN" Desc="Tube" OTDRSetup="SM 2 Wavelength"> <Fiber ID="118COR024376T00BE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024456T00OE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024139T00GN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023866T00BN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023761T00GY0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024200T00WE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023708T00RD0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024098T00BK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023960T00YW0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024416T00VT0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024214T00PK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024208T00TE0" Desc="Fiber" FiberType="SM" /> </Group> <Group ID="54480_00_BROWN" Desc="Tube" OTDRSetup="SM 2 Wavelength"> <Fiber ID="118COR024378T00BE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024358T00OE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024133T00GN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023867T00BN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024242T00GY0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024137T00WE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023720T00RD0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024105T00BK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023732T00YW0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024355T00VT0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024181T00PK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024262T00TE0" Desc="Fiber" FiberType="SM" /> </Group> <Group ID="54481_00_GREY" Desc="Tube" OTDRSetup="SM 2 Wavelength"> <Fiber ID="118COR024368T00BE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024446T00OE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024051T00GN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023863T00BN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023934T00GY0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024288T00WE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023712T00RD0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024095T00BK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023849T00YW0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024429T00VT0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024210T00PK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024036T00TE0" Desc="Fiber" FiberType="SM" /> </Group> <Group ID="54482_00_WHITE" Desc="Tube" OTDRSetup="SM 2 Wavelength"> <Fiber ID="118COR024349T00BE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024437T00OE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024083T00GN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023905T00BN0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023795T00GY0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024257T00WE0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR023711T00RD0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024013T00BK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024045T00YW0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024421T00VT0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024278T00PK0" Desc="Fiber" FiberType="SM" /> <Fiber ID="118COR024174T00TE0" Desc="Fiber" FiberType="SM" /> </Group> </Cable> </CableSystem>
Мне нужно, чтобы изменить атрибут &ЛТ;maxfail&ГТ;0,4 от &ЛТ;AnalysisWavelengthSetup WavelengthID="1310"&ГТ; узел.
Что я уже пробовал:
Dim nodeList As XmlNodeList = xmlDoc.SelectNodes("//*") 'Loop through the selected Nodes. For Each node As XmlNode In nodeList Console.WriteLine("Name: " + node.Name) Next
Дал список из 347 узлов.
Dim nodeList As XmlNodeList = xmlDoc.SelectNodes("//AnalysisWavelengthSetup/*") 'Loop through the selected Nodes. For Each node As XmlNode In nodeList Console.WriteLine("Name: " + node.Name) Next
Не дал никаких результатов