私はこれが現在バグかもしれないと確信していますが、修正されるまで動作させる方法があります。
例XML:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
yahoo:count="0" yahoo:created="2010-11-24T18:16:40Z" yahoo:lang="en-US">
<diagnostics>
<user-time>858</user-time>
<service-time>0</service-time>
<build-version>9847</build-version>
</diagnostics>
<results/>
</query>
例KRL:
ruleset a60x435 {
meta {
name "xml test"
description <<
testing xml node values that are 0
>>
author "Mike Grace"
logging on
}
global {
dataset testXml:XML <- "http://dl.dropbox.com/u/1446072/apps/test/test1.xml" cachable for 1 month;
}
rule getting_zero_value_from_xml_node {
select when pageview ".*"
pre {
nodeValue = testXml.pick("$..service-time.$t");
testValue = "#{nodeValue}".replace(re/(ARRAY).*/,"$1");
nodeValue = (testValue eq "ARRAY") => 0 | nodeValue;
}
{
notify("nodeValue",nodeValue) with sticky = true;
}
}
}
説明:データセットまたはデータソースから
- ピックノード値
- 力変数変換文字列にとを確認'ARRAY'
XMLノードをJSONに変換され、0の値は、それが空のハッシュ化されたときに0から元の変数の
- 設定値「ARRAY」列場合は、
を発見しました。サーバー上では、変数はハッシュへのポインタです。ポインタを文字列に強制してチェックすることができるので、ノード値がゼロの場合に対処できます。
うーん...私は回避策を使わなければならないとは思わない。 : – Alex
@Alex完全に合意していますが、修正されるまでこれが効きます。 –
あなたの答えをありがとう! –