The patch you propose is exactly the type of functionality that I was
hoping to find.

Thank you,
Blake Schwendiman 

-----Original Message-----
From: Adam Maccabee Trachtenberg [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 11, 2004 11:54 PM
To: Andi Gutmans
Cc: Marcus Boerger; Blake Schwendiman; [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] SimpleXML and Default Cast To String

On Thu, 8 Jan 2004, Andi Gutmans wrote:

> At 06:59 PM 1/7/2004 -0500, Adam Maccabee Trachtenberg wrote:
> > > So i'd say let us add a method for returning the complete content.
Adam
> > > could you do that?
> >
> >That wouldn't be too difficult (although I am busy for the next day
or
> >two). However, as much as I loathe toggles, I'm wondering if it
> >wouldn't be better to make this an object-wide setting. My thought
are
> >that on an object-by-object basis, you either always want tags or
> >never want them.

[snip]

> I'd keep things the way they are today.

I've spent a little time looking at the code and I realize I
misunderstood what was going on. Right now, given this XML:

<foo>
    A<b>B</b>C
</foo>

Doing a "print $xml;" prints "AC". I think we should be printing
"ABC". Doesn't this make more sense? I don't mind eliminating the
tags, but we also kill the text node children and that doesn't seem
what I'd expect.

The second issue is how do we allow people to get the string with
tags, or "A<b>B</b>C"? (This is what I thought we were talking about.)
For that, I think the best method is to modify to_xml_string() and
to_xml_file().

Right now, we serialize the entire document regardless where in the
document these methods are called. Instead, I say these methods should
just serialize from the current location on down. So, this:

print $xml->b->to_xml_string();

Prints this:

<b>B</b>

I've whipped up a patch that does this:
http://www.trachtenberg.com/patches/simplexml_toxmlstring_patch.txt

Comments?

-adam

-- 
[EMAIL PROTECTED]
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to