School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,413 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,601 people online right now. Registration is fast and FREE... Join Now!




Search XML document using a variable

 

Search XML document using a variable

midasxl

23 Jun, 2009 - 10:17 AM
Post #1

D.I.C Head
**

Joined: 3 Dec, 2008
Posts: 125



Thanked: 1 times
My Contributions
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

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 11:17PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month