xmlToSimpleXML example


    protected static function xmlToDOMDocument(string $var, ?string $parent_path): ?array
    {
        // There's no way to check validity in DOMDocument without making errors. For shame!         if (!self::xmlToSimpleXML($var$parent_path)) {
            return null;
        }

        $xml = new DOMDocument();
        $xml->loadXML($var);

        if ($xml->childNodes->count() > 1) {
            $xml = $xml->childNodes;
            $access_path = 'childNodes';
        } else {
            $xml = $xml->firstChild;
            
Home | Imprint | This part of the site doesn't use cookies.