添付されているのは、2つのスクリーンショットと私のコードです。私はanimation_sequenceを閉じ括弧と終了括弧として取得しようとしています。最善を尽くしましたが、今はあなたの助けを求めています。これが私の試みです。これを行うことにしましたが、「Yahoo」のように「Yahoo」と表示されるようになりました。アニメーションシーケンスのsetTextContentに関係している可能性があることはわかっています(ただし、それがどのようにできるかはわかりませんが)状態コンテンツにスペースを追加します。ここでの問題は、アニメーションシーケンスに閉じ括弧と終了ブラケットを含めることだけでした。ifステートメントで2つの余分なスペースを探すことで解決しましたが、それは哀れなアプローチだと思います。敗北を受け入れるようなものです。私が添付した2番目の画像は、状態に余分な「」を追加せずに達成したいものです。以下の私のコード(具体的には設定されたテキストコンテンツ部分)がないと、画像1が生成されます。私がそれを解決したと思ったちょうどその時、これらの2つのスペースは私を殺しています。追加のコードが必要な場合は、お知らせください。あなたの助けが必要です。
Element animationState = testDoc.createElement("animation_state");
Element sequence = testDoc.createElement("animation_sequence");
sequence.setTextContent(" ");
sequence.appendChild(testDoc.createTextNode(" "));
testDoc.getElementsByTagName("animations_list").item(0).appendChild(animationState).appendChild(state);
testDoc.getElementsByTagName("animation_state").item(testDoc.getElementsByTagName("state").getLength() - 1).appendChild(sequence);
for(int i = 0; i<testDoc.getElementsByTagName("animation_state").getLength(); i++)
{
if( testDoc.getElementsByTagName("animation_state").item(i).getTextContent().
equals(Poseur.getPoseur().getAnimatedSpriteViewer().getSpriteStateComboBox().
getSelectedItem().toString())||(testDoc.getElementsByTagName("animation_state").item(i).getTextContent()).equals(Poseur.getPoseur().getAnimatedSpriteViewer().getSpriteStateComboBox().getSelectedItem().toString()+" "))
{
testDoc.getElementsByTagName("animation_sequence").item(i).appendChild(poseImage);
}
}