Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

JSONML decodes text entities twice with keepStrings enabled

オープン 初心者向け
#1,079 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
backend

調査の方向性

JSONML.parse() から開始し、keepStrings ブランチに注目して、issue が関連するパスとして特定している XMLTokener.nextContent() および XML.unescape() と比較してください。提供されている Java の例を再現し、その後、keepStrings がテキストノードを "<" として保持すること、および結果を XML に戻して変換しても元のテキストが保持されることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

JSONML decodes text nodes twice when keepStrings is enabled. Attributes and the default mode decode the same input once.

Reproduced on release 20260814 and current master (874673575807723d58bbec9ff1985668742940ce), with Java 17.0.20:

import org.json.JSONML;

String xml = "<p title=\"&amp;lt;\">&amp;lt;</p>";
System.out.println(JSONML.toJSONArray(xml, false));
System.out.println(JSONML.toJSONArray(xml, true));

Output:

["p",{"title":"&lt;"},"&lt;"]
["p",{"title":"&lt;"},"<"]

The second result should also contain "&lt;" as its text node. Enabling keepStrings should affect type conversion, not the text itself. toJSONObject(xml, true) has the same behavior, and converting the result back to XML changes the original text.

XMLTokener.nextContent() already decodes entities, but the keepStrings branch in JSONML.parse() calls XML.unescape() again. This looks like a remaining case from #362, which removed the extra decoding for JSONML attributes and the XML conversion paths.

主要言語
Java
スター
4.7k
フォーク
2.6k
平均マージ
6日 20時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

stleary/JSON-java のほかの issue

stleary/JSON-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。