XU XUv0.8.8
中文

API

#encoding/xml

import: #encoding/xml

counts: 4 fns, 3 methods, 2 types, 4 consts, 0 ifaces

Text escape and Decoder.token. No reflection unmarshal.

const tok_start

XuAPI
pub const tok_start = 1

Purpose

XML 1.0 subset aligned with `encoding/xml` EscapeText + Decoder.Token. No reflect Unmarshal, no namespace URL resolution. Tokens are a tagged struct (kind + name/text + parallel attr slices). PI/DOCTYPE skipped. Value `1`.

Parameters

none

const tok_end

XuAPI
pub const tok_end = 2

Purpose

Public constant `tok_end`. Value `2`.

Parameters

none

const tok_char

XuAPI
pub const tok_char = 3

Purpose

Public constant `tok_char`. Value `3`.

Parameters

none

const tok_comment

XuAPI
pub const tok_comment = 4

Purpose

Public constant `tok_comment`. Value `4`.

Parameters

none

struct Token

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

Purpose

Public struct `Token`.

Parameters

kind int
kind tag
name string
name
text string
text
keys []string
field ([]string)
vals []string
field ([]string)

struct Decoder

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

Purpose

Public struct `Decoder`.

Parameters

data string
data
pos int
field (int)
pending_end string
field (string)

new_decoder

XuAPI
pub fn new_decoder(src &string) Decoder

Purpose

Construct decoder.

Parameters

src &string
source (borrowed; caller keeps it; type &string)

Returns

Decoder — a value of this type

(Decoder) input_offset

XuAPI
pub fn (d Decoder) input_offset() int

Purpose

Method on `Decoder`: input offset.

Parameters

d Decoder
receiver Decoder (value receiver)

Returns

int — a value of this type

escape_text

XuAPI
pub fn escape_text(s &string) string

Purpose

Escape text.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

string — result string

escape_string

XuAPI
pub fn escape_string(s &string) string

Purpose

Escape special characters.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

string — result string

unescape_string

XuAPI
pub fn unescape_string(s &string) string

Purpose

Unescape.

Parameters

s &string
source string (borrowed; caller keeps it; type &string)

Returns

string — result string

(&mut Decoder) token

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

Purpose

Call `token` on `&mut Decoder`. Throws on failure.

Parameters

d &mut Decoder
receiver &mut Decoder (exclusive borrow)

Returns

Token — a value of this type

(&mut Decoder) skip

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

Purpose

Call `skip` on `&mut Decoder`. Throws on failure.

Parameters

d &mut Decoder
receiver &mut Decoder (exclusive borrow)

Returns

int — a value of this type