What is the cost of parsing a large XML file using PHP on 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 I load this XML file in PHP, I search for the custom tags using XPath and manipulate or replace them.
Is this very costly or is it acceptable?
What about applying this to a large scale web site?
In the past I also used XSLT for large sites, and it didn’t seem to slow things down. This is somehow similar to XSLT, but manual.
Parsing the xml should be fast, as long as you use builtin functions like DOMXPath and your xml files are not too large.
However, I would rather replace the custom tags with function-calls and include the file in php, which should be a lot faster, since you’re not doing any string manipulation in PHP then: