PDA

View Full Version : Parsing XML issues



koltz
March 25th, 2008, 10:06 PM
For some reason, I am unable to pull information from an XML I am download from Shopzilla. I can trace the entire xml which displays, but when trying to get to a specific node to get the specific data, it doesn't want to retrieve at all. Any help would be greatly appreciated, below is the code of what I have so far and XML.


var loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onLoaded);
var request:URLRequest = new URLRequest("shopzilla.xml");

try
{
loader.load(request);
ta.appendText("xml is loaded");
}
catch(error:Error)
{
ta.appendText("xml is not loaded");
}

var xml:XML;

function onLoaded(e:Event):void
{
try
{
xml = new XML(e.target.data);
tb.appendText (xml);
trace(xml);
}
catch(e:TypeError)
{
tb.appendText ("error loading xml");
}

}


<ShopzillaQueryResponse xmlns="http://publisher.shopzilla.com/pp/xml/Publisher_API_Response.xsd">
<categoryResponse matched="0" included="2">
<category id="15010100" parent_id="15000000" display="false">
<name>Video Games</name>
<URL>http://www.shopzilla.com/7S--Video_Games_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15010100__rf--af1</URL>
</category>
<category id="15000000" parent_id="1" display="false">
<name>Video Games</name>
<URL>http://www.shopzilla.com/10B--Video_Games_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15000000__rf--af1</URL>
</category>
</categoryResponse>
<productResponse requested="1" matched="1" included="1" start="1">
<product category_id="15010100" id="513218609">
<name>Halo 3</name>
<URL>http://www.shopzilla.com/12--Halo_3_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15010100__prod_id--513218609__rf--af1</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=513218609</imageURL_small>
<imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=513218609</imageURL_med>
<imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=513218609</imageURL_medlarge>
<imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=513218609</imageURL_large>
<maxRawImageSize/>
<desc_short>Xbox 360 - Shooting - Rated M (Mature); Platform: Xbox 360</desc_short>
<desc_long>Halo 3 is the third game in the Halo Trilogy and will provide the thrilling conclusion to the events begun in Halo: Combat Evolved. Halo 3 was first revealed at the Electronic Entertainment Expo in Los Angeles on May 6th, 2006. Halo 3 will be available for Xbox 360 in 2007. Halo 3 will pick up where Halo 2 left off. The Master Chief is returning to Earth to finish the fight. The Covenant occupation of Earth has uncovered a massive and ancient object beneath the African sands - an object who's secrets have yet to be revealed. Earth's forces are battered and beaten.</desc_long>
<prodRating URLref="prodRate-5">5</prodRating>
<prodScore>100.00</prodScore>
<numReviews>1</numReviews>
<reviewsURL>http://www.shopzilla.com/3H</reviewsURL>
<minPrice>49.96</minPrice>
<maxPrice>59.99</maxPrice>
<numMerchants>8</numMerchants>
</product>
</productResponse>
<otherResponse>
<totalProducts>23030513</totalProducts>
<totalStores>98687</totalStores>
<imageURL>
<URL id="prodRate-5">http://img.bizrate.com/site/rating_5_star_80x13.gif</URL>
</imageURL>
<trackingPixel>http://adserve.shopzilla.com/img/publisherID-2588/assetID-6/placementID-/categoryID-1/productID-513218609</trackingPixel>
</otherResponse>
</ShopzillaQueryResponse>So as an example, when trying to get the URL in <imageURL_med>, nothing comes up (or any node). Displaying the whole XML displays fine in TextBox tb, but not when narrowing it down.

Thanks,

Corey

flash grenade
March 25th, 2008, 10:40 PM
Why didn't you list the code you're trying to access the XML with, since that's what you said isn't working.

flash grenade
March 25th, 2008, 11:23 PM
//output: 15010100
trace(xml.productResponse.product.@category_id);

//output: http://www.shopzilla.com/10B--Video_Games...
trace(xml.categoryResponse.category[1].URL.*);

koltz
March 26th, 2008, 06:10 AM
First question back, I didn't post any additional code because I had reverted back to what was actually pulling all of the code in the trace and textbox, being frustrated that nothing else worked.


//output: 15010100
trace(xml.productResponse.product.@category_id);

//output: http://www.shopzilla.com/10B--Video_Games...
trace(xml.categoryResponse.category[1].URL.*);


And the above didn't work for me when using in the trade or inputting directly into the textbox. The first one opened the trace box, but displayed nothing, the second trace didn't even open the trace box up.

If it helps, I am using Flash CS3 and coding it in Actionscript 3.

flash grenade
March 26th, 2008, 02:27 PM
Its puzzling, as you said you could call trace(xml) and it would dump the entire contents. If you could do that, then you should be able to access individual fields with the syntax I gave you.

From my own code:

var request:URLRequest = new URLRequest(fnCFG);
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, InitWR2);
loader.load(request);
.
.
.

private var cfg:XML = null;

cfg = new XML(URLLoader(event.target).data);

.
.
.

//various access statements:

var width:Number = cfg.text_width.@val;

txt_fgn.htmlText = cfg.textr_fgn[n].htmlText.*;

if (cfg.light.@val=="textr_fg") {

(Maybe you've figured it out by now.)

koltz
March 26th, 2008, 02:39 PM
Yup, I understand, I have been able to do this with other XML to a point, mostly just worked with RSS feeds though. And this just stumped me and is why I posted the actual XML that it is pulling. Just can get to a specific node as mentioned.

wvxvw
March 26th, 2008, 05:06 PM
THe XML you're trying to trace uses namespace:
http://publisher.shopzilla.com/pp/xml/Publisher_API_Response.xsd
Meaning, this line should look like this:

trace(xml.*::productResponse.product.@category_id) ;
//or
var ns:Namespace = xml.namespace();
trace(xml.ns::productResponse.product.@category_id );

koltz
March 26th, 2008, 08:42 PM
Ok, that worked great, thanks!!! Not a lot of good information about Namespaces on the Internet from what I have seen. I usually learn by example/code.


//output: 15010100
trace(xml.productResponse.product.@category_id);

//output: http://www.shopzilla.com/10B--Video_Games...
trace(xml.categoryResponse.category[1].URL.*);


THe XML you're trying to trace uses namespace:
http://publisher.shopzilla.com/pp/xml/Publisher_API_Response.xsd
Meaning, this line should look like this:

trace(xml.*::productResponse.product.@category_id) ;
//or
var ns:Namespace = xml.namespace();
trace(xml.ns::productResponse.product.@category_id );

koltz
March 28th, 2008, 05:17 PM
Ok, was working great until I needed to do multiples of the same node. Below is an extended XML of the above and need to know how to get to a specific item again.



<?xml version="1.0" encoding="utf-8"?>
<ShopzillaQueryResponse xmlns="http://publisher.shopzilla.com/pp/xml/Publisher_API_Response.xsd">
<categoryResponse matched="0" included="2">
<category id="15010100" parent_id="15000000" display="false">
<name>Video Games</name>
<URL>http://www.shopzilla.com/7S--Video_Games_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15010100__rf--af1</URL>
</category>
<category id="15000000" parent_id="1" display="false">
<name>Video Games</name>
<URL>http://www.shopzilla.com/10B--Video_Games_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15000000__rf--af1</URL>
</category>
</categoryResponse>
<productResponse requested="1" matched="1" included="1" start="1">
<product category_id="15010100" id="513218609">
<name>Halo 3</name>
<URL>http://www.shopzilla.com/12--Halo_3_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15010100__prod_id--513218609__rf--af1</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=513218609</imageURL_small>
<imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=513218609</imageURL_med>
<imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=513218609</imageURL_medlarge>
<imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=513218609</imageURL_large>
<maxRawImageSize/>
<desc_short>Xbox 360 - Shooting - Rated M (Mature); Platform: Xbox 360</desc_short>
<desc_long>Halo 3 is the third game in the Halo Trilogy and will provide the thrilling conclusion to the events begun in Halo: Combat Evolved. Halo 3 was first revealed at the Electronic Entertainment Expo in Los Angeles on May 6th, 2006. Halo 3 will be available for Xbox 360 in 2007. Halo 3 will pick up where Halo 2 left off. The Master Chief is returning to Earth to finish the fight. The Covenant occupation of Earth has uncovered a massive and ancient object beneath the African sands - an object who's secrets have yet to be revealed. Earth's forces are battered and beaten.</desc_long>
<prodRating URLref="prodRate-5">5</prodRating>
<prodScore>100.00</prodScore>
<numReviews>1</numReviews>
<reviewsURL>http://www.shopzilla.com/3H</reviewsURL>
<minPrice>49.96</minPrice>
<maxPrice>59.99</maxPrice>
<numMerchants>8</numMerchants>
<merchantListing requested="5" matched="8" included="5">
<merchantProduct id="580994353" mid="27167">
<in_stock type="stock-1"/>
<price>55.76</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fadfarm.mediaplex.com%2Fad%2Fck%2 F711-5256-3456-9%3Floc%3Dhttp%253A%252F%252Fproduct.ebay.com%252F ws%252Fproduct%252FProductSaleSearch%253Fsopms%253 D89304%253A2%253A1051%253A4055956259%253A134703029 %253Aa7cf69a1122243c70588c1547215b03f%253A1%253A1% 253A1%253A1375474737%253D1%253D2%253D1%253D3&amp;mid=2 7167&amp;cat_id=15010100&amp;prod_id=513218609&amp;pos=1&amp;rf=af 1&amp;b_id=18&amp;bamt=68f11f10bedad085&amp;ppr=eca5d93d5f7d84 2c&amp;oid=580994353&amp;bkt=1&amp;bktpos=1&amp;atom=10614&amp;rf=af1&amp; af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af_ placement_id=</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=580994353&amp;mid=27167</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=580994353&amp;mid=27167</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=580994353&amp;mid=27167</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=580994353&amp;mid=27167</imageURL_large></merchantProduct>
<merchantProduct id="696636580" mid="28697">
<in_stock type="stock-1"/>
<price>54.99</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProdu ct.aspx%3FItem%3DN82E16874105470%26ATT%3D74-105-470%26CMP%3DOTC-B1zrat3%26nm_mc%3DOTC-B1zrat3%26cm_mmc%3DOTC-B1zrat3-_-Xbox%2B360%2BVideo%2BGames-_-Microsoft-_-74105470&amp;mid=28697&amp;cat_id=15010100&amp;prod_id=5132186 09&amp;pos=2&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;ppr= ea6316be792c3b6c&amp;oid=696636580&amp;bkt=3&amp;bktpos=1&amp;atom =10614&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_asset type_id=10&amp;af_placement_id=</URL>
<promotionalText>
<label>Same day shipping</label>
<label>Live Chat Support</label>
</promotionalText>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=696636580&amp;mid=28697</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=696636580&amp;mid=28697</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=696636580&amp;mid=28697</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=696636580&amp;mid=28697</imageURL_large></merchantProduct>
<merchantProduct id="647280844" mid="173214">
<in_stock type="stock-1"/>
<price>58.89</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.videogameaction.com%2Fha3x36 sh9.html&amp;mid=173214&amp;cat_id=15010100&amp;prod_id=513218 609&amp;pos=3&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;ppr =014a198b7cb1d117&amp;oid=647280844&amp;bkt=3&amp;bktpos=2&amp;ato m=10614&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_asse ttype_id=10&amp;af_placement_id=</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=647280844&amp;mid=173214</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=647280844&amp;mid=173214</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=647280844&amp;mid=173214</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=647280844&amp;mid=173214</imageURL_large></merchantProduct>
<merchantProduct id="569835435" mid="20870">
<in_stock type="stock-1"/>
<price>59.99</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fcircuitcity.rdr.channelintellige nce.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1JcQRhrFD92Z1E ABEwHaWpaUBdDXW0QcXJ8HwIACBdoaFxXUUMQfm9pQ0w3MCMXH R9HTyh8DAoZEFQ3UCAtJ1QcU19UcDEMB0QbTjNabSA8EnlVSA1 mYUkMAhccbwgWBhFzYjBMQEJZVDg3UlJaQRJ4VzEnMEJWVQ1VN jswXwgfSDtRNy03AgwWU0cxMQAHDk4dPVNNXE8qIHwT%26nAID %3D10043468&amp;mid=20870&amp;cat_id=15010100&amp;prod_id=5132 18609&amp;pos=4&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;p pr=259faddac1edd1e0&amp;oid=569835435&amp;bkt=3&amp;bktpos=3&amp;a tom=10614&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_as settype_id=10&amp;af_placement_id=</URL>
<loyalaol/>
<promotionalText>
<label>Store pickup available</label>
</promotionalText>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=569835435&amp;mid=20870</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=569835435&amp;mid=20870</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=569835435&amp;mid=20870</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=569835435&amp;mid=20870</imageURL_large></merchantProduct>
<merchantProduct id="714839409" mid="181002">
<in_stock type="stock-1"/>
<price>49.96</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.hermanstreet.com%2Fss-bin%2Fsc%2Fref.cgi%3Fstoreid%3D*10cac243a506b920bf 81%26name%3DShopzilla%26url%3Dhttp%253A%252F%252Fw ww.hermanstreet.com%252Fstore%252Fgames_halo-3-200017.html%253Fb%253DRXbOc9IW%25252Blk8zQhOM7%252 52FbT5vpAqd3FjfSAITRA5DQQ2c%25253D%2526d%253D20001 7&amp;mid=181002&amp;cat_id=15010100&amp;prod_id=513218609&amp;pos =5&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;ppr=2c1fbe fc390abf1d&amp;oid=714839409&amp;bkt=4&amp;bktpos=1&amp;atom=10614 &amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_i d=10&amp;af_placement_id=</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=714839409&amp;mid=181002</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=714839409&amp;mid=181002</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=714839409&amp;mid=181002</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=714839409&amp;mid=181002</imageURL_large></merchantProduct>
</merchantListing>
</product>
</productResponse>
<merchantResponse matched="0" included="8">
<merchant id="27167">
<name>eBay</name>
<logoURL>http://img.bizrate.com/merchant/little/27167.gif</logoURL>
<merchRating>
<avg_likely URLref="merchRate-4">9.0</avg_likely>
<avg_avail URLref="merchRate-3">8.1</avg_avail>
<avg_custs URLref="merchRate-3">7.7</avg_custs>
<avg_prrep URLref="merchRate-3">8.4</avg_prrep>
<avg_overall URLref="merchRate-3">8.5</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fadfarm.mediaplex.com%2Fad%2Fck%2 F711-5256-3456-5%3Floc%3Dhttp%3A%2F%2Fwww.ebay.com%3Fsubcat%3D0-Generic&amp;mid=27167&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp; pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;a f_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="28697">
<name>Newegg.com</name>
<logoURL>http://img.bizrate.com/merchant/little/28697.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-4">9.0</avg_likely>
<avg_avail URLref="merchRate-4">9.2</avg_avail>
<avg_custs URLref="merchRate-3">8.7</avg_custs>
<avg_prrep URLref="merchRate-4">9.1</avg_prrep>
<avg_overall URLref="merchRate-4">9.0</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.newegg.com%2Findex.asp%3Fref er%3Dbizrate&amp;mid=28697&amp;cat_id=1&amp;prod_id=513218609&amp; oid=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_i d=6&amp;af_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="173214">
<name>VideoGameAction.com</name>
<logoURL>http://img.bizrate.com/merchant/little/173214.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-3">8.0</avg_likely>
<avg_avail URLref="merchRate-3">8.6</avg_avail>
<avg_custs URLref="merchRate-3">8.0</avg_custs>
<avg_prrep URLref="merchRate-3">8.4</avg_prrep>
<avg_overall URLref="merchRate-3">8.2</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.videogameaction.com&amp;mid=1732 14&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;r f=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id= 10&amp;af_placement_id=</URL>
</merchant>
<merchant id="20870">
<name>circuitcity.com</name>
<logoURL>http://img.bizrate.com/merchant/little/20870.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-3">8.6</avg_likely>
<avg_avail URLref="merchRate-3">8.7</avg_avail>
<avg_custs URLref="merchRate-3">8.3</avg_custs>
<avg_prrep URLref="merchRate-3">8.8</avg_prrep>
<avg_overall URLref="merchRate-3">8.5</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.circuitcity.com%2Finit.jsp%3 FKey%3D1597&amp;mid=20870&amp;cat_id=1&amp;prod_id=513218609&amp;o id=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_id =6&amp;af_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="181002">
<name>Herman Street</name>
<logoURL>http://img.bizrate.com/merchant/little/181002.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.hermanstreet.com&amp;mid=181002&amp; cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=a f1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp; af_placement_id=</URL>
</merchant>
<merchant id="178400">
<name>videogamedaddy.com</name>
<logoURL>http://img.bizrate.com/merchant/little/178400.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fvideogamedaddy.com&amp;mid=178400&amp;ca t_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=af1 &amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af _placement_id=</URL>
</merchant>
<merchant id="140143">
<name>eGameSpot.com</name>
<logoURL>http://img.bizrate.com/merchant/little/140143.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.egamespot.com&amp;mid=140143&amp;cat _id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp; af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af_ placement_id=</URL>
</merchant>
<merchant id="151005">
<name>The Good Company</name>
<logoURL>http://img.bizrate.com/merchant/little/151005.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.thegoodcompany.com&amp;mid=15100 5&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf =af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=1 0&amp;af_placement_id=</URL>
</merchant>
</merchantResponse>
<otherResponse>
<totalProducts>23030513</totalProducts>
<totalStores>98687</totalStores>
<imageURL>
<URL id="prodRate-5">http://img.bizrate.com/site/rating_5_star_80x13.gif</URL>
<URL id="merchRate-cert">http://img.bizrate.com/site/cc_ribbon_30x18_on.gif</URL>
<URL id="merchRate-0">http://img.bizrate.com/site/smiley_na_34x34.gif</URL>
<URL id="merchRate-3">http://img.bizrate.com/site/smiley_good_34x34.gif</URL>
<URL id="merchRate-4">http://img.bizrate.com/site/smiley_outstanding_34x34.gif</URL>
</imageURL>
<textRef>
<stockText id="stock-1">In Stock</stockText>
</textRef>
<trackingPixel>http://adserve.shopzilla.com/img/publisherID-2588/assetID-6/placementID-/productID-513218609</trackingPixel></otherResponse>
</ShopzillaQueryResponse>


Ok, so I am trying to get to merchantResponse/merchant/logoURL and will need to access each of the different listings under merchant, example eight above. And need to pull different data from merchant like each logoURL. Here is what I used for the code based on what wvxvw has shared.


var merchantOneLogo = xml.ns::merchantResponse.merchant.logoURL;


I have tried [0] under merchant to bring up the first one, but then it errors Flash and doesn't continue. Any help would be greatly appreciated!

Thanks,

Corey

wyffels
March 28th, 2008, 05:51 PM
Hey, are you doing this for Shopzilla Corey? I would like to talk to you about this. I have something similar I am working on and could use your expertise. Thanks!

David

koltz
March 28th, 2008, 09:37 PM
I responded to your PM, still looking for help on the above!

Thanks,

Corey

wvxvw
March 29th, 2008, 11:07 AM
trace(xml.*::merchantResponse.*::merchant.*::logoU RL.text().toXMLString());
Just ignore the namespaces. Or do you need them for some reason?

koltz
March 30th, 2008, 07:09 PM
trace(xml.*::merchantResponse.*::merchant.*::logoU RL.text().toXMLString());Just ignore the namespaces. Or do you need them for some reason?Honestly I don't know, I needed them for the first time you helped, so assumed I needed them for everything with this XML. I guess an explanation with the code would help me understand what it is doing also, how do I get to the specific item in that node?

wvxvw
March 31st, 2008, 02:36 AM
Ok, basicaly, name of the XML node consists of the suffix (namespace()) and a localName(). Together they form QName (qualified name). The goal of the namespace is to separate content that comes from different sources which may be unaware each of another (to avoid name conflicts, say, you want to have one XML partialy loaded from URI A and URI B, both parts may occasionaly have node called <author />, namespace makes it clear which author node belongs to which XML).
The meaning of asterisk in E4X is namely: any arbitrary string (Remember Norton Commander? ^^). So
.*:: - stands for any namespace
.*. - any node (or better ..)
.@* - any attribute
But, if you're loading XML from one source, and you're sure there won't be name conflicts - you don't really need to know which namespace the searched node uses.

koltz
March 31st, 2008, 08:45 AM
<merchantResponse matched="0" included="8">
<merchant id="27167">
<name>eBay</name>
<logoURL>http://img.bizrate.com/merchant/little/27167.gif</logoURL>
<merchRating>
<avg_likely URLref="merchRate-4">9.0</avg_likely>
<avg_avail URLref="merchRate-3">8.1</avg_avail>
<avg_custs URLref="merchRate-3">7.7</avg_custs>
<avg_prrep URLref="merchRate-3">8.4</avg_prrep>
<avg_overall URLref="merchRate-3">8.5</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fadfarm.mediaplex.com%2Fad%2Fck%2 F711-5256-3456-5%3Floc%3Dhttp%3A%2F%2Fwww.ebay.com%3Fsubcat%3D0-Generic&amp;mid=27167&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp; pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;a f_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="28697">
<name>Newegg.com</name>
<logoURL>http://img.bizrate.com/merchant/little/28697.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-4">9.0</avg_likely>
<avg_avail URLref="merchRate-4">9.2</avg_avail>
<avg_custs URLref="merchRate-3">8.7</avg_custs>
<avg_prrep URLref="merchRate-4">9.1</avg_prrep>
<avg_overall URLref="merchRate-4">9.0</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.newegg.com%2Findex.asp%3Fref er%3Dbizrate&amp;mid=28697&amp;cat_id=1&amp;prod_id=513218609&amp; oid=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_i d=6&amp;af_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="173214">
<name>VideoGameAction.com</name>
<logoURL>http://img.bizrate.com/merchant/little/173214.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-3">8.0</avg_likely>
<avg_avail URLref="merchRate-3">8.6</avg_avail>
<avg_custs URLref="merchRate-3">8.0</avg_custs>
<avg_prrep URLref="merchRate-3">8.4</avg_prrep>
<avg_overall URLref="merchRate-3">8.2</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.videogameaction.com&amp;mid=1732 14&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;r f=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id= 10&amp;af_placement_id=</URL>
</merchant>
<merchant id="20870">
<name>circuitcity.com</name>
<logoURL>http://img.bizrate.com/merchant/little/20870.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-3">8.6</avg_likely>
<avg_avail URLref="merchRate-3">8.7</avg_avail>
<avg_custs URLref="merchRate-3">8.3</avg_custs>
<avg_prrep URLref="merchRate-3">8.8</avg_prrep>
<avg_overall URLref="merchRate-3">8.5</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.circuitcity.com%2Finit.jsp%3 FKey%3D1597&amp;mid=20870&amp;cat_id=1&amp;prod_id=513218609&amp;o id=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_id =6&amp;af_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="181002">
<name>Herman Street</name>
<logoURL>http://img.bizrate.com/merchant/little/181002.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.hermanstreet.com&amp;mid=181002&amp; cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=a f1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp; af_placement_id=</URL>
</merchant>
<merchant id="178400">
<name>videogamedaddy.com</name>
<logoURL>http://img.bizrate.com/merchant/little/178400.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fvideogamedaddy.com&amp;mid=178400&amp;ca t_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=af1 &amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af _placement_id=</URL>
</merchant>
<merchant id="140143">
<name>eGameSpot.com</name>
<logoURL>http://img.bizrate.com/merchant/little/140143.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.egamespot.com&amp;mid=140143&amp;cat _id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp; af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af_ placement_id=</URL>
</merchant>
<merchant id="151005">
<name>The Good Company</name>
<logoURL>http://img.bizrate.com/merchant/little/151005.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.thegoodcompany.com&amp;mid=15100 5&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf =af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=1 0&amp;af_placement_id=</URL>
</merchant>
</merchantResponse>
The code will change per posting which will be pulled directly from ShopZilla's site. So the above code as an example has eight merchants. So to get to the first merchant, I would use the following:


xml.*::merchantResponse.*::merchant.0::logoURL.tex t().toXMLString()

wvxvw
March 31st, 2008, 01:00 PM
I would rather use merchant[0] than merchant.0. It looks more array-ish %) But this should work too =)

koltz
March 31st, 2008, 07:13 PM
With your original Trace:


trace(xml.*::merchantResponse.*::merchant.*::logoU RL.text().toXMLString());I get nothing to display in the trace window. When using the following code as mentioned when getting to a specific node, it errors, saying "1086: Syntax error: expecting semicolon before .1."


var merchantOneLogo = xml.ns::merchantResponse.*::merchant.1::logoURL;An d the following error when using the array code "1086: Syntax error: expecting semicolon before doublecolon."


var merchantOneLogo = xml.ns::merchantResponse.*::merchant[1]::logoURL;

Same thing if I change the ns to a *.

wvxvw
April 1st, 2008, 02:56 AM
The problem is in some other place...
Here's what I get:

var xml:XML = <ShopzillaQueryResponse xmlns="http://publisher.shopzilla.com/pp/xml/Publisher_API_Response.xsd">
<categoryResponse matched="0" included="2">
<category id="15010100" parent_id="15000000" display="false">
<name>Video Games</name>
<URL>http://www.shopzilla.com/7S--Video_Games_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15010100__rf--af1</URL>
</category>
<category id="15000000" parent_id="1" display="false">
<name>Video Games</name>
<URL>http://www.shopzilla.com/10B--Video_Games_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15000000__rf--af1</URL>
</category>
</categoryResponse>
<productResponse requested="1" matched="1" included="1" start="1">
<product category_id="15010100" id="513218609">
<name>Halo 3</name>
<URL>http://www.shopzilla.com/12--Halo_3_-_af_assettype_id--10__af_creative_id--6__af_id--2588__af_placement_id--__cat_id--15010100__prod_id--513218609__rf--af1</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=513218609</imageURL_small>
<imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=513218609</imageURL_med>
<imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=513218609</imageURL_medlarge>
<imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=513218609</imageURL_large>
<maxRawImageSize/>
<desc_short>Xbox 360 - Shooting - Rated M (Mature); Platform: Xbox 360</desc_short>
<desc_long>Halo 3 is the third game in the Halo Trilogy and will provide the thrilling conclusion to the events begun in Halo: Combat Evolved. Halo 3 was first revealed at the Electronic Entertainment Expo in Los Angeles on May 6th, 2006. Halo 3 will be available for Xbox 360 in 2007. Halo 3 will pick up where Halo 2 left off. The Master Chief is returning to Earth to finish the fight. The Covenant occupation of Earth has uncovered a massive and ancient object beneath the African sands - an object who's secrets have yet to be revealed. Earth's forces are battered and beaten.</desc_long>
<prodRating URLref="prodRate-5">5</prodRating>
<prodScore>100.00</prodScore>
<numReviews>1</numReviews>
<reviewsURL>http://www.shopzilla.com/3H</reviewsURL>
<minPrice>49.96</minPrice>
<maxPrice>59.99</maxPrice>
<numMerchants>8</numMerchants>
<merchantListing requested="5" matched="8" included="5">
<merchantProduct id="580994353" mid="27167">
<in_stock type="stock-1"/>
<price>55.76</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fadfarm.mediaplex.com%2Fad%2Fck%2 F711-5256-3456-9%3Floc%3Dhttp%253A%252F%252Fproduct.ebay.com%252F ws%252Fproduct%252FProductSaleSearch%253Fsopms%253 D89304%253A2%253A1051%253A4055956259%253A134703029 %253Aa7cf69a1122243c70588c1547215b03f%253A1%253A1% 253A1%253A1375474737%253D1%253D2%253D1%253D3&amp;mid=2 7167&amp;cat_id=15010100&amp;prod_id=513218609&amp;pos=1&amp;rf=af 1&amp;b_id=18&amp;bamt=68f11f10bedad085&amp;ppr=eca5d93d5f7d84 2c&amp;oid=580994353&amp;bkt=1&amp;bktpos=1&amp;atom=10614&amp;rf=af1&amp; af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af_ placement_id=</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=580994353&amp;mid=27167</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=580994353&amp;mid=27167</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=580994353&amp;mid=27167</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=580994353&amp;mid=27167</imageURL_large></merchantProduct>
<merchantProduct id="696636580" mid="28697">
<in_stock type="stock-1"/>
<price>54.99</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.newegg.com%2FProduct%2FProdu ct.aspx%3FItem%3DN82E16874105470%26ATT%3D74-105-470%26CMP%3DOTC-B1zrat3%26nm_mc%3DOTC-B1zrat3%26cm_mmc%3DOTC-B1zrat3-_-Xbox%2B360%2BVideo%2BGames-_-Microsoft-_-74105470&amp;mid=28697&amp;cat_id=15010100&amp;prod_id=5132186 09&amp;pos=2&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;ppr= ea6316be792c3b6c&amp;oid=696636580&amp;bkt=3&amp;bktpos=1&amp;atom =10614&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_asset type_id=10&amp;af_placement_id=</URL>
<promotionalText>
<label>Same day shipping</label>
<label>Live Chat Support</label>
</promotionalText>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=696636580&amp;mid=28697</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=696636580&amp;mid=28697</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=696636580&amp;mid=28697</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=696636580&amp;mid=28697</imageURL_large></merchantProduct>
<merchantProduct id="647280844" mid="173214">
<in_stock type="stock-1"/>
<price>58.89</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.videogameaction.com%2Fha3x36 sh9.html&amp;mid=173214&amp;cat_id=15010100&amp;prod_id=513218 609&amp;pos=3&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;ppr =014a198b7cb1d117&amp;oid=647280844&amp;bkt=3&amp;bktpos=2&amp;ato m=10614&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_asse ttype_id=10&amp;af_placement_id=</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=647280844&amp;mid=173214</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=647280844&amp;mid=173214</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=647280844&amp;mid=173214</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=647280844&amp;mid=173214</imageURL_large></merchantProduct>
<merchantProduct id="569835435" mid="20870">
<in_stock type="stock-1"/>
<price>59.99</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fcircuitcity.rdr.channelintellige nce.com%2Fgo.asp%3FfVhzOGNRAAQIASNiE1JcQRhrFD92Z1E ABEwHaWpaUBdDXW0QcXJ8HwIACBdoaFxXUUMQfm9pQ0w3MCMXH R9HTyh8DAoZEFQ3UCAtJ1QcU19UcDEMB0QbTjNabSA8EnlVSA1 mYUkMAhccbwgWBhFzYjBMQEJZVDg3UlJaQRJ4VzEnMEJWVQ1VN jswXwgfSDtRNy03AgwWU0cxMQAHDk4dPVNNXE8qIHwT%26nAID %3D10043468&amp;mid=20870&amp;cat_id=15010100&amp;prod_id=5132 18609&amp;pos=4&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;p pr=259faddac1edd1e0&amp;oid=569835435&amp;bkt=3&amp;bktpos=3&amp;a tom=10614&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_as settype_id=10&amp;af_placement_id=</URL>
<loyalaol/>
<promotionalText>
<label>Store pickup available</label>
</promotionalText>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=569835435&amp;mid=20870</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=569835435&amp;mid=20870</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=569835435&amp;mid=20870</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=569835435&amp;mid=20870</imageURL_large></merchantProduct>
<merchantProduct id="714839409" mid="181002">
<in_stock type="stock-1"/>
<price>49.96</price>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.hermanstreet.com%2Fss-bin%2Fsc%2Fref.cgi%3Fstoreid%3D*10cac243a506b920bf 81%26name%3DShopzilla%26url%3Dhttp%253A%252F%252Fw ww.hermanstreet.com%252Fstore%252Fgames_halo-3-200017.html%253Fb%253DRXbOc9IW%25252Blk8zQhOM7%252 52FbT5vpAqd3FjfSAITRA5DQQ2c%25253D%2526d%253D20001 7&amp;mid=181002&amp;cat_id=15010100&amp;prod_id=513218609&amp;pos =5&amp;rf=af1&amp;b_id=18&amp;bamt=cfbf9532e1e82faa&amp;ppr=2c1fbe fc390abf1d&amp;oid=714839409&amp;bkt=4&amp;bktpos=1&amp;atom=10614 &amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_i d=10&amp;af_placement_id=</URL>
<imageURL_small>http://image.shopzilla.com/resize?sq=60&amp;uid=714839409&amp;mid=181002</imageURL_small><imageURL_med>http://image.shopzilla.com/resize?sq=100&amp;uid=714839409&amp;mid=181002</imageURL_med><imageURL_medlarge>http://image.shopzilla.com/resize?sq=160&amp;uid=714839409&amp;mid=181002</imageURL_medlarge><imageURL_large>http://image.shopzilla.com/resize?sq=400&amp;uid=714839409&amp;mid=181002</imageURL_large></merchantProduct>
</merchantListing>
</product>
</productResponse>
<merchantResponse matched="0" included="8">
<merchant id="27167">
<name>eBay</name>
<logoURL>http://img.bizrate.com/merchant/little/27167.gif</logoURL>
<merchRating>
<avg_likely URLref="merchRate-4">9.0</avg_likely>
<avg_avail URLref="merchRate-3">8.1</avg_avail>
<avg_custs URLref="merchRate-3">7.7</avg_custs>
<avg_prrep URLref="merchRate-3">8.4</avg_prrep>
<avg_overall URLref="merchRate-3">8.5</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fadfarm.mediaplex.com%2Fad%2Fck%2 F711-5256-3456-5%3Floc%3Dhttp%3A%2F%2Fwww.ebay.com%3Fsubcat%3D0-Generic&amp;mid=27167&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp; pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_id=6&amp;a f_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="28697">
<name>Newegg.com</name>
<logoURL>http://img.bizrate.com/merchant/little/28697.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-4">9.0</avg_likely>
<avg_avail URLref="merchRate-4">9.2</avg_avail>
<avg_custs URLref="merchRate-3">8.7</avg_custs>
<avg_prrep URLref="merchRate-4">9.1</avg_prrep>
<avg_overall URLref="merchRate-4">9.0</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.newegg.com%2Findex.asp%3Fref er%3Dbizrate&amp;mid=28697&amp;cat_id=1&amp;prod_id=513218609&amp; oid=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_i d=6&amp;af_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="173214">
<name>VideoGameAction.com</name>
<logoURL>http://img.bizrate.com/merchant/little/173214.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-3">8.0</avg_likely>
<avg_avail URLref="merchRate-3">8.6</avg_avail>
<avg_custs URLref="merchRate-3">8.0</avg_custs>
<avg_prrep URLref="merchRate-3">8.4</avg_prrep>
<avg_overall URLref="merchRate-3">8.2</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.videogameaction.com&amp;mid=1732 14&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;r f=af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id= 10&amp;af_placement_id=</URL>
</merchant>
<merchant id="20870">
<name>circuitcity.com</name>
<logoURL>http://img.bizrate.com/merchant/little/20870.gif</logoURL>
<certified URLref="merchRate-cert"/>
<merchRating>
<avg_likely URLref="merchRate-3">8.6</avg_likely>
<avg_avail URLref="merchRate-3">8.7</avg_avail>
<avg_custs URLref="merchRate-3">8.3</avg_custs>
<avg_prrep URLref="merchRate-3">8.8</avg_prrep>
<avg_overall URLref="merchRate-3">8.5</avg_overall>
</merchRating>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.circuitcity.com%2Finit.jsp%3 FKey%3D1597&amp;mid=20870&amp;cat_id=1&amp;prod_id=513218609&amp;o id=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp;af_id=2588&amp;af_creative_id =6&amp;af_assettype_id=10&amp;af_placement_id=</URL>
</merchant>
<merchant id="181002">
<name>Herman Street</name>
<logoURL>http://img.bizrate.com/merchant/little/181002.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.hermanstreet.com&amp;mid=181002&amp; cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=a f1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp; af_placement_id=</URL>
</merchant>
<merchant id="178400">
<name>videogamedaddy.com</name>
<logoURL>http://img.bizrate.com/merchant/little/178400.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fvideogamedaddy.com&amp;mid=178400&amp;ca t_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=af1 &amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af _placement_id=</URL>
</merchant>
<merchant id="140143">
<name>eGameSpot.com</name>
<logoURL>http://img.bizrate.com/merchant/little/140143.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.egamespot.com&amp;mid=140143&amp;cat _id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf=af1&amp; af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=10&amp;af_ placement_id=</URL>
</merchant>
<merchant id="151005">
<name>The Good Company</name>
<logoURL>http://img.bizrate.com/merchant/little/151005.gif</logoURL>
<unrated/>
<URL>http://www.shopzilla.com/rd?t=http%3A%2F%2Fwww.thegoodcompany.com&amp;mid=15100 5&amp;cat_id=1&amp;prod_id=513218609&amp;oid=&amp;pos=1&amp;b_id=18&amp;rf =af1&amp;af_id=2588&amp;af_creative_id=6&amp;af_assettype_id=1 0&amp;af_placement_id=</URL>
</merchant>
</merchantResponse>
<otherResponse>
<totalProducts>23030513</totalProducts>
<totalStores>98687</totalStores>
<imageURL>
<URL id="prodRate-5">http://img.bizrate.com/site/rating_5_star_80x13.gif</URL>
<URL id="merchRate-cert">http://img.bizrate.com/site/cc_ribbon_30x18_on.gif</URL>
<URL id="merchRate-0">http://img.bizrate.com/site/smiley_na_34x34.gif</URL>
<URL id="merchRate-3">http://img.bizrate.com/site/smiley_good_34x34.gif</URL>
<URL id="merchRate-4">http://img.bizrate.com/site/smiley_outstanding_34x34.gif</URL>
</imageURL>
<textRef>
<stockText id="stock-1">In Stock</stockText>
</textRef>
<trackingPixel>http://adserve.shopzilla.com/img/publisherID-2588/assetID-6/placementID-/productID-513218609</trackingPixel></otherResponse>
</ShopzillaQueryResponse>;
trace(xml.*::merchantResponse.*::merchant.*::logoU RL.text().toXMLString());
trace('==============================');
trace(xml.*::merchantResponse.*::merchant[0].*::logoURL.text().toXMLString());
The output:

http://img.bizrate.com/merchant/little/27167.gif
http://img.bizrate.com/merchant/little/28697.gif
http://img.bizrate.com/merchant/little/173214.gif
http://img.bizrate.com/merchant/little/20870.gif
http://img.bizrate.com/merchant/little/181002.gif
http://img.bizrate.com/merchant/little/178400.gif
http://img.bizrate.com/merchant/little/140143.gif
http://img.bizrate.com/merchant/little/151005.gif
==============================
http://img.bizrate.com/merchant/little/27167.gif

koltz
April 1st, 2008, 07:07 PM
Thanks for all your help with this. I tried you code directly and still didn't work. Would you mind if I PMed my actual code to you to look at? It has private API code that I am not supposed to hand out so could be one of the problems, though it exports the XML that I posted.

Corey

wvxvw
April 2nd, 2008, 02:54 AM
Thanks for all your help with this. I tried you code directly and still didn't work. Would you mind if I PMed my actual code to you to look at? It has private API code that I am not supposed to hand out so could be one of the problems, though it exports the XML that I posted.

Corey
Yes, it's OK ;) You may check for parsing XML errors first...

koltz
April 2nd, 2008, 04:57 AM
Dude, all I can say is "I'm stupid!" I found the error. Hit me in the middle of the night. I updated the URL to pull the XML code from ShopZilla's site in the web browser to display all of the merchant's, but I never copied the updated URL over to the Actionscript to pull the data. Updated it and now and pulls everything wonderfully.

My last question now is, can you point me in a direction of pulling that URL from HTML/PHP when loading the flash. Something in the lines of "http://www.mysite.url/shopzilla.swf?URL=http://shopzilla.com/urlgoeshere" so anything after the ?URL= goes into the URLRequest area. If that isn't possible, could you point me into the direction of what might be.

Thanks again for all your help and patience!

Corey

wvxvw
April 2nd, 2008, 06:28 AM
This info should appear in {reference to loaded SWF may be this.stage, this.root etc.}.loaderInfo.parameters.URL and will show 'http://shopzilla.com/urlgoeshere'.

koltz
April 2nd, 2008, 07:33 AM
Besides the above question, one more :), I am using the following code in a Flash app to pull RSS feeds to count how many it is pulling from that feed, but doesn't work as is in this one. Guessing namespaces is causing the issue again? Anyway, here is the code:



var il:XMLList = xml.merchantResponse.merchant;
if (il.length() > 5) then (il.length = 5); // If more than 5 limit to 5
for(var i:uint=0; i<il.length(); i++)
{
var merchantLogo = xml.ns::merchantResponse.merchant[i].logoURL;
trace(merchantLogo);
}Edit: Got it to load, just need help with my IF statement that is incorrect.

koltz
April 2nd, 2008, 12:57 PM
Must be the lack of sleep this morning, figured the above out. I can't change the il.length(), so I just assigned it to a variable.

koltz
April 8th, 2008, 01:14 PM
Ok, couple questions again :)

In my TextBox I have it loading an image, my XML brings in a URL for an image, but the image isn't valid. How can I check to see if the image is loaded into the TextBox, and if not, use an IF to select an alternate option.

Next, Can I dynamically resize an image that I am loading into a TextBox? Example, I have a textbox that is 100 x 100 pixels. Most images are withing those dimensions, but is there a way to reduce an image that I am loading into the TextBox (via <img src>)?

Thanks,

Corey