Answer the question
In order to leave comments, you need to log in
How to parse yml type file using php?
Good evening. How to parse this
Answer the question
In order to leave comments, you need to log in
This is plain xml
Parsed by standard libraries for working with XML
https://www.php.net/manual/ru/book.simplexml.php
https://www.php.net/manual/ru/book.xmlreader.php
The YML (Yandex Market Language) standard was developed by Yandex and is based on the XML standard. The YML format provides more features and benefits than the XLS, CSV formats.
<?php
//считываем содержимое файла
$data = simplexml_load_file('file.xml');
//достукиваемся куда надо
foreach ($data->shop->categories->category as $row) {
$id = intval($row['id']);
$parentId = intval($row['parentId']);
$name = strval($row);
var_dump($id, $parentId, $name);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question