Searching XML Data

You can do a great many things with recordsets, as we've seen in this chapter. In this chapter's final example, I'll take a look at how to search a database for a specific item. In particular, I'll let the user search for a match to a customer's name that the user specifies.

For this example, I'll modify ch08_03.xml by adding a second customer with the name Nancy to make sure we catch all instances of a match, and I'll name this new document ch08_13.xml:

Listing . ch08_13.xml
 <?xml version="1.0"?> <CUSTOMER> <CUSTOMER> <NAME>Charles</NAME> <CUSTOMER_ID>58704</CUSTOMER_ID> <PURCHASE_DATE>10/15/2003</PURCHASE_DATE> <DEPARTMENT>Meat</DEPARTMENT> <PRODUCT_NAME>Ham</PRODUCT_NAME> </CUSTOMER> <CUSTOMER> <NAME>Franklin</NAME> <CUSTOMER_ID>58705</CUSTOMER_ID> ...

Get Real World XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.