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 this user specifies.

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

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

Get Inside 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.