2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,34 +1,59 @@
DataSection
dataItemCount:
Data.i 3
names:
Data.s "April", "Tam O'Shanter", "Emily"
remarks:
Data.s "Bubbly: I'm > Tam and <= Emily",
~"Burns: \"When chapman billies leave the street ...\"",
"Short & shrift"
EndDataSection
Structure characteristic
name.s
remark.s
EndStructure
NewList didel.characteristic()
If ReadFile(0, GetCurrentDirectory()+"names.txt")
While Eof(0) = 0
AddElement(didel())
didel()\name = ReadString(0)
Wend
CloseFile(0)
EndIf
Define item.s, numberOfItems, i
Restore dataItemCount
Read.i numberOfItems
;add names
Restore names
For i = 1 To numberOfItems
AddElement(didel())
Read.s item
didel()\name = item
Next
;add remarks
ResetList(didel())
FirstElement(didel())
If ReadFile(0, GetCurrentDirectory()+"remarks.txt")
While Eof(0) = 0
didel()\remark = ReadString(0)
NextElement(didel())
Wend
CloseFile(0)
EndIf
Restore remarks:
For i = 1 To numberOfItems
Read.s item
didel()\remark = item
NextElement(didel())
Next
Define xml, mainNode, itemNode
ResetList(didel())
FirstElement(didel())
xml = CreateXML(#PB_Any)
mainNode = CreateXMLNode(RootXMLNode(xml))
SetXMLNodeName(mainNode, "CharacterRemarks")
ForEach didel()
item = CreateXMLNode(mainNode)
SetXMLNodeName(item, "Character")
SetXMLAttribute(item, "name", didel()\name)
SetXMLNodeText(item, didel()\remark)
Next
FormatXML(xml, #PB_XML_ReFormat | #PB_XML_WindowsNewline | #PB_XML_ReIndent)
SaveXML(xml, "demo.xml")
xml = CreateXML(#PB_Any)
mainNode = CreateXMLNode(RootXMLNode(xml), "CharacterRemarks")
ForEach didel()
itemNode = CreateXMLNode(mainNode, "Character")
SetXMLAttribute(itemNode, "name", didel()\name)
SetXMLNodeText(itemNode, didel()\remark)
Next
FormatXML(xml, #PB_XML_ReFormat | #PB_XML_WindowsNewline | #PB_XML_ReIndent)
If OpenConsole()
PrintN(ComposeXML(xml, #PB_XML_NoDeclaration))
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
CloseConsole()
EndIf