# simplexml and dom interop

- Thread: https://externals.io/message/4995
- Original archive: https://news-web.php.net/php.internals/4995
- Started by Robert Richards on 2003-10-25T18:36:02+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #4995 — Robert Richards — 2003-10-25T18:36:02+00:00

URL: https://externals.io/message/4995#4995

If anyone is playing around with simplexml, dom and/or xsl, I have a patch for the interoperability between simplexml and dom. I am leary about committing it right now as it has limited testing, beta 2 is being released next week and I am leaving on tuesday for a week or two, so wont be able to fix any issues that might arise from it.

patch - http://www.ctindustries.net/patches/interop.diff.txt
example script - http://www.ctindustries.net/patches/interop.php.txt

The changes include:
    simplexml
        new function: simplexml_import_dom(domnode) returns an sxe object
        behavior change: setting the value of an element will do just that. I removes all child nodes unlike previous version which would change the value of the first child node of the reference node (I dont believe this was the intended behavior)
        the change in behavior and the integration with the functions from the libxml extension should resolve a lot of the libxml memory leaks

    dom
        new function: dom_import_simplexml(sxe) returns domnode
        also a minor change to clonenode method of domnode

Let me know if people really want this in the beta release otherwise i am going to wait until after I get back to further test and commit this stuff.

Rob

---

## #4997 — Andi Gutmans — 2003-10-25T19:41:11+00:00

URL: https://externals.io/message/4995#4997 · In reply to: #4995

I have no problem with you committing this. It'd be good if at least 
another guy who has been working on the new XML extensions gives you thumbs up.

Andi

At 02:36 PM 10/25/2003 -0400, Robert Richards wrote:
>If anyone is playing around with simplexml, dom and/or xsl, I have a patch 
>for the interoperability between simplexml and dom. I am leary about 
>committing it right now as it has limited testing, beta 2 is being 
>released next week and I am leaving on tuesday for a week or two, so wont 
>be able to fix any issues that might arise from it.
>
>patch - http://www.ctindustries.net/patches/interop.diff.txt
>example script - http://www.ctindustries.net/patches/interop.php.txt
>
>The changes include:
>     simplexml
>         new function: simplexml_import_dom(domnode) returns an sxe object
>         behavior change: setting the value of an element will do just 
> that. I removes all child nodes unlike previous version which would 
> change the value of the first child node of the reference node (I dont 
> believe this was the intended behavior)
>         the change in behavior and the integration with the functions 
> from the libxml extension should resolve a lot of the libxml memory leaks
>
>     dom
>         new function: dom_import_simplexml(sxe) returns domnode
>         also a minor change to clonenode method of domnode
>
>Let me know if people really want this in the beta release otherwise i am 
>going to wait until after I get back to further test and commit this stuff.
>
>Rob

---

## #5003 — Shane Caraveo — 2003-10-26T04:41:37+00:00

URL: https://externals.io/message/4995#5003 · In reply to: #4995

So my only comment on this is that the import functions should do some 
kind of error (domexception, or a php error) if the support for the 
other is not compiled in.  This would just be freindlier to the 
developer to know why the call is failing (rather than just getting 
function not defined).

Otherwise, I have not gotten around to testing the patch tonight, as 
something else is causing crashes for me.

Shane

Robert Richards wrote:

> If anyone is playing around with simplexml, dom and/or xsl, I have a patch for the interoperability between simplexml and dom. I am leary about committing it right now as it has limited testing, beta 2 is being released next week and I am leaving on tuesday for a week or two, so wont be able to fix any issues that might arise from it.
> 
> patch - http://www.ctindustries.net/patches/interop.diff.txt
> example script - http://www.ctindustries.net/patches/interop.php.txt
> 
> The changes include:
>     simplexml
>         new function: simplexml_import_dom(domnode) returns an sxe object
>         behavior change: setting the value of an element will do just that. I removes all child nodes unlike previous version which would change the value of the first child node of the reference node (I dont believe this was the intended behavior)
>         the change in behavior and the integration with the functions from the libxml extension should resolve a lot of the libxml memory leaks
> 
>     dom
>         new function: dom_import_simplexml(sxe) returns domnode
>         also a minor change to clonenode method of domnode
> 
> Let me know if people really want this in the beta release otherwise i am going to wait until after I get back to further test and commit this stuff.
> 
> Rob

---

## #5034 — Derick Rethans — 2003-10-27T09:07:22+00:00

URL: https://externals.io/message/4995#5034

> Hello Robert,
> 
> Cool stuff which i'd like to have in b2 :-)

yes, me too.

Derick

-- 
"Interpreting what the GPL actually means is a job best left to those
                    that read the future by examining animal entrails."
-------------------------------------------------------------------------
 Derick Rethans                                 http://derickrethans.nl/ 
 International PHP Magazine                          http://php-mag.net/
