[PowerShell] - как перебрать ноды в моем XML?
От: Glestwid  
Дата: 23.06.23 21:21
Оценка:
Вот мой XML:

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<gpx version="1.1" creator="OsmAnd+ 3.9.5" xmlns="http://www.topografix.com/GPX/1/1" xmlns:osmand="https://osmand.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
  <metadata>
    <name>favourites</name>
  </metadata>
  <wpt lat="55.8585655" lon="38.4400009">
    <name>«Московское малое кольцо», А-107</name>
    <type>Bridges</type>
    <extensions>
      <osmand:address>«Московское малое кольцо», А-107</osmand:address>
      <osmand:icon>bridge_structure_suspension</osmand:icon>
      <osmand:background>circle</osmand:background>
      <osmand:color>#eecc22</osmand:color>
    </extensions>
  </wpt>
  <wpt lat="55.955346" lon="37.8313137">
    <name>«Холмогоры», М-8</name>
    <type>Bridges</type>
    <extensions>
      <osmand:icon>bridge_structure_suspension</osmand:icon>
      <osmand:background>circle</osmand:background>
      <osmand:color>#8e2512</osmand:color>
    </extensions>
  </wpt>
  <wpt lat="56.9800593" lon="41.0716759">
    <name>1-я Горинская улица, Иваново</name>
    <type>Bridges</type>
    <extensions>
      <osmand:address>1-я Горинская улица, Иваново</osmand:address>
      <osmand:icon>bridge_structure_suspension</osmand:icon>
      <osmand:background>circle</osmand:background>
      <osmand:color>#eecc22</osmand:color>
    </extensions>
  </wpt>
</gpx>


Вот PowerShell

$fileIn1 = "A.gpx" 

$XPath = "//wpt"

Select-Xml -Path $fileIn1 -XPath $Xpath  | Select-Object -ExpandProperty Node



Почему он мне сейчас ничего не выдает при запуске? И как его поменять, чтобы он начал находить ноды по XPath?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.