I want to insert some formatted XML data into my webpage using php.
My question is which option would be the best choice in terms of performance:
1.) Using the php DOM functions and iterating over the structure mannually
2.) Or using the XSLTProcessor class and simply creating an XSLT stylesheet to use with it. (3 lines of php code)
Note: I do not need to write to the data, only read from it.
DOM vs XSLT
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: DOM vs XSLT
DOM is a way of creating a model of a whole XML document in memory. XSLT is a transformation language for XML. They accomplish different tasks.
Just use XSLT, you don't need to use PHP.
Just use XSLT, you don't need to use PHP.
-
jamesm6162
- Forum Newbie
- Posts: 13
- Joined: Sat Jun 28, 2008 10:31 am
Re: DOM vs XSLT
Thanks for the reply.
I know exactly what each one does, and you CAN use both for the task I have in mind.
I need to insert the data on the fly, as part of an entire web application written in php. So I have to use PHP.
I am simply wondering which would perform faster/better on the server (Not which is better for convenience):
Using the XSLTProcessor class or using the PHP DOM functions (DOMDocument, DOMNode etc.) to traverse the tree and manipulate as needed.
I know exactly what each one does, and you CAN use both for the task I have in mind.
I need to insert the data on the fly, as part of an entire web application written in php. So I have to use PHP.
I am simply wondering which would perform faster/better on the server (Not which is better for convenience):
Using the XSLTProcessor class or using the PHP DOM functions (DOMDocument, DOMNode etc.) to traverse the tree and manipulate as needed.