[Home] [By Thread] [By Date] [Recent Entries]
On 12.03.2019 18:35, Costello, Roger L. costello@xxxxxxxxx wrote:
I have an XML document containing a long list of Byte elements, e.g., I have a string of hex values, e.g., What is an efficient way to solve this problem? I think it can be done in XQuery 3 with a windowing clause, I am not sure whether you need a sliding or a tumbling window but along the lines of let $req := '04000000FF'
let $len := string-length($req)
return
head(
for sliding window $w in /Bytes/Byte
start $b1 at $s when $b1 = substring($req, 1, 2)
end at $e when $e - $s + 1 = $len idiv 2
where string-join($w) eq $req
return $s - 1
)
|

Cart



