Viewing Individual Entry / Main
  ::   September 17, 2002

Mapping XML Tags to Verity Fields in CFMX
Man, I should start calling this a Verity Blog. I've got another little Verity tidbit you Verity junkies might find useful. I first published this in my book, Programming ColdFusion (O'Reilly), but have recently updated it for the forthcoming 2nd edition.

If you use Verity to index and search XML documents, you might have ocassion to want to map the contents of a particular XML tag to one of the ColdFusion fields defined by Verity (CF_TITLE, CF_URL, CF_KEY, CF_CUSTOM1, and CF_CUSTOM2). For example, by defualt, if you index an XML file with Verity, the CF_TITLE field doesn't get populated, which can make your search results less than useful. With a little coding magic, you can easily get Verity to map any XML tag in your document to a ColdFusion field. This means that if you have an XML document with a "title" tag, you can have verity map it to the CF_TITLE field. How? Here's the skinny. Consider this XML file - save it and name it whatever you want:

Programming ColdFusion Rob Brooks-Bilson O'Reilly

To map the title tag to the CF_TITLE field, you need to create a file called style.xml and place it in your style directory: either c:\cfusionmx\lib\common\style\file for all file-based collections or c:\cfusionmx\verity\collections\my_collection_name\file\style where my_collection_name is the name of the Verity collection containing the index for your XML files. The style.xml file should look like this:

Stop and Start your CF Server service, then reindex your collection. Now when you search it, the contents of the XML title tag should appear in the CF_TITLE field when output. There's a lot more that can be done with the style.xml file. When I get more time, I'll post what else I know about it.



Calendar
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Recommended Reading
Coldfusion MX Developer's Handbook

Archives by Subject
Announcements (26)
ColdFusion (58)
Database (12)
Dreamweaver (1)
Flash (2)
Flash Remoting (2)
Flex (3)
General Development (2)
Homesite + (1)
Mach-II (3)
MAX (8)
Mozilla (2)
Music (1)
Portals (2)
Travel (2)

Search

Links
CFLib.org
Raymond Camden's Blog
Christian Cantrell's Blog
Sean Corfield's Blog
Nathan Dintenfass' Blog
Todd Rafferty's Blog
Steve Rittler's Blog
Cameron Childress's Blog

Credits
Based on blog.cfc by Raymond Camden

XML Feed