访问子XML

时间:2016-03-28 16:33:38

标签: xml child-nodes

我在下面使用此代码从XML进一步检索产品,除了Merchant徽标网址,我可以访问任何子代。如果有人可以请告诉我如何访问Merchant徽标网址。

.star-rating {
  font-size: 0;
  white-space: nowrap;
  display: inline-block;
  width: 400px;
  height: 50px;
  overflow: hidden;
  position: relative;
  background:url('http://imgh.us/greyStar.svg');
  background-size: 20% 100%;

}
.star-rating input {
  -moz-appearance: none;
  -webkit-appearance: none;
  opacity: 0;
  display: inline-block;
  width: 20%;
  height: 100%;
  margin: 0;
  padding: 0;
  z-index: 2;
  position: relative;
}
.star-rating i {
  opacity: 0;
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 20%;
  z-index: 1;
  background:url('http://imgh.us/goldenStar.svg');  
  background-size: 100% 100%;
}
.star-rating input:hover + i,
.star-rating input:checked + i {
  opacity: 1;
}
.star-rating #input2 + i {
  width: 40%;
  background-size: 50% 100%;
}
.star-rating #input3 + i {
  width: 60%;
  background-size: 33.4% 100%;
}
.star-rating #input4 + i {
  width: 80%;
  background-size: 25% 100%;
}
.star-rating #input5 + i {
  width: 100%;
  background-size: 20% 100%;
}

foreach ($productsResult->Products->Product as $result) {

echo "<a href=".$result->Offer->Url." target='_blank'><img class='productImg' src=".$result->Offer->Images[0]->Image->Url."/></a>"; 
echo "<p><b class='price'>£".$result->Offer->Price->Price."</b></p><br>";
echo "<p><img src=".$result->Offer->Merchant[0]->Name->Logo->Url."/></p>"; *// This is where I need help*
echo "<p class='title'>".$result->Offer->Title.".</p><a class='goToStore w3-btn w3-blue' href=".$result->Offer->Url." target='_blank'><b>Visit Store</b></a>";

谢谢,

1 个答案:

答案 0 :(得分:0)

为什么使用索引?我看起来应该只是:

def query(criteria: Criteria): List[A]