xmlTreeGetChildrenContent

 

SYNOPSIS

string[] xmlTreeGetChildrenContent(xmlNode parent, string name
                               [, string ns_URI])

Parameters:

  • parent - the element to get the children's content from

  • name - the local name of the child elements to get content from

  • ns_URI (optional) - limit result to the children in the namespace ns_URI. If not specified, namespace is ignored.

Returns:

  • the content of the named children


DESCRIPTION
xmlTreeGetChildrenContent() provides an easy way to read "config" XML data, where a node has many element children. Rather than getting each child element and getting their content, xmlTreeGetChildrenContent() allows you to do it in one call. If there are multiple name child elements, then multiple strings are returned.

The call

<$content = (xmlTreeGetChildrenContent($node, 'item'))>
is essentially a shortcut for the following:
<$tmp = (xmlTreeGetChildren($node, 'item'))>
<loop $tmp>
    <$ret = (xmlTreeGetAllContent($tmp))>
    <$content = $content $ret>
</loop>

See the xmlTree02_Get sample script for examples of using xmlTreeGetChildrenContent().

If no ns_URI is specified, then the namespace prefix/URIs are disregarded and only local names are compared. If a ns_URI is provided, only elements that match the name and the namespace URI will be returned. This includes the empty namespace; if you pass in a ns_URI as '', then only the attribute matching that name and without a namespace will be returned.


EXAMPLE

<$content = (xmlTreeGetChildrenContent($parent, 'item'))>


SEE ALSO
xmlTreeDumpNode, xmlTreeGetAllContent, xmlTreeGetContent xmlTreeGetFirstChild, xmlTreeGetNext, xmlTreeGetPrevious, xmlTreeGetParent


Copyright © Thunderstone Software     Last updated: Sep 25 2019
Copyright © 2019 Thunderstone Software LLC. All rights reserved.