xmlDecode

value xmlDecode(text, flags, namespaces)

application/xmlでエンコードされたテキスト(XML)を値に解析します。

Flags:

Flag Description
"0" 順序付けられていない構造を返します。デフォルトです。
"1" 順序付けられた構造を返す
"i" 無視できる空白を除外する
"n" 名前空間を処理し、修飾された要素名と属性名(プレフィックス付き)を生成します

名前空間処理 / Namespace processing

有効にすると、要素名と属性名は、デフォルトの名前空間でない限り、プレフィックス、つまり x:html で修飾されます。 プレフィックスは、名前空間ディクショナリ、入力XMLから取得されるか、自動的に生成されます。 結果の構造で使用される名前空間は、ドキュメント(ルート)ディクショナリのキー "#xmlns" キーとともに格納されます。

(ENG)

When enabled the element and attribute names are qualified with a prefix, i.e x:html, unless it’s the default namespace. The prefixes will be taken from the namespace dictionary, from the input XML, or automatically generated. The namespaces used in the resulting structure are stored with the key "#xmlns key in the document (root) dictionary.

順序付けられていない構造 / Unordered structure

要素の順序が失われる不可逆的な構造。 名前でテキストのみの要素に簡単にアクセスするために使用します。 "#text" キーは、text とelement の両方の子を持つ要素に追加されます。

(ENG)

An irreversible structure where element order is lost. Use to easily access text only elements by name. An "#text" key is added to an element which has both text and element children.

<ul>
  text
  <li class="active">first</li>
  <li>second</li>
</ul>

結果の辞書構造:

{
  "#xmlns": { "http://www.w3.org/1999/xhtml" : "" },
  "#text": "text",
  "ul": [
    { "li": { "@class": "active", "#text": "first" },
    { "li": "second" }
  ]
}

順序付けられた構造 / Ordered structure

要素の順序が維持される可逆構造。

<ul>
  text
  <li class="active">first</li>
  <li>second</li>
</ul>

結果の辞書構造:

{
  "#xmlns": { "http://www.w3.org/1999/xhtml" : "" },
  "name": "ul",
  "children": [
    "text"
    { name: "li", "@class": "active", "children": [ "first" ] },
    { name: "li", "children": [ "second" ] },
  ]
}

Parameters

  1. text — デコードするXMLテキスト。
  2. flags — 各文字がフラグである任意のテキスト
  3. namespaces — マッピングにプレフィックスを付けるための名前空間URIを備えた任意の辞書

Returns