| Contents > CFML Reference > ColdFusion Functions > XmlSearch |
|
|
|
|
||
Uses an XPath language expression to search an XML document that is represented as a string variable.
An array of XML object nodes that match the search criteria.
Extensibility functions, XML functions
XmlSearch(xmlDoc, xPathString)
cfxml, IsXmlDoc, XmlChildPos, XmlChildPos, XmlFormat, XmlNew, XmlParse, XmlTransform
ColdFusion MX: Added this function.
Parameter |
Description |
|---|---|
xmlDoc |
XML document object |
xPathString |
XPath expression |
XPath is specified by the World-Wide Web Consortium. For detailed information on XPath, see the W3C website at www.w3.org/TR/xpath.
The following example extracts the elements named last, which contain employee last names, from the employeesimple.xml file, and displays the names.
<cffile action="read"
file="C:\inetpub\wwwroot\examples\employeesimple.xml"
variable="myxml">
<cfscript>
myxmldoc = XmlParse(myxml);
selectedElements = XmlSearch(myxmldoc, "/employee/name/last");
for (i = 1; i LTE ArrayLen(selectedElements); i = i + 1)
writeoutput(selectedElements[i].XmlText & "<br>");
</cfscript>
|
|
||
| Contents > CFML Reference > ColdFusion Functions > XmlSearch |
|
|
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6.1
Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/funca126.htm
Comments
No screen name said on Aug 19, 2003 at 1:11 PM : MegaLotsACodeASaurus said on Aug 27, 2003 at 4:46 AM : MegaLotsACodeASaurus said on Aug 27, 2003 at 4:52 AM : jesse s said on Sep 24, 2003 at 6:44 AM : carehart said on Nov 13, 2003 at 4:10 PM : Gary M said on Feb 2, 2004 at 7:30 PM : TomChiv said on Mar 24, 2004 at 9:31 AM :