| 4D v13.4DOM Count XML attributes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
 | 
    4D v13.4
 DOM Count XML attributes 
         | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DOM Count XML attributes ( elementRef ) -> 戻り値 | ||||||||
| 引数 | 型 | 説明 | ||||||
| elementRef | 文字 |   | XML要素参照 | |||||
| 戻り値 | 倍長整数 |   | 属性数 | |||||
DOM Count XML attributes コマンドは、elementRefで指定したXML要素中に現れるXML属性数を返します。XML属性に関する詳細はの節を参照してください。
要素の属性値を配列に受け取る前に、XML要素の属性数を取得します:

 C_BLOB(myBlobVar)
 C_TEXT($xml_Parent_Ref;$xml_Child_Ref)
 C_TEXT(myResult)
 C_LONGINT($numAttributes)
 
 $xml_Parent_Ref:=DOM Parse XML variable(myBlobVar)
 $xml_Child_Ref:=DOM Get first child XML element($xml_Parent_Ref)
 
 $numAttributes:=DOM Count XML attributes($xml_Child_Ref)
 ARRAY TEXT(tAttrib;$numAttributes)
 ARRAY TEXT(tValAttrib;$numAttributes)
 For($i;1;$numAttributes)
    DOM GET XML ATTRIBUTE BY INDEX($xml_Child_Ref;$i;tAttrib{$i};tValAttrib{$i})
 End for上の例題で、$numAttributesは3になり、tAttrib{1}は“Font”、tAttrib{2}は“N”、tAttrib{3}は“size”、そしてtValAttribは"Verdana","1","10"になります。
注: 配列のインデックス番号はXMLファイル中に表示される属性の順番通りではありません。XML中、属性のインデックスはnameのアルファベット順に並びかえられた属性の位置を示します。
コマンドが正しく実行されるとシステム変数OKに1が設定され、エラーが発生すると0が設定されます。
	プロダクト: 4D
	テーマ: XML DOM
	番号: 
        727
        
        
        
	
        
         
        
	変更: 4D 2004