Struct xml::name::Name
[−]
[src]
pub struct Name<'a> {
pub local_name: &'a str,
pub namespace: Option<&'a str>,
pub prefix: Option<&'a str>,
}Represents a qualified XML name.
A qualified name always consists at least of a local name. It can optionally contain a prefix; if it contains a prefix, it must also contain a namespace URI, but this is not enforced statically; see below. The name can contain a namespace without a prefix; in that case a default, empty prefix is assumed.
Prefixes and URIs
A qualified name with a prefix must always contain a proper namespace URI --- names with a prefix but without a namespace associated with that prefix are meaningless. However, it is impossible to obtain proper namespace URY by a prefix without a context, and such context is only available when parsing a document (or it can be constructed manually when writing a document). Tying a name to a context statically seems impractical. This may change in future, though.
Fields
local_name: &'a str
A local name, e.g. string in xsi:string.
namespace: Option<&'a str>
A namespace URI, e.g. http://www.w3.org/2000/xmlns/.
prefix: Option<&'a str>
A name prefix, e.g. xsi in xsi:string.
Methods
impl<'a> Name<'a>[src]
fn to_owned(&self) -> OwnedName
Returns an owned variant of the qualified name.
fn local(local_name: &str) -> Name
Returns a new Name instance representing plain local name.
fn qualified(local_name: &'a str, namespace: &'a str, prefix: Option<&'a str>) -> Name<'a>
Returns a new Name instance representing a qualified name with or without a prefix and
with a namespace URI.
fn to_repr(&self) -> String
Returns correct XML representation of this local name and prefix.
This method is different from the autoimplemented to_string() because it does not
include namespace URI in the result.
Trait Implementations
impl<'a> Debug for Name<'a>[src]
impl<'a> Hash for Name<'a>[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher1.3.0
Feeds a slice of this type into the state provided.
impl<'a> Eq for Name<'a>[src]
impl<'a> PartialEq for Name<'a>[src]
fn eq(&self, __arg_0: &Name<'a>) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Name<'a>) -> bool
This method tests for !=.
impl<'a> Clone for Name<'a>[src]
fn clone(&self) -> Name<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more