delay: Correctly parse the content data.
This commit is contained in:
parent
cfadff3bc9
commit
d39d13b7cb
1 changed files with 5 additions and 1 deletions
|
@ -20,10 +20,14 @@ pub fn parse_delay(root: &Element) -> Result<Delay, Error> {
|
||||||
}
|
}
|
||||||
let from = root.attr("from").and_then(|value| value.parse().ok());
|
let from = root.attr("from").and_then(|value| value.parse().ok());
|
||||||
let stamp = root.attr("stamp").ok_or(Error::ParseError("Mandatory argument 'stamp' not present in delay element."))?.to_owned();
|
let stamp = root.attr("stamp").ok_or(Error::ParseError("Mandatory argument 'stamp' not present in delay element."))?.to_owned();
|
||||||
|
let data = match root.text().as_ref() {
|
||||||
|
"" => None,
|
||||||
|
text => Some(text.to_owned()),
|
||||||
|
};
|
||||||
Ok(Delay {
|
Ok(Delay {
|
||||||
from: from,
|
from: from,
|
||||||
stamp: stamp,
|
stamp: stamp,
|
||||||
data: None,
|
data: data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue