Index: openacs.org-dev/packages/acs-tcl/tcl/apm-xml-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/acs-tcl/tcl/apm-xml-procs.tcl,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs.org-dev/packages/acs-tcl/tcl/apm-xml-procs.tcl 9 Jul 2002 17:34:59 -0000 1.1.1.1 +++ openacs.org-dev/packages/acs-tcl/tcl/apm-xml-procs.tcl 8 Oct 2002 15:46:50 -0000 1.1.1.2 @@ -74,10 +74,16 @@ if { ![empty_string_p $node] } { # return [dom::node cget [dom::node cget $node -firstChild] -nodeValue] - return [ns_xml node getcontent [lindex [ns_xml node children $node] 0]] - } else { - return $default + set child [lindex [ns_xml node children $node] 0] + + # JCD 20020914 ns_xml when given something like (i.e. empty content) + # will have the node but the node will not have a child node and the + # getcontent will then fail. + if { ![empty_string_p $child] } { + return [ns_xml node getcontent $child] + } } + return $default } ad_proc -private apm_generate_package_spec { version_id } { @@ -93,7 +99,7 @@ where v.version_id = :version_id and v.package_key = t.package_key } - ns_log Debug "APM: Writing Package Specification for $pretty_name $version_name" + apm_log APMDebug "APM: Writing Package Specification for $pretty_name $version_name" append spec " @@ -128,7 +134,7 @@ append spec ">[ad_quotehtml $owner_name]\n" } - ns_log Debug "APM: Writing Version summary and description" + apm_log APMDebug "APM: Writing Version summary and description" if { ![empty_string_p $summary] } { append spec " [ad_quotehtml $summary]\n" } @@ -152,7 +158,7 @@ append spec "\n" - ns_log Debug "APM: Writing Dependencies." + apm_log APMDebug "APM: Writing Dependencies." db_foreach dependency_info { select dependency_type, service_uri, service_version from apm_package_dependencies @@ -166,7 +172,7 @@ append spec "\n \n" - ns_log Debug "APM: Writing Files." + apm_log APMDebug "APM: Writing Files." db_foreach version_path "select path, file_type, db_type from apm_package_files where version_id = :version_id order by path" { append spec " \n" - ns_log Debug "APM: Writing parameters" + apm_log APMDebug "APM: Writing parameters" db_foreach parameter_info { select parameter_name, description, datatype, section_name, default_value, min_n_values, max_n_values from apm_parameters @@ -214,7 +220,7 @@ append spec " " - ns_log Debug "APM: Finished writing spec." + apm_log APMDebug "APM: Finished writing spec." return $spec } @@ -282,7 +288,7 @@ apm_load_xml_packages - ns_log "Notice" "Reading specification file at $path" + apm_log APMDebug "Reading specification file at $path" set file [open $path] set xml_data [read $file] @@ -294,7 +300,7 @@ set tree [xml_parse $xml_data] # set package [dom::node cget $tree -firstChild] set root_node [xml_doc_get_first_node_by_name $tree package] - ns_log Debug "XML: root node is [ns_xml node name $root_node]" + apm_log APMDebug "XML: root node is [ns_xml node name $root_node]" set package $root_node # set root_name [dom::node cget $package -nodeName] @@ -303,13 +309,13 @@ # Debugging Children set root_children [xml_node_get_children $root_node] - ns_log Notice "XML - there are [llength $root_children] child nodes" + apm_log APMDebug "XML - there are [llength $root_children] child nodes" foreach child $root_children { - ns_log Debug "XML - one root child: [xml_node_get_name $child]" + apm_log APMDebug "XML - one root child: [xml_node_get_name $child]" } if { ![string equal $root_name "package"] } { - ns_log Debug "XML: the root name is $root_name" + apm_log APMDebug "XML: the root name is $root_name" error "Expected as root node" } set properties(package.key) [apm_required_attribute_value $package key] @@ -442,7 +448,7 @@ # Build a list of the packages parameters (if any) set properties(parameters) [list] - ns_log Debug "APM: Reading Parameters" + apm_log APMDebug "APM: Reading Parameters" # set parameters [dom::element getElementsByTagName $version "parameters"] set parameters [xml_node_get_children_by_name $version parameters] @@ -467,7 +473,7 @@ # set name [dom::element getAttribute $parameter_node name] set name [apm_attribute_value $parameter_node name] - ns_log Debug "APM: Reading parameter $name with default $default_value" + apm_log APMDebug "APM: Reading parameter $name with default $default_value" lappend properties(parameters) [list $name $description $section_name $datatype $min_n_values $max_n_values $default_value] } }