Extract First Menu Category from XML String in ColdFusion
Hi everyone,
I’m working with an XML feed in a ColdFusion project where menu-related data is stored as a comma-separated string inside a single node. Each entry starts with a category or brand name, followed by multiple items, but I only need to display that first value.
Example XML (simplified):
<cfxml variable="menuData">
<catalog>
<item>
<type>Drinks</type>
<details>Cold Brew Coffee, Vanilla Latte, Caramel Mocha, Iced Americano</details>
</item>
<item>
<type>Specials</type>
<details>Holiday Drinks, Peppermint Mocha, Sugar Cookie Latte</details>
</item>
</catalog>
</cfxml>
What I’m trying to output is just the first part of each details string:
Cold Brew Coffee
Holiday Drinks
I assume this can be handled with string functions after parsing the XML, but I’d like to confirm the cleanest approach in ColdFusion, especially if the data grows later.
This is part of a menu-structuring project where accurate category display matters, similar to how café drink menus are organized on sites like https://dbrosmenu.com/.
Any guidance or example code would be appreciated. Thanks!
