Skip to main content

Document

Struct Document 

Source
pub struct Document { /* private fields */ }
Expand description

読んだ XML の文書。元のバイト列と、要素

Implementations§

Source§

impl Document

Source

pub fn encoding(&self) -> Encoding

文字コード

Source

pub fn src(&self) -> &[u8] ⓘ

元のバイト列

Source

pub fn bytes(&self, range: Range<usize>) -> &[u8] ⓘ

元のバイト列の範囲。外なら空

Source

pub fn root(&self) -> usize

ルートの要素の番号。いつも 0

Source

pub fn element(&self, index: usize) -> Option<&Element>

番号の要素。番号は、開始タグを書いた順

Source

pub fn elements(&self) -> &[Element]

要素。開始タグを書いた順

Source

pub fn doctype(&self) -> Option<Range<usize>>

文書型宣言(<!DOCTYPE …>)の範囲。処理はしない

Source

pub fn local_name(&self, name: &Name) -> &[u8] ⓘ

名前の、接頭辞を除いた部分のバイト列

Source

pub fn namespace(&self, name: &Name) -> Option<String>

名前空間の名前(URI)。名前空間がなければ None

Source

pub fn is(&self, name: &Name, namespace: Option<&str>, local: &[u8]) -> bool

名前の名前空間が namespace(URI)で、接頭辞を除いた名前が local なら真

Source

pub fn text(&self, range: Range<usize>) -> String

文字の範囲を文字にする。文字コードを戻し、改行を \n にそろえ、定義済みの実体と文字の参照を戻す。 DTD で宣言する実体の参照は、そのまま残す

Source

pub fn cdata(&self, range: Range<usize>) -> String

<![CDATA[…]]> の内側を文字にする。文字コードを戻し、改行を \n にそろえる。参照は戻さない

Source

pub fn value(&self, attribute: &Attribute) -> String

属性の値を文字にする。Document::text に加え、XML の属性の値の正規化で、空白の文字を空白にする

Source

pub fn attribute<'e>( &self, element: &'e Element, namespace: Option<&str>, local: &[u8], ) -> Option<&'e Attribute>

要素の、名前空間と接頭辞を除いた名前が合う属性

Trait Implementations§

Source§

impl Clone for Document

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Document

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Document

Source§

impl PartialEq for Document

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Document

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.