- Example for interrogating the content of an XML document
- Example for interrogating the content of an XML document
- Example of search performed on the content of an attribute
XMLExecuteXPath (Example)
Example for interrogating the content of an XML document Example for interrogating the content of an XML document Example of search performed on the content of an attribute
sXMLSource is string = [ <?xml version="1.0" encoding="ISO-8859-1"?> <articles> <art famcod="Demo Family" ref="789852"> <desi>Screw holders 1/2</desi> </art> <art famcod="Demo Family" ref="789465"> <desi>Test suitcase</desi> </art> <art famcod="Demo Family" ref="456987"> <desi>Stainless steel screws</desi> </art> <art famcod="Demo Family" ref="123654"> <desi>Snaphook</desi> </art> <art famcod="Demo Family" ref="789963"> <desi>Screws in bulk</desi> </art> <art famcod="Demo Family" ref="963258"> <desi>Titanium screws</desi> </art> </articles> ] let sSearchVal = "Screws" IF XMLDocument("XMLDoc", sXMLSource) = True THEN XPATHQuery is string = "//art[contains(./desi,'"+sSearchVal+"')]" XMLExecuteXPath("XMLDoc", XPATHQuery) = True THEN WHILE XMLFound("XMLDoc") = True Trace("---------------------------------------------") Trace(sSearchVal+" found >> "+XMLPosition("XMLDoc")) Trace("Reference >> "+XMLData("XMLDoc","ref")) XMLNext("XMLDoc") END // Browse completed, end the query XMLCancelSearch("XMLDoc") END XMLClose("XMLDoc") ELSE Error(ErrorInfo()) END
This page is also available for…
|
|
|
|