[][src]Struct xml_dom::level2::Name

pub struct Name { /* fields omitted */ }

Corresponds to attributes localName, namespaceURI, and prefix on the DOM Node interface.

Specification

localName of type DOMString, readonly, introduced in DOM Level 2

Returns the local part of the qualified name of this node. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

namespaceURI of type DOMString, readonly, introduced in DOM Level 2

The namespace URI of this node, or null if it is unspecified. This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

Note: Per the Namespaces in XML Specification an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

prefix of type DOMString, introduced in DOM Level 2

The namespace prefix of this node, or null if it is unspecified. Note that setting this attribute, when permitted, changes the nodeName attribute, which holds the qualified name, as well as the tagName and name attributes of the Element and Attr interfaces, when applicable. Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the namespaceURI and localName do not change. For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1 method, such as createElement from the Document interface, this is always null.

Exceptions on setting

  • INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character.
  • NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
  • NAMESPACE_ERR: Raised if the specified prefix is malformed, if the namespaceURI of this node is null, if the specified prefix is "xml" and the namespaceURI of this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and the namespaceURI of this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and the qualifiedName of this node is "xmlns".

Methods

impl Name[src]

pub fn new_ns(namespace_uri: &str, qualified_name: &str) -> Result<Self>[src]

Construct a new Name from the specified namespace URI and qualified name.

Note, errors include a malformed URI, or malformed prefix or local name.

pub fn for_cdata() -> Self[src]

Return the reserved name for CDATA section nodes

pub fn for_comment() -> Self[src]

Return the reserved name for Comment nodes

pub fn for_document() -> Self[src]

Return the reserved name for Document nodes

pub fn for_document_fragment() -> Self[src]

Return the reserved name for Document nodes

pub fn for_text() -> Self[src]

Return the reserved name for Text nodes

pub fn for_public_id() -> Self[src]

Return the reserved name for DocumentType public_id attribute

pub fn for_system_id() -> Self[src]

Return the reserved name for DocumentType system_id attribute

pub fn is_namespace_attribute(&self) -> bool[src]

Does this appear to be an xmlns attribute.

pub fn for_namespace(prefix: Option<&str>) -> Self[src]

Construct a name for an xmlns attribute.

pub fn is_id_attribute(&self, lax: bool) -> bool[src]

Does this appear to be an id attribute.

pub fn for_xml_id() -> Self[src]

Construct a name for an xml:id attribute. ///

pub fn namespace_uri(&self) -> &Option<String>[src]

Return this name's namespace URI.

pub fn local_name(&self) -> &String[src]

Return this name's local name.

pub fn prefix(&self) -> &Option<String>[src]

Return this name's prefix.

pub fn set_prefix(&mut self, new_prefix: Option<&str>) -> Result<()>[src]

Set this name's prefix.

Trait Implementations

impl Clone for Name[src]

impl Debug for Name[src]

impl Display for Name[src]

impl Eq for Name[src]

impl FromStr for Name[src]

type Err = Error

The associated error which can be returned from parsing.

impl Hash for Name[src]

impl PartialEq<Name> for Name[src]

impl StructuralEq for Name[src]

impl StructuralPartialEq for Name[src]

impl<'_> TryFrom<&'_ [u8]> for Name[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Name

impl Send for Name

impl Sync for Name

impl Unpin for Name

impl UnwindSafe for Name

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.