XML 解析について質問があります。私はサンプル プログラムを試していて、解析がどのように機能するかを理解するために少し変更を加えましたが、よく理解できない出力に遭遇しました。
これは私のxmlファイルです:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<root xmlns="http://www.test.com">
<ApplicationSettings>
<option_a>"10"</option_a>
<option_b>"24"</option_b>
</ApplicationSettings>
</root>
プログラム全体にデバッグ ステートメントを挿入して、getChildNodes() などの関数呼び出しが呼び出されたときに処理されるときに何が起こるかを理解しようとしました。これは私が受け取った出力です:
Parsing xml file...
Processing Root...
Processing children with getChildNodes()...
>>>>>>>>>>> Loop child 0: Node name is: #text
>>>>>>>>>>> Loop child 1: Node name is: ApplicationSettings
= ApplicationSettings processing children with getChildNodes()...
***** iter 0 child name is #text
***** iter 1 child name is option_a
***** iter 2 child name is #text
***** iter 3 child name is option_b
***** iter 4 child name is #text
>>>>>>>>>>> Loop: 2 Node name is: #text
出力から、xml ファイルが正しく解析されていることが容易に推測できます。しかし、プログラムが #text という名前の余分なノードも検出していることに気付きました( getNodeName() 関数を使用して出力)。私の質問は、これらの#textは何を参照していて、ループ全体で定期的に表示されるのはなぜですか?
ありがとう!