Attention
TYPO3 v8 has reached its end-of-life March 31st, 2020 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.
There is no further ELTS support. It is recommended that you upgrade your project and use a supported version of TYPO3.
Parsing a Data Structure¶
You can convert a Data Structure XML document into a PHP array by using the
function \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array()
.
The reverse transformation is achieved using \TYPO3\CMS\Core\Utility\GeneralUtility::array2xml_cs()
.
If the Data Structure uses referenced sheets, for example
<T3DataStructure>
<sheets>
<sDEF>fileadmin/sheets/default_sheet.xml</sDEF>
<s_welcome>fileadmin/sheets/welcome_sheet.xml</s_welcome>
</sheets>
</T3DataStructure>
additional operations must be performed to resolve the sheets content:
$treeDat = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($inputCode);
$treeDat = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveAllSheetsInDS($treeDat);