オプションのノードの存在をテストする適切な方法は何ですか?私のXMLの一部は次のとおりです。
<Antenna >
<Mount Model="text" Manufacture="text">
<BirdBathMount/>
</Mount>
</Antenna>
しかし、それは次のようにもなります。
<Antenna >
<Mount Model="text" Manufacture="text">
<AzEl/>
</Mount>
</Antenna>
アンテナの子はBirdBathまたはAzElのいずれかですが、両方ではありません...
Delphi XEで私は試しました:
if (MountNode.ChildNodes.Nodes['AzEl'] <> unassigned then //Does not work
if (MountNode.ChildNodes['BirdBathMount'].NodeValue <> null) then // Does not work
if (MountNode.BirdBathMount.NodeValue <> null) then // Does not work
XMLSpyを使用してスキーマとサンプルXMLを作成し、それらを正しく解析します。Delphi XEを使用してバインディングを作成しましたが、他のほとんどの組み合わせで問題なく機能します。
これは私が見落とした単純な答えを持っている必要があります-しかし何ですか?ありがとう……ジム