pub struct Document { /* private fields */ }Expand description
読んだ XML の文書。元のバイト列と、要素
Implementations§
Source§impl Document
impl Document
Sourcepub fn local_name(&self, name: &Name) -> &[u8] ⓘ
pub fn local_name(&self, name: &Name) -> &[u8] ⓘ
名前の、接頭辞を除いた部分のバイト列
Sourcepub fn parsed_local_name(&self, name: &Name) -> &[u8] ⓘ
pub fn parsed_local_name(&self, name: &Name) -> &[u8] ⓘ
字句解析に使う名前。UTF-16 は UTF-8、UTF-8 と Shift_JIS は元の文字コードのまま。
ASCII の要素名の比較に使う。原本の取得は Self::local_name、文字は Self::local_name_text。
Sourcepub fn local_name_text(&self, name: &Name) -> Cow<'_, str>
pub fn local_name_text(&self, name: &Name) -> Cow<'_, str>
接頭辞を除いた名前を文字にする。原本の範囲を返す Self::local_name と区別する。
Sourcepub fn is(&self, name: &Name, namespace: Option<&str>, local: &[u8]) -> bool
pub fn is(&self, name: &Name, namespace: Option<&str>, local: &[u8]) -> bool
名前の名前空間が namespace(URI)で、接頭辞を除いた名前が local なら真。
local は Document::parsed_local_name とバイトで比べる。非 ASCII の文字列は Document::local_name_text で比べる
Sourcepub fn text(&self, range: Range<usize>) -> String
pub fn text(&self, range: Range<usize>) -> String
文字の範囲を文字にする。文字コードを戻し、改行を \n にそろえ、定義済みの実体と文字の参照を戻す。
DTD で宣言する実体の参照は、そのまま残す
Sourcepub fn cdata(&self, range: Range<usize>) -> String
pub fn cdata(&self, range: Range<usize>) -> String
<![CDATA[…]]> の内側を文字にする。文字コードを戻し、改行を \n にそろえる。参照は戻さない
Sourcepub fn value(&self, attribute: &Attribute) -> String
pub fn value(&self, attribute: &Attribute) -> String
属性の値を文字にする。Document::text に加え、XML の属性の値の正規化で、空白の文字を空白にする
Trait Implementations§
impl Eq for Document
impl StructuralPartialEq for Document
Auto Trait Implementations§
impl Forget for Document
impl Freeze for Document
impl Move for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more