我正在尝试从 xml 创建查询。我正在使用 xmlparse,但主节点中有一个 hypen。我不知道如何构建它,所以我可以循环浏览产品。这是它的样子
http://www.screencast.com/t/GhCgHTymMsR1
我一直在尝试这样做,但它不起作用或者我错过了一些东西。
<cfset result = xmlParse(result.Filecontent)>
<cfloop index="x" from="1" to="#arrayLen(result["cj-api"]products.product)#">
<?xml version="1.0" encoding="UTF-8"?>
<cj-api>
<products total-matched="363" records-returned="2" page-number="1">
<product>
<ad-id>10773572</ad-id>
<advertiser-id>2955746</advertiser-id>
<advertiser-name>Shopko</advertiser-name>
<advertiser-category>picture books</advertiser-category>
<buy-url>http://www.anrdoezrs.net/click-5917360-10773572?url=http%3A%2F%2Fshopko.com%2Fdetail%2FLEGO-Batman%3A-The-Visual-Book%2F48364%2F0000&cjsku=48364</buy-url>
<catalog-id>cjo:398</catalog-id>
<currency>USD</currency>
<description>Enter the world of your favorite LEGO&#174; super hero in the first ever guide to LEGO&#174; Batman&#8482;! LEGO Batman: The Visual Dictionary combines DK's famous Visual Dictionary format with the adventurous world of the LEGO Caped Crusader.Every set and minifigure from the LEGO Batman universe will now be at your fingertips.</description>
<image-url>http://shopko.com/items/shopko/images/small/48364_0000.jpg</image-url>
<in-stock></in-stock>
<isbn></isbn>
<manufacturer-name></manufacturer-name>
<manufacturer-sku></manufacturer-sku>
<name>LEGO Batman: The Visual Book</name>
<price>21.99</price>
<retail-price>21.99</retail-price>
<sale-price>21.99</sale-price>
<sku>48364</sku>
<upc></upc>
</product>
<product>
<ad-id>10773572</ad-id>
<advertiser-id>2955746</advertiser-id>
<advertiser-name>Shopko</advertiser-name>
<advertiser-category>toy figures & playsets</advertiser-category>
<buy-url>http://www.jdoqocy.com/click-5917360-10773572?url=http%3A%2F%2Fshopko.com%2Fdetail%2FLEGO-Friends-Olivias-Speedboat%2F59022%2F0000&cjsku=59022</buy-url>
<catalog-id>cjo:398</catalog-id>
<currency>USD</currency>
<description>All aboard for fun in the sun with Olivia's Speedboat!Includes Olivia mini-doll figure Features sand castle, shovel, bucket, beach towel, umbrella and cupBring the LEGO&#174; Friends for a ride around the bay! Build a sand castle or relax in the sun!LEGO Friends pieces are fully compatible with all LEGO System bricks. Collect all of the LEGO Friends sets for a whole city of LEGO Friends fun!LEGO mini-dolls are figures made especially for the world of LEGO Friends, with thousands of customizable fashion and accessory combinations!Measures over 1&#34; (4cm) tall, 4&#34; (10cm) wide and 4&#34; (12cm) long</description>
<image-url>http://shopko.com/items/shopko/images/small/59022_0000.jpg</image-url>
<in-stock></in-stock>
<isbn></isbn>
<manufacturer-name></manufacturer-name>
<manufacturer-sku></manufacturer-sku>
<name>LEGO Friends Olivias Speedboat</name>
<price>13.49</price>
<retail-price>14.99</retail-price>
<sale-price>13.49</sale-price>
<sku>59022</sku>
<upc></upc>
</product>
</products>
</cj-api>