Struct html5ever::QualName

source ·
pub struct QualName {
    pub prefix: Option<Atom<PrefixStaticSet>>,
    pub ns: Atom<NamespaceStaticSet>,
    pub local: Atom<LocalNameStaticSet>,
}
Expand description

A fully qualified name (with a namespace), used to depict names of tags and attributes.

Namespaces can be used to differentiate between similar XML fragments. For example:

// HTML
<table>
  <tr>
    <td>Apples</td>
    <td>Bananas</td>
  </tr>
</table>

// Furniture XML
<table>
  <name>African Coffee Table</name>
  <width>80</width>
  <length>120</length>
</table>

Without XML namespaces, we can’t use those two fragments in the same document at the same time. However if we declare a namespace we could instead say:

// Furniture XML
<furn:table>
  <furn:name>African Coffee Table</furn:name>
  <furn:width>80</furn:width>
  <furn:length>120</furn:length>
</furn:table>

and bind the prefix furn to a different namespace.

For this reason we parse names that contain a colon in the following way:

<furn:table>
   |    |
   |    +- local name
   |
 prefix (when resolved gives namespace_url)

Fields

prefix: Option<Atom<PrefixStaticSet>>

The namespace before resolution (e.g. furn in <furn:table> above).

ns: Atom<NamespaceStaticSet>

The namespace after resolution.

local: Atom<LocalNameStaticSet>

The local name (e.g. table in <furn:table> above).

Implementations

Simple constructor function.

Take a reference of self as an ExpandedName, dropping the unresolved prefix.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.