How GetXMLAttribute() work ?
Posted: Sat Jun 02, 2007 9:27 pm
SetXMLAttribute() work fine, so what i am doing wrong with GetXMLAttribute() ? it dont work.
file : plan.xml
file : plan.xml
Code: Select all
<mesh>
<submeshes>
<submesh material="plan/system" usesharedvertices="false" use32bitindexes="false" operationtype="triangle_list">
<faces count="2">
<face v1="2" v2="1" v3="0" />
<face v1="0" v2="3" v3="2" />
</faces>
<geometry vertexcount="4">
<vertexbuffer positions="true" normals="true" texture_coord_dimensions_0="2" texture_coords="1">
<vertex>
<position x="0" y="0" z="0" />
<normal x="0" y="1" z="0" />
<texcoord u="-2" v="-2" />
</vertex>
<vertex>
<position x="1" y="0" z="0" />
<normal x="0" y="1" z="0" />
<texcoord u="2" v="-2" />
</vertex>
<vertex>
<position x="1" y="0" z="1" />
<normal x="0" y="1" z="0" />
<texcoord u="2" v="2" />
</vertex>
<vertex>
<position x="0" y="0" z="1" />
<normal x="0" y="1" z="0" />
<texcoord u="-2" v="2" />
</vertex>
</vertexbuffer>
</geometry>
</submesh>
</submeshes>
</mesh>
Code: Select all
file$ = "plan.xml"
Procedure AddNode(*Node, Position)
name$ = GetXMLNodeName(*Node)
AddGadgetItem (0, -1, name$, 0, position)
If name$ = "face"
SetXMLAttribute(*Node,"v1","1234")
;ExamineXMLAttributes(*Node)
;While NextXMLAttribute(*Node)
Debug GetXMLAttribute(*Node, "v1")
Debug GetXMLAttribute(*Node, "v2")
Debug GetXMLAttribute(*Node, "v3")
;Wend
Debug "----"
EndIf
For child = 1 To XMLChildCount(*Node)
*child = ChildXMLNode(*Node, child)
AddNode(*child, position+1)
Next
EndProcedure
OpenWindow(0, 0, 0, 355, 280, "TreeGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
TreeGadget(0, 10, 10, 260, 260)
tree = LoadXML(#PB_Any, file$)
status = XMLStatus(tree)
If status=0
AddNode(MainXMLNode(tree), 0)
EndIf
SaveXML(tree,"test.xml")
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow