Hello and thanks for your time. I have a coldfusion component that searches an xml document for a very specific child element. It finds it just fine. What I would like to do is use a variable as part of the search. The value of the variable is dependent upon what the user chooses from a select box.
CODE
<cfcomponent>
<cffunction name="myFunction" access="remote" returntype="string" output="no">
<cfargument name="exploitName" type="string" required="no">
<cfset bigXml="myXmlFile.xml"/>
<cfset myXml=XmlParse(bigXml)>
<cfloop
index="ncdb"
from="1" to="#ArrayLen( myXml.XmlRoot.XmlChildren[1].XmlChildren[2])#"
step="1">
<cfset xmlNcdb = myXml.XmlRoot.XmlChildren[1].XmlChildren[2]/>
<cfreturn xmlNcdb>
</cfloop>
</cffunction>
</cfcomponent>
In the <cfargument> tag the "exploitName" will have a value of whatever the end user chooses from a selection box. How do I put that variable in the remaining code to find its children? I am looking for it to take the place of XmlChildren[2]. Thanks for any help you may be able to provide.
Cheers!
This post has been edited by midasxl: 23 Jun, 2009 - 10:31 AM