@@ -7,22 +7,22 @@ use crate::engine::Engine;
7
7
use crate :: foundations:: { dict, func, scope, Array , Dict , IntoValue , Str , Value } ;
8
8
use crate :: loading:: { DataSource , Load , Readable } ;
9
9
10
- /// Reads structured data from an XML file.
10
+ /// XMLファイルから構造化データを読み込む。
11
11
///
12
- /// The XML file is parsed into an array of dictionaries and strings. XML nodes
13
- /// can be elements or strings. Elements are represented as dictionaries with
14
- /// the following keys:
12
+ /// XMLファイルは辞書と文字列からなる配列にパースされます。
13
+ /// XMLノードは要素または文字列になり得ます。
14
+ /// 要素は以下のキーを持つ辞書として表現されます。
15
15
///
16
- /// - `tag`: The name of the element as a string.
17
- /// - `attrs`: A dictionary of the element's attributes as strings.
18
- /// - `children`: An array of the element's child nodes.
16
+ /// - `tag`: 要素の名称を表す文字列。
17
+ /// - `attrs`: 要素の属性を表す文字列からなる辞書。
18
+ /// - `children`: 要素の子ノードからなる配列。
19
19
///
20
- /// The XML file in the example contains a root `news` tag with multiple
21
- /// `article` tags. Each article has a ` title`, `author`, and `content` tag. The
22
- /// `content` tag contains one or more paragraphs, which are represented as `p`
23
- /// tags.
20
+ /// この例におけるXMLファイルは、ルート要素である `news`タグと複数の`article`タグを含んでいます。
21
+ /// それぞれのarticleは` title`、 `author`、および `content`タグを持っています。
22
+ /// `content`タグは1つ以上の段落を含んでおり、
23
+ /// これらは`p`タグとして表現されています。
24
24
///
25
- /// # Example
25
+ /// # 例
26
26
/// ```example
27
27
/// #let find-child(elem, tag) = {
28
28
/// elem.children
@@ -58,7 +58,7 @@ use crate::loading::{DataSource, Load, Readable};
58
58
#[ func( scope, title = "XML" ) ]
59
59
pub fn xml (
60
60
engine : & mut Engine ,
61
- /// A [path ]($syntax/#paths) to an XML file or raw XML bytes.
61
+ /// XMLファイルの[パス ]($syntax/#paths)または生のXMLバイト列。
62
62
source : Spanned < DataSource > ,
63
63
) -> SourceResult < Value > {
64
64
let data = source. load ( engine. world ) ?;
@@ -74,12 +74,12 @@ pub fn xml(
74
74
75
75
#[ scope]
76
76
impl xml {
77
- /// Reads structured data from an XML string/bytes.
77
+ /// XMLの文字列やバイト列から構造化データを読み込む。
78
78
#[ func( title = "Decode XML" ) ]
79
- #[ deprecated = "`xml.decode` is deprecated, directly pass bytes to `xml` instead " ]
79
+ #[ deprecated = "`xml.decode`は非推奨です。代わりにバイト列を直接 `xml`に渡してください。 " ]
80
80
pub fn decode (
81
81
engine : & mut Engine ,
82
- /// XML data.
82
+ /// XMLデータ。
83
83
data : Spanned < Readable > ,
84
84
) -> SourceResult < Value > {
85
85
xml ( engine, data. map ( Readable :: into_source) )
0 commit comments