Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Shane Caraveo
I haven't read this whole huge thread, but I agree with Sterling in this aspect. If the problem of children and attributes can be addressed without functions, it should be done that way. DOM is not that overly complex or with much overhead in the way it's been implemented. If people need full

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 07:39 AM 1/13/2004 +0100, Marcus Boerger wrote: > It's not supposed to be DOM but I think there's a lot of added value in > making it easy/simple to do some of the basic methods. I agree it shouldn't > be bloated with all of DOM's capabilities. I guess nobody wants a whole bunch of methods in SX

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Marcus Boerger
Hello Andi, Tuesday, January 13, 2004, 7:35:05 AM, you wrote: > At 07:21 PM 1/12/2004 -0500, Sterling Hughes wrote: >>I'm not arguing whether or not getChildren() is easier. Of course it >>is. I'm arguing that getChildren() is not within the spirit of the >>simplexml extension, which is explic

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 05:59 PM 1/12/2004 -0500, Sterling Hughes wrote: Right. Schema Validation is a great example. Perhaps it can be added as a function, but here is where it gets tricky. When I do a Schema validation on a simplexml_element, on what element does the validation happen? Schema validation happens on

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 07:21 PM 1/12/2004 -0500, Sterling Hughes wrote: I'm not arguing whether or not getChildren() is easier. Of course it is. I'm arguing that getChildren() is not within the spirit of the simplexml extension, which is explicitly designed to be without accessor methods. I further, because of the

Re: [PHP-DEV] convert_to_writable_*

2004-01-12 Thread Andi Gutmans
At 12:01 AM 1/13/2004 +0100, Jan Schneider wrote: Zitat von Andi Gutmans <[EMAIL PROTECTED]>: > Any idea who added the following macros? Zeev in version 1.19: Tue Apr 18 18:23:28 2000 Add convert_to_writable_*_ex() macros (unused at this time) Thanks. I'll try and see what the reason for them is

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Marcus Boerger
Hello Pierre-Alain, Tuesday, January 13, 2004, 12:10:14 AM, you wrote: > On Tue, 13 Jan 2004 00:31:33 +0200 > Andi Gutmans <[EMAIL PROTECTED]> wrote: >> I think the major issues are a few engine bugs which we are looking >> at. If you have any others then feel free to bring them up, with >> patc

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Moriyoshi Koizumi
On 2004/01/13, at 8:05, Sterling Hughes wrote: So is generically processing child elements. Besides, if there is one technology worth learning when it comes to processing XML its Xpath. Its XML's SQL/regular expressions, draw what analogies to string processing that you will, but I don't see: $

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Rob Richards
> I can accept getChildren() and getAttributes() (or better, just > children() and attributes()) as methods on objects, but I'm not happy > with them at all. These two methods were considered for inclusion in > my original thoughts on simplexml, and I decided against them for the > reasons I've me

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Christian Schneider
Andi Gutmans wrote: game to be doing so. We are in a feature freeze now so that we can get RC1 out of the door hopefully by the end of the month, and it just doesn't make sense to redesign the whole thing now. Consider this: Judging from the comments on the list it seems to me that a) people have

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Christian Schneider
Sterling Hughes wrote: The problem with simplexml_xpath_query returning an array is that how do you signify failure and an empty set. In order for you to have code that uses foreach() it would need to return an empty set on failure in order to avoid warnings. My preferred solution would be 1) retu

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andrei Zmievski
On Mon, 12 Jan 2004, Sterling Hughes wrote: > I'm not arguing whether or not getChildren() is easier. Of course it > is. I'm arguing that getChildren() is not within the spirit of the > simplexml extension, which is explicitly designed to be without accessor > methods. I further, because of the

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> On Mon, 12 Jan 2004, Sterling Hughes wrote: > > Its XML's SQL/regular expressions, draw what analogies to string processing > > that you will, but I don't see: > > > > $results = simplexml_query($element, '/child::node()'); > > foreach ($results as $result) { > > echo $result; > > } > > > >

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andrei Zmievski
On Mon, 12 Jan 2004, Sterling Hughes wrote: > Its XML's SQL/regular expressions, draw what analogies to string processing > that you will, but I don't see: > > $results = simplexml_query($element, '/child::node()'); > foreach ($results as $result) { > echo $result; > } > > Signifigantly mor

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> On Mon, 12 Jan 2004, Sterling Hughes wrote: > > > > What's the ultimate goal for simpleXML? I have been hesitant from ever > > > touching this extension as what I thought it was intended to do, seems > > > simplistic to where it acutally (is going/went?). Correct me if I'm wrong, > > > but when

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Adam Maccabee Trachtenberg
On Mon, 12 Jan 2004, Sterling Hughes wrote: > > What's the ultimate goal for simpleXML? I have been hesitant from ever > > touching this extension as what I thought it was intended to do, seems > > simplistic to where it acutally (is going/went?). Correct me if I'm wrong, > > but when it started I

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Pierre-Alain Joye
On Tue, 13 Jan 2004 00:31:33 +0200 Andi Gutmans <[EMAIL PROTECTED]> wrote: > I think the major issues are a few engine bugs which we are looking > at. If you have any others then feel free to bring them up, with > patches even better. However, it's not that we're going fast. We're > actually crawl

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> Sure. But I use php_error(E_WARNING) not exceptions. We can certainly > discuss how it is and isn't pure OO, and what that means. OO people are > still arguing that... In fact I read a paper on OO the other day that > said instantiable class should have no external methods (which is > bollock

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> > On Jan 12, 2004, at 5:35 PM, Sterling Hughes wrote: > > >>>Well, this can be added with userspace handlers as I mentioned to > >>>Marcus. The real trick to XML manipulation is Xpath, not adding a > >>>bunch > >>>of broken methods. If people want to do that, they can load a > >>>simplexml

Re: [PHP-DEV] convert_to_writable_*

2004-01-12 Thread Jan Schneider
Zitat von Andi Gutmans <[EMAIL PROTECTED]>: > Any idea who added the following macros? Zeev in version 1.19: Tue Apr 18 18:23:28 2000 Add convert_to_writable_*_ex() macros (unused at this time) :-) Jan. -- http://www.horde.org - The Horde Project http://www.ammma.de - Neue Wege des Lernens ht

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> At 05:13 PM 1/12/2004 -0500, Sterling Hughes wrote: > >> I actually think it's nice and easy to have some of SimpleXML's methods. > >> Maybe there is some redundancy and it might be an OK idea to make sure we > >> got them right, but I definitely think we should keep them. > > > >Sure, but you're

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Rob Richards
>> XPath cant be the answer to everything. Although it would work, XPath > sure. but it can solve most of the simple problems quite efficiently, > like getting immediate children. Out of all the functionality that has been mentioned, that was the one I would have added :) imho, that is a very us

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread George Schlossnagle
On Jan 12, 2004, at 5:35 PM, Sterling Hughes wrote: Well, this can be added with userspace handlers as I mentioned to Marcus. The real trick to XML manipulation is Xpath, not adding a bunch of broken methods. If people want to do that, they can load a simplexml object into DOM, and use the two

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> > Well, this can be added with userspace handlers as I mentioned to > > Marcus. The real trick to XML manipulation is Xpath, not adding a bunch > > of broken methods. If people want to do that, they can load a simplexml > > object into DOM, and use the two together. ;) > > XPath cant be the an

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 11:22 PM 1/12/2004 +0100, Pierre-Alain Joye wrote: On Mon, 12 Jan 2004 23:58:30 +0200 Andi Gutmans <[EMAIL PROTECTED]> wrote: > We are in a feature freeze now so that we can > get RC1 out of the door hopefully by the end of the month, and it just > doesn't make sense to redesign the whole thing

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 05:13 PM 1/12/2004 -0500, Sterling Hughes wrote: > I actually think it's nice and easy to have some of SimpleXML's methods. > Maybe there is some redundancy and it might be an OK idea to make sure we > got them right, but I definitely think we should keep them. Sure, but you're not an XML guy ei

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Rob Richards
> Well, this can be added with userspace handlers as I mentioned to > Marcus. The real trick to XML manipulation is Xpath, not adding a bunch > of broken methods. If people want to do that, they can load a simplexml > object into DOM, and use the two together. ;) XPath cant be the answer to ever

Re: [PHP-DEV] How to add new functions to SimpleXML extention

2004-01-12 Thread Alexander
Hi, Hope, I understand your point. It looks like having two DOMs is not in your plans :-) getParent is really equal to xsearch('..'). But what about name? Is it possible to get the name of the current simplexml_element using xsearch? I also wonder if I created "right" functions because I plan to c

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Pierre-Alain Joye
On Mon, 12 Jan 2004 23:58:30 +0200 Andi Gutmans <[EMAIL PROTECTED]> wrote: > We are in a feature freeze now so that we can > get RC1 out of the door hopefully by the end of the month, and it just > doesn't make sense to redesign the whole thing now. Good news :) But I really would like to talk a

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> Well, its not a feature freeze, and this doesn't require a full "not a violation of a feature freeze." is what i meant. -Sterling -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] convert_to_writable_*

2004-01-12 Thread Andi Gutmans
Any idea who added the following macros? zend_operators.h:#define convert_to_writable_ex_master(ppzv, lower_type, upper_type)\ zend_operators.h:#define convert_to_writable_boolean_ex(ppzv) convert_to_writable_ex_master(ppzv, boolean, BOOL) zend_operators.h:#define convert_to_writable_lon

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> At 04:33 PM 1/12/2004 -0500, Sterling Hughes wrote: > >> > In theory, I like the idea of a unified set of XML helper extensions, > >> > but DOM's so big and ugly that I don't know if it plays well with > >> > others in the sandbox. > >> > >> We are not consistent! Not in any way. DOM uses studlyC

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Marcus Boerger
Hello Sterling, Monday, January 12, 2004, 10:54:36 PM, you wrote: >> Hello Sterling, >> >> Monday, January 12, 2004, 10:33:08 PM, you wrote: >> >> >> > In theory, I like the idea of a unified set of XML helper extensions, >> >> > but DOM's so big and ugly that I don't know if it plays well with

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 04:54 PM 1/12/2004 -0500, Sterling Hughes wrote: > Hello Sterling, > > Monday, January 12, 2004, 10:33:08 PM, you wrote: > > >> > In theory, I like the idea of a unified set of XML helper extensions, > >> > but DOM's so big and ugly that I don't know if it plays well with > >> > others in the sa

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> > My thoughts on this are as follows, some are directly related to the > topic, > > some are related to simplexml's original design and current functionality. > > SimpleXML was originally designed to provide a direct mapping between a > > XML document and a data structure, through access to the p

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 04:33 PM 1/12/2004 -0500, Sterling Hughes wrote: > > In theory, I like the idea of a unified set of XML helper extensions, > > but DOM's so big and ugly that I don't know if it plays well with > > others in the sandbox. > > We are not consistent! Not in any way. DOM uses studlyCaps and SimpleXML

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> Hello Sterling, > > Monday, January 12, 2004, 10:33:08 PM, you wrote: > > >> > In theory, I like the idea of a unified set of XML helper extensions, > >> > but DOM's so big and ugly that I don't know if it plays well with > >> > others in the sandbox. > >> > >> We are not consistent! Not in an

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Rob Richards
> My thoughts on this are as follows, some are directly related to the topic, > some are related to simplexml's original design and current functionality. > SimpleXML was originally designed to provide a direct mapping between a > XML document and a data structure, through access to the properties

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Marcus Boerger
Hello Sterling, Monday, January 12, 2004, 10:33:08 PM, you wrote: >> > In theory, I like the idea of a unified set of XML helper extensions, >> > but DOM's so big and ugly that I don't know if it plays well with >> > others in the sandbox. >> >> We are not consistent! Not in any way. DOM uses st

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> > In theory, I like the idea of a unified set of XML helper extensions, > > but DOM's so big and ugly that I don't know if it plays well with > > others in the sandbox. > > We are not consistent! Not in any way. DOM uses studlyCaps and SimpleXML > uses underscores for its method names. Speaking

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Marcus Boerger
Hello Adam, Monday, January 12, 2004, 10:21:23 PM, you wrote: > On Mon, 12 Jan 2004, Sterling Hughes wrote: > [snip] >> > simplexml_save_dom(simplexml_element $e, domDocument $dom) >> > >> >> dom has a function to do this. > I guess it doesn't make too much difference whether DOM impor

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Adam Maccabee Trachtenberg
On Mon, 12 Jan 2004, Sterling Hughes wrote: [snip] > > simplexml_save_dom(simplexml_element $e, domDocument $dom) > > > > dom has a function to do this. I guess it doesn't make too much difference whether DOM imports a SimpleXML object or SimpleXML exports a DOM object to me. [snip] >

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
> > Much of the current code in SimpleXML is due to immaturities in either > > Zend or the LibXML interface at the time I was writing SimpleXML. I wanted > > to have cool things to show at conferences, plus other people wanted to see > > what was possible with simplexml, so features started to cre

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Adam Maccabee Trachtenberg
On Mon, 12 Jan 2004, Sterling Hughes wrote: > The idea of simplexml is to return the nodes of *that particular node*, > not all of the subsequent nodes, therefore (as mentioned before), the > current behaviour is correct. I yield to popular opinion and voice of the original author. :) > The curr

Re: [PHP-DEV] How to add new functions to SimpleXML extention

2004-01-12 Thread Marcus Boerger
Hello Alexander, generally a good idea but we are in feature freeze mode for PHP 5.0.x which is our current head. That means you have to suspend your idea until HEAD and PHP_5_0 are different branches. This will most likely happen during the next two months. To not forget your idea you can open a

Re: [PHP-DEV] How to add new functions to SimpleXML extention

2004-01-12 Thread Sterling Hughes
Funny, i writing a response to adam's message while this got to the mailing list. Take a look at my response to adam, as it covers this patch as well. -Sterling > Hi! > > I'm just playing with simplexml and wonder if two new functions of the > simplexml_element object would be usefull: getName(

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Sterling Hughes
The idea of simplexml is to return the nodes of *that particular node*, not all of the subsequent nodes, therefore (as mentioned before), the current behaviour is correct. The current behaviour of to_xml_string() is however, wrong. It should return the xml content from the current node as adam p

[PHP-DEV] How to add new functions to SimpleXML extention

2004-01-12 Thread Alexander
Hi! I'm just playing with simplexml and wonder if two new functions of the simplexml_element object would be usefull: getName() and getParent(). I'm interesting in adding them to the extention, if possible. What should I do for this? (I also think that it may be in FAQ, but I did not find that inf

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Andi Gutmans
That should be fine. The following isn't: function foo() { $x = 1; return $x; } function &bar() { return foo(); } Note: foo isn't returning by reference. Andi At 11:12 AM 1/12/2004 -0500, Daniel Convissor wrote: On Mon, Jan 12, 2004 at 06:06:22PM +0200, Andi Gutmans wrote: > At 10:39

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Daniel Convissor
On Mon, Jan 12, 2004 at 06:06:22PM +0200, Andi Gutmans wrote: > At 10:39 AM 1/12/2004 -0500, Daniel Convissor wrote: > >On Mon, Jan 12, 2004 at 09:05:12AM +0200, Andi Gutmans wrote: > >> > >> b) A function which returned a variable by reference couldn't be returned > >> by reference. I think this o

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Andi Gutmans
At 10:39 AM 1/12/2004 -0500, Daniel Convissor wrote: On Mon, Jan 12, 2004 at 09:05:12AM +0200, Andi Gutmans wrote: > > b) A function which returned a variable by reference couldn't be returned > by reference. I think this one is probably OK to code. But, does this cause memory corruption problems i

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Daniel Convissor
On Mon, Jan 12, 2004 at 09:05:12AM +0200, Andi Gutmans wrote: > > b) A function which returned a variable by reference couldn't be returned > by reference. I think this one is probably OK to code. But, does this cause memory corruption problems in PHP 4? Thanks, --Dan -- T H E A N A L Y S

RE: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Blake Schwendiman
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

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Andi Gutmans
At 01:53 AM 1/12/2004 -0500, Adam Maccabee Trachtenberg wrote: 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

Re: [PHP-DEV] SimpleXML and Default Cast To String

2004-01-12 Thread Adam Maccabee Trachtenberg
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). Howe

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Andi Gutmans
At 04:34 PM 1/12/2004 +0900, Moriyoshi Koizumi wrote: > b) A function which returned a variable by reference couldn't be returned > by reference. I think this one is probably OK to code. Do you mean a referenced variable returned by a function couldn't be returned as a reference by its caller? That

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Moriyoshi Koizumi
> b) A function which returned a variable by reference couldn't be returned > by reference. I think this one is probably OK to code. Do you mean a referenced variable returned by a function couldn't be returned as a reference by its caller? That is to say, function &foo() { return $a; }

Re: [PHP-DEV] Only variables or references can be returned by reference

2004-01-12 Thread Andi Gutmans
At 10:09 PM 1/11/2004 -0500, Daniel Convissor wrote: On Sun, Jan 11, 2004 at 07:36:53PM +0100, Lukas Smith wrote: > > So does this mean we can all remove our php5 compatibility hacks that relate > to the above bug report? I don't think that's wise. Even though PHP 5 now won't complain about it,