RE: [PHP] Building an XML Parser Class
I did read the other thread, and I tried that. It didn't work... -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 2:46 PM To: Donald Tyler; [EMAIL PROTECTED] Subject: RE: [PHP] Building an XML Parser Class [snip] xml_set_element_handler($this-xml_parser, '$this-startElement', $this-endElement); xml_set_character_data_handler($this-xml_parser, $this-valueHandler); I get an error message: Warning: xml_parse(): Unable to call handler $this-startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 Now I presume this is because I am trying to call methods of my class. [/snip] Hmmm... I thought you might have read the other class thread. Since the method is not public you could call it with the :: syntax. http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Building an XML Parser Class
Three ways I tried using the :: syntax: 1. With either double OR single and with OR without () (Tried all 4 combinations) quotes: xml_set_element_handler($this-xml_parser, xmlTranslator::startElement, xmlTranslator::endElement); Gives me the following error message: Warning: xml_parse(): Unable to call handler xmlTranslator::startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 2. With no quotes: xml_set_element_handler($this-xml_parser, xmlTranslator::startElement(), xmlTranslator::endElement()); This runs the functions, but doesn't pass any parameters to it. All I get are missing parameter error messages. -Original Message- From: Donald Tyler [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 9:11 AM To: '[EMAIL PROTECTED]' Subject: RE: [PHP] Building an XML Parser Class I did read the other thread, and I tried that. It didn't work... -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 2:46 PM To: Donald Tyler; [EMAIL PROTECTED] Subject: RE: [PHP] Building an XML Parser Class [snip] xml_set_element_handler($this-xml_parser, '$this-startElement', $this-endElement); xml_set_character_data_handler($this-xml_parser, $this-valueHandler); I get an error message: Warning: xml_parse(): Unable to call handler $this-startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 Now I presume this is because I am trying to call methods of my class. [/snip] Hmmm... I thought you might have read the other class thread. Since the method is not public you could call it with the :: syntax. http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Building an XML Parser Class
[snip] xml_set_element_handler($this-xml_parser, '$this-startElement', $this-endElement); xml_set_character_data_handler($this-xml_parser, $this-valueHandler); I get an error message: Warning: xml_parse(): Unable to call handler $this-startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 Now I presume this is because I am trying to call methods of my class. [/snip] Hmmm... I thought you might have read the other class thread. Since the method is not public you could call it with the :: syntax. http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php HTH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Building an XML Parser Class
Tried that already, all it does it change the error message to: Warning: xml_parse(): Unable to call handler () in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 I guess this is because its looking within the xml parser object for a function called $this-startElement. Which it obviously doesn't exist because its in the xml parsers parent object. -Original Message- From: Evan Nemerson [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 4:36 PM To: Donald Tyler; [EMAIL PROTECTED] Subject: Re: [PHP] Building an XML Parser Class Try getting rid of the quotes around $this-startElement, or changing them to double quotes. If you don't understand why, php.net/language.types.string should make for an exhilarating read :) On Thursday 07 August 2003 12:40 pm, Donald Tyler wrote: Hi, I am trying to create a Class that will parse an XML document. It all works fine as individual functions but I cant get it to work as a class. For example, when I do the following in my class: xml_set_element_handler($this-xml_parser, '$this-startElement', $this-endElement); xml_set_character_data_handler($this-xml_parser, $this-valueHandler); I get an error message: Warning: xml_parse(): Unable to call handler $this-startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 Now I presume this is because I am trying to call methods of my class. Does anyone know a good way around this? Thanks. -- Why be born again, when you can just grow up? -Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Building an XML Parser Class
Donald Tyler wrote: Hi, I am trying to create a Class that will parse an XML document. It all works fine as individual functions but I cant get it to work as a class. For example, when I do the following in my class: xml_set_element_handler($this-xml_parser, '$this-startElement', $this-endElement); xml_set_character_data_handler($this-xml_parser, $this-valueHandler); I get an error message: Warning: xml_parse(): Unable to call handler $this-startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 Now I presume this is because I am trying to call methods of my class. Does anyone know a good way around this? Thanks. Have a look at: http://us2.php.net/manual/en/function.xml-set-object.php Enjoy, David Pieper -- programmer n. /pro gram er/ A device for transmuting caffeine into code. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Building an XML Parser Class
Try getting rid of the quotes around $this-startElement, or changing them to double quotes. If you don't understand why, php.net/language.types.string should make for an exhilarating read :) On Thursday 07 August 2003 12:40 pm, Donald Tyler wrote: Hi, I am trying to create a Class that will parse an XML document. It all works fine as individual functions but I cant get it to work as a class. For example, when I do the following in my class: xml_set_element_handler($this-xml_parser, '$this-startElement', $this-endElement); xml_set_character_data_handler($this-xml_parser, $this-valueHandler); I get an error message: Warning: xml_parse(): Unable to call handler $this-startElement() in c:\program files\apache group\php\My_includes\Class.xmlTranslator.php on line 90 Now I presume this is because I am trying to call methods of my class. Does anyone know a good way around this? Thanks. -- Why be born again, when you can just grow up? -Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php