الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة في قراءة ملف xml بالجافا سكريبت

بدأه Yasser_Net في 4 يناير 2011 · 1 رد · 763 مشاهدة · في قسم البرمجة بــ Javascript
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

الاخوة الأكارم

لدي اشتراك في ebay

يمكنني من عرض منتجاتهم في موقعي

سأعرض لكم ملف الجافا سكريبت الناتج عن العملية

وكود قرائته

فقط أريد كيفية وضع السعر مع المنتج

علماً أنني حاولت كثيراً ولم أفلح بخبرتي المتواضعة بالجافاسكريبت

ودائماً كانت ناتج السعر

[object object]

محتوى ملف الاكس ام ال

<findItemsByKeywordsResponse>
<ack>Success</ack>
<version>1.8.0</version>
<timestamp>2011-01-04T10:58:05.884Z</timestamp>
−
<searchResult count="3">
−
<item>
<itemId>150542913229</itemId>
<title>Apple iphone 3g Black 8gb </title>
<globalId>EBAY-US</globalId>
−
<primaryCategory>
<categoryId>3312</categoryId>
<categoryName>Cell Phones & Smartphones</categoryName>
</primaryCategory>
−
<galleryURL>
http://thumbs2.ebaystatic.com/pict/1505429132298080_1.jpg
</galleryURL>
−
<viewItemURL>
http://cgi.ebay.com/Apple-iphone-3g-Black-8gb-/150542913229?pt=Cell_Phones
</viewItemURL>
<productId type="ReferenceID">85555491</productId>
<paymentMethod>PayPal</paymentMethod>
<autoPay>false</autoPay>
<postalCode>27858</postalCode>
<location>Greenville,NC,USA</location>
<country>US</country>
−
<shippingInfo>
<shippingServiceCost currencyId="USD">0.0</shippingServiceCost>
<shippingType>Free</shippingType>
<shipToLocations>US</shipToLocations>
<expeditedShipping>false</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
</shippingInfo>
−
<sellingStatus>
<currentPrice currencyId="USD">180.0</currentPrice>
<convertedCurrentPrice currencyId="USD">180.0</convertedCurrentPrice>
<bidCount>13</bidCount>
<sellingState>Active</sellingState>
<timeLeft>P0DT0H9M12S</timeLeft>
</sellingStatus>
−
<listingInfo>
<bestOfferEnabled>false</bestOfferEnabled>
<buyItNowAvailable>false</buyItNowAvailable>
<startTime>2011-01-03T14:07:26.000Z</startTime>
<endTime>2011-01-04T11:07:17.000Z</endTime>
<listingType>Auction</listingType>
<gift>false</gift>
</listingInfo>
<returnsAccepted>true</returnsAccepted>
−
<galleryPlusPictureURL>
http://galleryplus.ebayimg.com/ws/web/150542913229_1_0_1.jpg
</galleryPlusPictureURL>
−
<condition>
<conditionId>3000</conditionId>
<conditionDisplayName>Used</conditionDisplayName>
</condition>
</item>
−
<item>
<itemId>190484313471</itemId>
<title>Broken Iphone 3g 8 Gig. </title>
<globalId>EBAY-US</globalId>
−
<primaryCategory>
<categoryId>3312</categoryId>
<categoryName>Cell Phones & Smartphones</categoryName>
</primaryCategory>
−
<galleryURL>
http://thumbs4.ebaystatic.com/pict/1904843134718080_1.jpg
</galleryURL>
−
<viewItemURL>
http://cgi.ebay.com/Broken-Iphone-3g-8-Gig-/190484313471?pt=Cell_Phones
</viewItemURL>
<paymentMethod>PayPal</paymentMethod>
<autoPay>false</autoPay>
<postalCode>43615</postalCode>
<location>Toledo,OH,USA</location>
<country>US</country>
−
<shippingInfo>
<shippingServiceCost currencyId="USD">10.0</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>US</shipToLocations>
<expeditedShipping>false</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
</shippingInfo>
−
<sellingStatus>
<currentPrice currencyId="USD">71.0</currentPrice>
<convertedCurrentPrice currencyId="USD">71.0</convertedCurrentPrice>
<bidCount>7</bidCount>
<sellingState>Active</sellingState>
<timeLeft>P0DT0H54M47S</timeLeft>
</sellingStatus>
−
<listingInfo>
<bestOfferEnabled>false</bestOfferEnabled>
<buyItNowAvailable>false</buyItNowAvailable>
<startTime>2010-12-28T11:53:53.000Z</startTime>
<endTime>2011-01-04T11:52:52.000Z</endTime>
<listingType>Auction</listingType>
<gift>false</gift>
</listingInfo>
<returnsAccepted>false</returnsAccepted>
−
<condition>
<conditionId>7000</conditionId>
<conditionDisplayName>For parts or not working</conditionDisplayName>
</condition>
</item>
−
<item>
<itemId>120667162198</itemId>
<title>iphone 3g 8g at&t black Wifi</title>
<globalId>EBAY-US</globalId>
−
<primaryCategory>
<categoryId>3312</categoryId>
<categoryName>Cell Phones & Smartphones</categoryName>
</primaryCategory>
−
<galleryURL>
http://thumbs3.ebaystatic.com/pict/1206671621988080_1.jpg
</galleryURL>
−
<viewItemURL>
http://cgi.ebay.com/iphone-3g-8g-at-t-black-Wifi-/120667162198?pt=Cell_Phones
</viewItemURL>
<productId type="ReferenceID">71354345</productId>
<paymentMethod>PayPal</paymentMethod>
<autoPay>false</autoPay>
<postalCode>19805</postalCode>
<location>Wilmington,DE,USA</location>
<country>US</country>
−
<shippingInfo>
<shippingServiceCost currencyId="USD">20.0</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
<expeditedShipping>false</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>5</handlingTime>
</shippingInfo>
−
<sellingStatus>
<currentPrice currencyId="USD">193.5</currentPrice>
<convertedCurrentPrice currencyId="USD">193.5</convertedCurrentPrice>
<bidCount>3</bidCount>
<sellingState>Active</sellingState>
<timeLeft>P0DT1H21M52S</timeLeft>
</sellingStatus>
−
<listingInfo>
<bestOfferEnabled>false</bestOfferEnabled>
<buyItNowAvailable>false</buyItNowAvailable>
<startTime>2011-01-03T12:20:58.000Z</startTime>
<endTime>2011-01-04T12:19:57.000Z</endTime>
<listingType>Auction</listingType>
<gift>false</gift>
</listingInfo>
<returnsAccepted>true</returnsAccepted>
−
<condition>
<conditionId>3000</conditionId>
<conditionDisplayName>Used</conditionDisplayName>
</condition>
</item>
</searchResult>
−
<paginationOutput>
<pageNumber>1</pageNumber>
<entriesPerPage>3</entriesPerPage>
<totalPages>49355</totalPages>
<totalEntries>148063</totalEntries>
</paginationOutput>
−
<itemSearchURL>
http://shop.ebay.com/i.html?_nkw=iphone+3g&_ddo=1&_ipg=3&_pgn=1
</itemSearchURL>
</findItemsByKeywordsResponse>

محتوى ملف الجافاسكريبت

<html>
<head>
<title>eBay Search Results</title>
<style type="text/css">body { font-family: arial,sans-serif;} </style>
</head>
<body>
<h1>eBay Search Results</h1>
<div id="results"></div>

<script>
function _cb_findItemsByKeywords(root)
{
  var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];
  var html = [];
  html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');

  for (var i = 0; i < items.length; ++i)  
  {
    var item     = items;
    var title    = item.title;
    var pic      = item.galleryURL;
    var viewitem = item.viewItemURL;

    if (null != title && null != viewitem)
    {
      html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' +
        '<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td></tr>');
    }
  }
  html.push('</tbody></table>');
  document.getElementById("results").innerHTML = html.join("");
}
</script>

<!--
Use the value of your appid for the appid parameter below.
-->
<script src=http://URL_FOR_THE_XML_FILE>
</script>
</body>
</html>

اتمنى مساعدتي في امكانية عرض السعر الموجود في

<currentPrice currencyId="USD">193.5</currentPrice>

فائق الاحترام

تم تعديل هذه المشاركة بواسطة Yasser_Net في 4 يناير 2011 في 14:06

أول منتدى عربي متكامل من برمجة سورية

منتدى جامعة دمشق

www.jamaa.cc

logo.png

ابداع بلا حدود

ShababSy.com

#2

السلام عليكم ورحمة الله

أخي ياسر إذا كانت الـ title و رابط العرض و رابط الصورة تظهر بشكل صحيح فمن المفترض أن يتم عرض السعر كالتالي :

<html>
<head>
<title>eBay Search Results</title>
<style type="text/css">body { font-family: arial,sans-serif;} </style>
</head>
<body>
<h1>eBay Search Results</h1>
<div id="results"></div>

<script>
function _cb_findItemsByKeywords(root)
{
  var items = root.findItemsByKeywordsResponse[0].searchResult[0].item || [];
  var html = [];
  html.push('<table width="100%" border="0" cellspacing="0" cellpadding="3"><tbody>');

  for (var i = 0; i < items.length; ++i)  
  {
	var item 	= items;
	var title	= item.title;
	var pic  	= item.galleryURL;
	var viewitem = item.viewItemURL;
	var price     = item.sellingStatus.currentPrice;

	if (null != title && null != viewitem)
	{
  	html.push('<tr><td>' + '<img src="' + pic + '" border="0">' + '</td>' +
    	'<td><a href="' + viewitem + '" target="_blank">' + title + '</a></td><td>'+ price + '</td></tr>');
	}
  }
  html.push('</tbody></table>');
  document.getElementById("results").innerHTML = html.join("");
}
</script>

<!--
Use the value of your appid for the appid parameter below.
-->
<script src=http://URL_FOR_THE_XML_FILE>
</script>
</body>
</html>

جرب و اخبرنا بالنتيجة

تم تعديل هذه المشاركة بواسطة MoHaMMaD Pro في 8 يناير 2011 في 09:42

Everything will be fine when we TALK LESS, DO MORE


مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…