You are here: DomElement oddness « PHP « IT news, forums, messages
DomElement oddness

Posted by Chris Boget on 10/07/37 11:07

Consider the following:

This function
---------------------------------------------
function setAttribute( $nodeName, $attributeName, $attributeValue ) {
$domElement = $this->DOMDocument->get_elements_by_tagname( $nodeName );

if( $domElement ) {
echo 'ObjectData: <pre>' . print_r( $domElement, TRUE ) . '</pre>';
if( method_exists( $domElement, 'set_attribute' )) {
$domElement->set_attribute( $attributeName, $attributeValue );

} else {
echo 'Method "set_attribute" does not exist...<br>';
echo 'Methods are: <pre>' . print_r( get_class_methods(
'domelement' ), TRUE ) . '</pre>';

}
}
} // end function setAttribute()

---------------------------------------------

Outputs this information
---------------------------------------------
ObjectData:
Array
(
[0] => domelement Object
(
[type] => 1
[tagname] => Assured
[0] => 43
[1] => 24736120
)

)
Method "set_attribute" does not exist...
Methods are:
Array
(
[0] => domelement
[1] => name
[2] => tagname
[3] => get_attribute
[4] => set_attribute
[5] => remove_attribute
[6] => get_attribute_node
[7] => get_elements_by_tagname
[8] => has_attribute
[9] => domnode
[10] => node_name
[11] => node_type
[12] => node_value
[13] => first_child
[14] => last_child
[15] => children
[16] => child_nodes
[17] => previous_sibling
[18] => next_sibling
[19] => has_child_nodes
[20] => parent
[21] => parent_node
[22] => insert_before
[23] => append_child
[24] => remove_child
[25] => replace_child
[26] => owner_document
[27] => new_child
[28] => attributes
[29] => has_attributes
[30] => prefix
[31] => namespace_uri
[32] => clone_node
[33] => add_namespace
[34] => set_namespace
[35] => add_child
[36] => append_sibling
[37] => node
[38] => unlink
[39] => unlink_node
[40] => replace_node
[41] => set_content
[42] => get_content
[43] => text_concat
[44] => set_name
[45] => is_blank_node
[46] => dump_node
)---------------------------------------------Why? What's going on? If the
variable is showing as a
'domelement object' why am I getting the message saying
that the method does not exist? When it clearly shows up
below in the list of all the methods for the domelement class?

thnx,
Chris

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация