Skip to content

Commit

Permalink
Update yaserde to 0.8 and handle namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 18, 2023
1 parent 05b14d3 commit 49a1ad2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ repository = "https://github.com/openrr/urdf-rs"
[dependencies]
once_cell = "1"
regex = "1.4.2"
yaserde = "0.7.0"
yaserde_derive = "0.7.0"
thiserror = "1.0.7"
xml-rs = "0.8.3"
yaserde = "0.8"
yaserde_derive = "0.8"

[dev-dependencies]
assert_approx_eq = "1"
7 changes: 3 additions & 4 deletions src/deserialize.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use yaserde::xml;
use yaserde::xml::attribute::OwnedAttribute;
use yaserde::xml::namespace::Namespace;
use xml::attribute::OwnedAttribute;
use xml::namespace::Namespace;
use yaserde::{YaDeserialize, YaSerialize};
use yaserde_derive::{YaDeserialize, YaSerialize};

Expand Down Expand Up @@ -503,7 +502,7 @@ pub struct Dynamics {

/// Top level struct to access urdf.
#[derive(Debug, YaDeserialize, YaSerialize, Clone)]
#[yaserde(rename = "robot")]
#[yaserde(rename = "robot", namespace = "http://www.ros.org")]
pub struct Robot {
#[yaserde(attribute)]
pub name: String,
Expand Down
2 changes: 1 addition & 1 deletion src/funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ mod tests {
#[test]
fn deserialization() {
let s = r#"
<robot name="robot">
<robot name="robot" xmlns="http://www.ros.org">
<material name="blue">
<color rgba="0.0 0.0 0.8 1.0"/>
</material>
Expand Down

0 comments on commit 49a1ad2

Please sign in to comment.