xml_get_child_node_attribute_by_path (public)
xml_get_child_node_attribute_by_path node path_list attribute_name
Defined in packages/acs-tcl/tcl/utilities-procs.tcl
Return the attribute of a child node down a give path from the current node. Example:
set tree [xml_parse -persist " <enterprise> <properties> <datasource>University of Durham: SIS</datasource> <target>University of Durham: LMS</target> <type>CREATE</type> <datetime>2001-08-08</datetime> </properties> <group recstatus = "1"> <sourcedid> <source>University of Durham</source> <id>CS1</id> </sourcedid> <grouptype> <scheme>University of Durham</scheme> <typevalue level = "2"/> </grouptype> ..... </group> </enterprise> "] set root_node [xml_doc_get_first_node $tree] set group_node [xml_node_get_children_by_name $root_node "group"] set typevalue [xml_get_child_node_attribute_by_path $group_node {grouptype typevalue} "level"]
- Parameters:
- node (required)
- The node to start from
- path_list (required)
- List of the node to try, e.g. { grouptype typevalue }.
- attribute_name (required)
- Attribute name at the very end of the very bottom of the tree route at path_list.
- Author:
- Rocael Hernandez <roc@viaro.net>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set attribute {} set current_node $node foreach element_name $path_list { set current_node [xml_node_get_first_child_by_name $current_node $element_name] if { $current_node eq "" } { # Try the next path break } } if { $current_node ne "" } { set attribute [xml_node_get_attribute $current_node $attribute_name ""] } return $attributeXQL Not present: PostgreSQL, Oracle Generic XQL file: packages/acs-tcl/tcl/utilities-procs.xql