DomElement oddness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux