Re: Working with XML: DomDocument or SimpleXML?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robert Cummings wrote:
> I still use PHP4 so I wrote my own XML handling class that wraps the
> xml_xxx() series of functions. Haven't had a problem with it. Makes
> working with XML very easy since it uses a path string syntax to
> focus/access nodes and attributes:

Cheers for that.

I know I definitely want to do XSLT stuff and for that I need to use
DomDocument (I'm sure there are other ways but this works fine for me so
far!).

I guess think I asked too open a question, when really I'm looking for
fairly specific answers (or rather opinions).

I'll phrase it better: one can easily convert a SimpleXML object to a
DomDocument[1], but nothing is "free" (in terms of time taken and memory
requirements etc.), so really I guess I want to ask if the trade off of
the simplicity of working with SimpleXML is worth it considering the
overhead of the conversion process to a DomDocument for subsequent XSLT
transforms etc?

Col


[1] e.g.

    if ($xml instanceof SimpleXMLElement)
    {
      $rv = new DOMDocument('1.0', 'utf-8');
      $node = dom_import_simplexml($xml);
      $node = $rv->importNode($node, true);
      $rv->appendChild($node);
      return $rv;
    }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux