XU XUv0.8.8
EN

API

#encoding/xml

import: #encoding/xml

counts: 4 函数, 3 方法, 2 类型, 4 常量, 0 方法集

文本转义与 Decoder.token。无反射 Unmarshal。

const tok_start

XuAPI
pub const tok_start = 1

用途

公开常量 `tok_start`。 值为 `1`

参数

无

const tok_end

XuAPI
pub const tok_end = 2

用途

公开常量 `tok_end`。 值为 `2`

参数

无

const tok_char

XuAPI
pub const tok_char = 3

用途

公开常量 `tok_char`。 值为 `3`

参数

无

const tok_comment

XuAPI
pub const tok_comment = 4

用途

公开常量 `tok_comment`。 值为 `4`

参数

无

struct Token

XuAPI
pub struct Token {
    pub kind int
    pub name string
    pub text string
    pub keys []string
    pub vals []string
}

用途

公开结构体 `Token`。

参数

kind int
类型标签
name string
名字
text string
文本
keys []string
字段([]string)
vals []string
字段([]string)

struct Decoder

XuAPI
pub struct Decoder {
    pub data string
    pub pos int
    pub pending_end string
}

用途

公开结构体 `Decoder`。

参数

data string
数据
pos int
字段(int)
pending_end string
字段(string)

new_decoder

XuAPI
pub fn new_decoder(src &string) Decoder

用途

构造 decoder。

参数

src &string
源数据(借用,调用方仍持有;类型 &string)

返回

Decoder — 该类型的值

(Decoder) input_offset

XuAPI
pub fn (d Decoder) input_offset() int

用途

`Decoder` 上的方法:inputoffset。

参数

d Decoder
接收者 Decoder(值接收者)

返回

int — 该类型的值

escape_text

XuAPI
pub fn escape_text(s &string) string

用途

转义文本。

参数

s &string
源字符串(借用,调用方仍持有;类型 &string)

返回

string — 结果字符串

escape_string

XuAPI
pub fn escape_string(s &string) string

用途

转义特殊字符。

参数

s &string
源字符串(借用,调用方仍持有;类型 &string)

返回

string — 结果字符串

unescape_string

XuAPI
pub fn unescape_string(s &string) string

用途

还原转义。

参数

s &string
源字符串(借用,调用方仍持有;类型 &string)

返回

string — 结果字符串

(&mut Decoder) token

XuAPI
pub fn (d &mut Decoder) token() Token

用途

在 `&mut Decoder` 上调用 `token`。失败时 throw。

参数

d &mut Decoder
接收者 &mut Decoder(可变借用)

返回

Token — 该类型的值

(&mut Decoder) skip

XuAPI
pub fn (d &mut Decoder) skip() int

用途

`&mut Decoder` 上的方法:跳过。失败时 throw。

参数

d &mut Decoder
接收者 &mut Decoder(可变借用)

返回

int — 该类型的值