/// Expand an XML attribute in the form `namespace:id` into an IRI.
///
/// This uses the `xmlns` default namespace to expand local attributes,
/// or any declared namespace in the current scope.
Expand an XML attribute in the form `namespace:id` into an IRI.
This uses the `xmlns` default namespace to expand local attributes,
or any declared namespace in the current scope.
Expand an XML attribute in the form ` namespace : id ` into an IRI . This uses the ` xmlns ` default namespace to expand local attributes or any declared namespace in the current scope .
pub fn expand_attribute(&self, attr: &str) -> ScopeResult<Term<F::TermData>> {
        if let Some(separator_idx) = attr.chars().position(|c| c == ':') {
            let prefix = &attr[..separator_idx];
            let reference = &attr[separator_idx + 1..];
            if let Some(ns) = self.ns.get(prefix) {
                Ok(self.factory.borrow_mut().clone_term(&ns.get(reference)?))
            } else {
                Err(RdfError::UnknownNamespace(prefix.to_owned()))
            }
        } else if let Some(ns) = &self.default {
            Ok(self.factory.borrow_mut().clone_term(&ns.get(attr)?))
        } else {
            Err(RdfError::UnknownNamespace("_".to_owned()))
        }
    }
pub fn expand_attribute ( & self , attr : & str ) -> ScopeResult < Term < F :: TermData > > { if let Some ( separator_idx ) = attr . chars ( ) . position ( | c | c == ':' ) { let prefix = & attr [ .. separator_idx ] ; let reference = & attr [ separator_idx + 1 .. ] ; if let Some ( ns ) = self . ns . get ( prefix ) { Ok ( self . factory . borrow_mut ( ) . clone_term ( & ns . get ( reference ) ? ) ) } else { Err ( RdfError :: UnknownNamespace ( prefix . to_owned ( ) ) ) } } else if let Some ( ns ) = & self . default { Ok ( self . factory . borrow_mut ( ) . clone_term ( & ns . get ( attr ) ? ) ) } else { Err ( RdfError :: UnknownNamespace ( " " . to_owned ( ) ) ) } }
Expand an XML attribute in the form `namespace:id` into an IRI.
Expand an XML attribute in the form ` namespace : id ` into an IRI .
&self
attr
&str