XPath,如何删除欧元符号不必要的字符?

时间:2016-12-18 16:09:27

标签: c# html xpath character euro

如何选择范围标记中排除那些不必要的“& nbsp”字符的文字?我只需要数字(最后的欧元字符会很好,但这不是必须的)。请注意,数字会发生变化,但它们并不相同。

<span class="price">15.900&nbsp;€</span>

1 个答案:

答案 0 :(得分:1)

如果您使用C#和XPath,那么假设您将XPath表达式编写为C#字符串,则可以使用context.complete

工作样本(在Javascript中)是

&#13;
&#13;
get {
  path("yuval") {
    import scala.concurrent.ExecutionContext.Implicits.global
    implicit val timeout = Timeout(5 seconds)
    context => {
      val result = (completionActor ? MyRequest(1)).mapTo[MyResult]
      result.flatMap(r => context.complete(HttpResponse(StatusCodes.OK, entity = s"Result was ${r.data}")))
    }
  }
}
&#13;
"translate(//span[@class = 'price'], '\u00A0', '')"
&#13;
&#13;
&#13;