xml_get_child_node_content_by_path (public)

 xml_get_child_node_content_by_path node path_list

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Return the first nonempty contents of a child node down a given path from the current node.

Example:

    set tree [xml_parse -persist {
        <enterprise>
        <properties>
        <datasource>Dunelm Services Limited</datasource>
        <target>Telecommunications LMS</target>
        <type>DATABASE UPDATE</type>
        <datetime>2001-08-08</datetime>
        </properties>
        <person recstatus = "1">
        <comments>Add a new Person record.</comments>
        <sourcedid>
        <source>Dunelm Services Limited</source>
        <id>CK1</id>
        </sourcedid>
        <name>
        <fn>Clark Kent</fn>
        <sort>Kent, C</sort>
        <nickname>Superman</nickname>
        </name>
        <demographics>
        <gender>2</gender>
        </demographics>
        <adr>
        <extadd>The Daily Planet</extadd>
        <locality>Metropolis</locality>
        <country>USA</country>
        </adr>
        </person>
        </enterprise>
    }]

    set root_node [xml_doc_get_first_node $tree]

    aa_equals "person -> name -> nickname is Superman"  [xml_get_child_node_content_by_path $root_node { { person name nickname } }] "Superman"

    aa_equals "Same, but after trying a couple of non-existent paths or empty notes"  [xml_get_child_node_content_by_path $root_node { { does not exist } { properties } { person name nickname } { person sourcedid id } }] "Superman"
    aa_equals "properties -> datetime"  [xml_get_child_node_content_by_path $root_node { { person comments foo } { person name first_names } { properties datetime } }] "2001-08-08"
    

Parameters:
node (required)
The node to start from
path_list (required)
List of list of nodes to try, e.g. { { user_id } { sourcedid id } }, or { { name given } { name fn } }.
Author:
Lars Pind <lars@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 test_xml_get_child_node_content_by_path xml_get_child_node_content_by_path (test acs-tcl) xml_get_child_node_content_by_path xml_get_child_node_content_by_path test_xml_get_child_node_content_by_path->xml_get_child_node_content_by_path xml_node_get_content xml_node_get_content (public) xml_get_child_node_content_by_path->xml_node_get_content xml_node_get_first_child_by_name xml_node_get_first_child_by_name (public) xml_get_child_node_content_by_path->xml_node_get_first_child_by_name auth::sync::process_doc::ims::GetAcknowledgementDocument auth::sync::process_doc::ims::GetAcknowledgementDocument (private) auth::sync::process_doc::ims::GetAcknowledgementDocument->xml_get_child_node_content_by_path auth::sync::process_doc::ims::ProcessDocument auth::sync::process_doc::ims::ProcessDocument (private) auth::sync::process_doc::ims::ProcessDocument->xml_get_child_node_content_by_path

Testcases:
xml_get_child_node_content_by_path
[ show source ]
Show another procedure: