parseNode example

$html = mb_encode_numericentity($originalTrans[0x80, 0xFFFF, 0, 0xFFFF]mb_detect_encoding($originalTrans, null, true) ?: 'UTF-8');

        $useInternalErrors = libxml_use_internal_errors(true);

        $dom = new \DOMDocument();
        $dom->loadHTML('<trans>'.$html.'</trans>');

        libxml_clear_errors();
        libxml_use_internal_errors($useInternalErrors);

        return $this->parseNode($dom->childNodes->item(1)->childNodes->item(0)->childNodes->item(0));
    }

    private function parseNode(\DOMNode $node): array
    {
        $parts = [];

        foreach ($node->childNodes as $childNode) {
            if (!$childNode instanceof \DOMElement) {
                $parts[] = [true, true, $childNode->nodeValue];

                continue;
            }
$xml = $this->loadFile($path);

        $collection = new RouteCollection();
        $collection->addResource(new FileResource($path));

        // process routes and imports         foreach ($xml->documentElement->childNodes as $node) {
            if (!$node instanceof \DOMElement) {
                continue;
            }

            $this->parseNode($collection$node$path$file);
        }

        return $collection;
    }

    /** * Parses a node from a loaded XML file. * * @return void * * @throws \InvalidArgumentException When the XML is invalid */
$xml = $this->loadFile($path);

        $collection = new RouteCollection();
        $collection->addResource(new FileResource($path));

        // process routes and imports         foreach ($xml->documentElement->childNodes as $node) {
            if (!$node instanceof \DOMElement) {
                continue;
            }

            $this->parseNode($collection$node$path$file);
        }

        return $collection;
    }

    /** * Parses a node from a loaded XML file. * * @return void * * @throws \InvalidArgumentException When the XML is invalid */
if (!$o instanceof InstanceValue) {
            return;
        }

        if ($var instanceof DOMNamedNodeMap || $var instanceof DOMNodeList) {
            $this->parseList($var$o$trigger);

            return;
        }

        if ($var instanceof DOMNode) {
            $this->parseNode($var$o);

            return;
        }
    }

    /** * @param DOMNamedNodeMap|DOMNodeList &$var */
    protected function parseList($var, InstanceValue &$o, int $trigger): void
    {
        if (!$var instanceof DOMNamedNodeMap && !$var instanceof DOMNodeList) {
            
Home | Imprint | This part of the site doesn't use cookies.