<doc>
  <legacy_id>1998</legacy_id>
  <name>revXMLMatchingNode</name>
  <type>function</type>
  <syntax>
    <example>revXMLMatchingNode(<i>treeID</i>,<i>startNode</i>,<i>childName</i>,<i>attributeName</i>,<i>attributeValue</i>,<i>depth </i>[<i>, caseSensitive</i>])</example>
  </syntax>
  <library>XML library</library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Text and Data Processing</category>
    <category>Standalone Applications</category>
  </classification>
  <references>
    <function tag="revXMLAttributeValues">revXMLAttributeValues Function</function>
    <function tag="revXMLChildNames">revXMLChildNames Function</function>
    <function tag="revXMLTree">revXMLTree Function</function>
    <function tag="revXMLAttributes">revXMLAttributes Function</function>
  </references>
  <history>
    <introduced version="2.0">Added.</introduced>
    <changed version="2.9"></changed>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
    <disk access="???"/>
  </security>
  <summary>Finds the <glossary tag="node">node</glossary> in an <glossary tag="XML tree">XML tree</glossary> where the specified attribute of the <glossary tag="node">node</glossary> has the specified value.</summary>
  <examples>
    <example>revXMLMatchingNode(1,revXMLRootNode(1),,"PubYear","2001",-1)</example>
    <example>put revXMLMatchingNode(thisTree,it,field "Category",thisAttr,"Yes",4) after tFoundNodePaths</example>
  </examples>
  <description>
    <p>Use the <b>revXMLMatchingNode</b> function to search for a <glossary tag="node">node</glossary> by its <glossary tag="attribute">attributes</glossary>.</p><p/><p><b>Parameters:</b></p><p>The <i>treeID</i> is the number <glossary tag="return">returned</glossary> by the <function tag="revXMLCreateTree">revXMLCreateTree</function> or <function tag="revXMLCreateTreeFromFile">revXMLCreateTreeFromFile</function> <control_st tag="function">function</control_st> when you created the <glossary tag="XML tree">XML tree</glossary>.</p><p/><p>The <i>startNode</i> is the path to the node where you want to start.</p><p/><p>The <i>childName</i> is a <keyword tag="string">string</keyword> specifying which <glossary tag="child node">child nodes</glossary> to scan. If it is empty, all child nodes are scanned. Otherwise, only <glossary tag="child node">child nodes</glossary> whose name matches the <i>childName</i> are scanned.</p><p/><p>The <i>attributeName</i> is the name of the attribute you want to examine.</p><p/><p>The <i>attributeValue</i> is the value that the <i>attributeName</i> must have to be found.</p><p/><p>The <i>depth</i> specifies how many generations to scan. If you specify 1, the <i>parentNode's</i> <glossary tag="child node">child nodes</glossary> are scanned, but not their <glossary tag="child node">child nodes</glossary>. To scan all generations, specify -1 as the <i>depth</i>.</p><p/><p>The <i>caseSensitive</i> is true or false and determines whether the <i>attributeValue</i> should be compared in a case-sensitive manner or not. If <i>caseSensitive</i> is not specified, then case is ignored when comparing attribute values (i.e. defaults to false).</p><p/><p><b>Value:</b></p><p>The <b>revXMLMatchingNode</b> <control_st tag="function">function</control_st> returns a string consisting of the path to the first node containing the specified attribute with the specified value.</p><p/><p><b>Comments:</b></p><p>If the <b>revXMLMatchingNode</b> <control_st tag="function">function</control_st> encounters an error, it <glossary tag="return">returns</glossary> an error message starting with "xmlerr".</p><p/><p><img src="202653"/> <b>Important!</b> The <b>revXMLMatchingNode</b> <control_st tag="function">function</control_st> is part of the <glossary tag="XML library">XML library</glossary>. To ensure that the <control_st tag="function">function</control_st> works in a <glossary tag="standalone application">standalone application</glossary>, you must include this <glossary tag="LiveCode custom library">custom library</glossary> when you create your <glossary tag="standalone application">standalone</glossary>. In the Inclusions section on the General screen of the <glossary tag="Standalone Application Settings">Standalone Application Settings</glossary> window, make sure "XML Library" is selected in the list of script libraries.</p>
  </description>
</doc>