S
S
Serdich2015-11-04 11:47:19
XPath
Serdich, 2015-11-04 11:47:19

Is it possible to get the entire node with the tag name and content from the xml file using XPATH?

Available xml (fragment):

<fitting name="Astero - astero_1">
    <description value="Small emission scope sharpener +10 хп в реликах(т2 15 хп)&lt;br&gt;Small Memetic Algorithm +10 хп в датах(т2 15 хп)&lt;br&gt; &lt;br&gt;Poteque 'Prospector' Environmental Analysis EY-1005  - +5 сек к времени жизни контов&lt;br&gt; &lt;br&gt; Poteque 'Prospector' Archaeology AC-905 - +5 хп в реликах&lt;br&gt; &lt;br&gt; Poteque 'Prospector' Archaeology AC-905 - +5 хп в датах" "ANGEL CREO-CORP MINING" />
    <shipType value="Astero"/>
    <hardware slot="low slot 0" type="Local Hull Conversion Nanofiber Structure I"/>
    <hardware slot="low slot 1" type="Local Hull Conversion Inertial Stabilizers I"/>
    <hardware slot="low slot 2" type="'Stoic' Core Equalizer I"/>
    <hardware slot="low slot 3" type="'Stoic' Core Equalizer I"/>
    <hardware slot="med slot 0" type="Limited 1MN Microwarpdrive I"/>
    <hardware slot="med slot 1" type="Data Analyzer I"/>
    <hardware slot="med slot 2" type="Relic Analyzer I"/>
    <hardware slot="med slot 3" type="Scan Acquisition Array I"/>
    <hardware slot="hi slot 0" type="Sisters Core Probe Launcher"/>
    <hardware slot="hi slot 1" type="Salvager I"/>
    <hardware qty="6" slot="drone bay" type="Vespa I"/>
    <hardware qty="3" slot="drone bay" type="Warrior I"/>
  </fitting>

You need to return the entire node with all the contents (possibly without special characters):
<hardware slot="med slot 1" type="Data Analyzer I"/>

I did not find such a function in Xpath, but maybe there are options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Boyarintsev, 2015-11-12
@masterL

It is not clear what the question is - to get where? - just specifying the path to this node will point to the entire node with all its contents:
//hardware[@slot = "med slot 1"]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question