Can anyone help, i have xml file in text format in string variable. Now if i want to parse XML with PB commands, i need to convert this text value to PB XML. How to do this?
Thanks
Karu
Howto convert text to XML
Re: Howto convert text to XML
With ParseXML()
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Howto convert text to XML
Thanks STARGÅTE, but only ParseXML() i fuond from here: http://www.purebasic.fr/english/viewtop ... ML+#p95066
But with this solution i cant use Purebasic XML commands like 'XMLStatus(#XML)', is there other way?
But with this solution i cant use Purebasic XML commands like 'XMLStatus(#XML)', is there other way?
Re: Howto convert text to XML

PB 5.30 Beta 4:
Code: Select all
Enumeration
#XML
EndEnumeration
Define Text.s = ReplaceString("<Node Attribute='Value'>Text</Node>", "'", #DOUBLEQUOTE$)
If ParseXML(#XML, Text)
Debug XMLStatus(#XML)
*Node = MainXMLNode(#XML)
Debug GetXMLNodeName(*Node)
Debug GetXMLAttribute(*Node, "Attribute")
Debug GetXMLNodeText(*Node)
EndIf
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Howto convert text to XML
Ok, but in 5.2 version?
Re: Howto convert text to XML
PB 5.20:
Code: Select all
Enumeration
#XML
EndEnumeration
Define Text.s = ReplaceString("<Node Attribute='Value'>Text</Node>", "'", #DOUBLEQUOTE$)
If CatchXML(#XML, @Text, StringByteLength(Text))
Debug XMLStatus(#XML)
*Node = MainXMLNode(#XML)
Debug GetXMLNodeName(*Node)
Debug GetXMLAttribute(*Node, "Attribute")
Debug GetXMLNodeText(*Node)
EndIf
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Howto convert text to XML
Thanks STARGÅTE
Re: Howto convert text to XML
@karu Thank you for the question.
@STARGÅTE Thank you for the answer.
@STARGÅTE Thank you for the answer.

DE AA EB