Hi @taro0904
Very sorry for the delay on this.
The code we provided before would need to be adjusted to achieve the results in your explanation. Accessing individual elements and attributes can all be done with SimpleXML: https://php.net/manual/en/class.simplexmlelement.php. Unfortunately, we don’t have any example snippets for this particular use case.
Keep in mind also that our code creates a single element that you can use in the import template: {alltext}. The FOREACH loop could be used on this element to get all of the results.
So, for example, if you had a file in this format – https://paste.ee/p/J30O2 – and you were importing the “node” element, you could re-write the function like so:
add_filter( 'wpallimport_xml_row', 'wpai_wpallimport_xml_row', 10, 1 );
function wpai_wpallimport_xml_row( $node ){
$elements = $node->xpath( '//data/journeys/journey/description/reise/verlauf/reisetag' );
if ( !empty( $elements ) ) {
foreach ( $elements as $element ) {
$node->addChild('alltext', $element->asXML() );
}
}
return $node;
}
And, you could out put both “The sun is very hot in the summer” and “The snow is very cold in the winter” with:
[FOREACH({alltext})]
{.}
[ENDFOREACH]
Or, you could access each one individually with {alltext[1]} and {alltext[2]}.