DataFlex
DataFlex
Xml.UpdateAttrAt Example #2
Another Xml.UpdateAttrAt example...Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoXml
Handle hoSbValue
Integer i
Boolean iSuccess
String sTemp1
Get Create (RefClass(cComChilkatXml)) To hoXml
If (Not(IsComObjectCreated(hoXml))) Begin
Send CreateComObject of hoXml
End
Set ComTag Of hoXml To "abc"
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbValue
If (Not(IsComObjectCreated(hoSbValue))) Begin
Send CreateComObject of hoSbValue
End
Move 0 To i
While (i < 10)
Set ComI Of hoXml To i
Send ComClear To hoSbValue
Get ComAppendInt Of hoSbValue i To iSuccess
Get ComGetAsString Of hoSbValue To sTemp1
Get ComUpdateAttrAt Of hoXml "xyz|test[i]" True "index" sTemp1 To iSuccess
Move (i + 1) To i
Loop
Get ComGetXml Of hoXml To sTemp1
Showln sTemp1
// Output is:
// <?xml version="1.0" encoding="utf-8" ?>
// <abc>
// <xyz>
// <test index="0" />
// <test index="1" />
// <test index="2" />
// <test index="3" />
// <test index="4" />
// <test index="5" />
// <test index="6" />
// <test index="7" />
// <test index="8" />
// <test index="9" />
// </xyz>
// </abc>
End_Procedure