PHP and XML: the cost of parsing a large XML file per page request

What is the cost of parsing a large XML file using PHP with every page request?

I would like to implement custom tags in HTML.

<?xml version="1.0"?>
<html>
    <head>
        <title>The Title</title>
    </head>
    <body>
        <textbox name="txtUsername" />
    </body>
</html>

After loading this XML file into PHP, I search for user tags using XPath and manipulate or replace them.

Is it very expensive or acceptable? How about applying this on a large-scale website?

In the past, I also used XSLT for large sites, and it did not seem to slow down. It is somehow similar to XSLT, but manual.

+3
source share
3 answers

xml , , DOMXPath, xml .

php, , PHP, :

<?xml version="1.0"?>
<html>
    <head>
        <title>The Title</title>
    </head>
    <body>
        <?php textbox('txtUsername') ?>
    </body>
</html>
+1

, - , script.

, , XML - , PHP-, Smarty, / PHP .

Soulmerge.

+2

Is it very expensive or acceptable?

Do not guess. Measure .

+2
source

Source: https://habr.com/ru/post/1714051/


All Articles