Library to read and write XML (sorta) files

Started by empty, December 27, 2004, 09:18:47 AM

Previous topic - Next topic

empty

This is a library to read and write files that are similar to XML files. These files are supposed to be used as a unified file format for PlayBasic apps, that's why the library is called UFF.

Still beta and no help yet.

(Dead Link removed)


Example demo code
PlayBASIC Code: [Select]
#INCLUDE "UFF"

Dim List$(7)
List$(0) = "Hey you, standing in the road"
List$(1) = "Always doing what you're told,"
List$(2) = "Can you help me?"
List$(3) = "Hey you, out there beyond the wall,"
List$(4) = "Breaking bottles in the hall,"
List$(5) = "Can you help me?"
List$(6) = "Hey you, don't tell me there's No hope at all"
List$(7) = "Together we stand, divided we fall."

UFF = UFF_GetFreeIndex()
If FileExist("Testing.txt") Then DeleteFile "Testing.Txt"
UFF_Open("Testing.txt",UFF)

UFF_CreateClass(UFF, "MyClass\World\AndAll")
UFF_CreateClass(UFF, "MyClass2")
UFF_SetPropStr(UFF, "MyClass", "Greeting", "Hello")
UFF_AddString(UFF, "MyClass2", "Baby")
UFF_CreateClass(UFF, "MyClass2\Yo")
UFF_WriteText(UFF, "MyClass2", List$())

For i =1 To GetArrayElements(UFF_Internal_Files$(),1)
Print UFF_Internal_Files$(i)
Next i

Print ""
UFF_DeleteClass(UFF, "MyClass3\Yo")
UFF_DeleteText(UFF, "MyClass2")
UFF_DeleteClass(UFF, "MyClass2")
UFF_CreateClass(UFF, "AnotherClass")
UFF_SetPropStr(UFF, "AnotherClass", "Greeting", "Morning")
UFF_WriteText(UFF, "AnotherClass", List$())
For i =1 To GetArrayElements(UFF_Internal_Files$(),1)
Print UFF_Internal_Files$(i)
Next i

Print UFF_GetPropStr(UFF, "AnotherClass", "Greeting", "")
Print UFF_GetString(UFF, "AnotherClass", 0)

UFF_Close(UFF)
Sync : WaitKey