Import ns itself, and remove the _NS suffix on all namespaces.
This commit is contained in:
parent
411e421732
commit
7288c2c74f
10 changed files with 47 additions and 47 deletions
|
|
@ -2,7 +2,7 @@ use minidom::Element;
|
|||
|
||||
use error::Error;
|
||||
|
||||
use ns::MEDIA_ELEMENT_NS;
|
||||
use ns;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct URI {
|
||||
|
|
@ -18,7 +18,7 @@ pub struct MediaElement {
|
|||
}
|
||||
|
||||
pub fn parse_media_element(root: &Element) -> Result<MediaElement, Error> {
|
||||
if !root.is("media", MEDIA_ELEMENT_NS) {
|
||||
if !root.is("media", ns::MEDIA_ELEMENT) {
|
||||
return Err(Error::ParseError("This is not a media element."));
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ pub fn parse_media_element(root: &Element) -> Result<MediaElement, Error> {
|
|||
let height = root.attr("height").and_then(|height| height.parse().ok());
|
||||
let mut uris = vec!();
|
||||
for uri in root.children() {
|
||||
if uri.is("uri", MEDIA_ELEMENT_NS) {
|
||||
if uri.is("uri", ns::MEDIA_ELEMENT) {
|
||||
let type_ = uri.attr("type").ok_or(Error::ParseError("Attribute type on uri is mandatory."))?;
|
||||
let text = uri.text().trim().to_owned();
|
||||
if text == "" {
|
||||
|
|
|
|||
Loading…
Reference in a new issue