xmlFind

Prev Next

Description

Returns a value at the specified XML element location.


Input Parameters

Name Type Required Description
xml Text Yes XML document
path Text Yes Path to target XML element, separated by forward slashes (/)
property Text Yes Name of XML element's attribute; Specifying a dot (.) returns the value of the XML element instead of an attribute value

Returns

Type: Text

Returns a value at the specified XML element location.


Examples

var xml = "
<Cars>
    <Favorites>
        <Makes Count='2'>
            <Make Year='2010'>Ford</Make>
            <Make Year='2020'>BMW</Make>
        </Makes>
    </Favorites>
</Cars>";

// returns the count of Makes
var count = tools.xmlFind(xml, "Favorites/Makes", "Count");
debug.log(count);
var xml = "
<Cars>
    <Favorites>
        <Makes>
            <Make Year='2010'>Ford</Make>
            <Make Year='2020'>BMW</Make>
        </Makes>
    </Favorites>
</Cars>";

// returns the value 'Ford' since it is the first Make element
var make = tools.xmlFind(xml, "Favorites/Makes/Make", ".");
debug.log(make);

Remarks

None.