我在“ Inbound”表的“ RawData”列中有一个xml字符串,我必须从一个名为“ status”的元素中读取“ Success”值。
xmlstring:
<InboundMessage><Transaction><Status>Success</Status></Transaction></InboundMessage>
答案 0 :(得分:0)
paste
。 Java代码:maxfn <- function(a, b, c){
do.call(paste, subset( data.frame(col1 = strrep(letters[1:3], 3),
col2 = c(a, b, c)), col2 == max(col2)))
}
maxfn(3, 2, 1)
#[1] "aaa 3"
maxfn(3, 2, 10)
#[1] "ccc 10"
<Status>(\w*)<\/Status>
String in = "<InboundMessage><Transaction><Status>Success</Status></Transaction></InboundMessage>";
Pattern compile = Pattern.compile("<Status>(\\w*)<\\/Status>");
Matcher matcher = compile.matcher(in);
if (matcher.find()) {
System.out.println(matcher.group(1));
}