okay, I have the following idea:
I’d like to store data with a client and use the same data with another client via network.
So my idea was to generate an XML file and store it in CCG using DATA STORE.
So I serialized the XML into a string and try to send it.
At the first attempt DATA STORE only saved the first word /<xml. So I replaced every CRLF with an “;”. Result: no real approvement.
While experimenting I noticed that every time a SPACE sign occurs in the text the data storage ends.
That is happening as well when I try to save a single line. “Thomas Mueller” is saved as “Thomas” only.
Function xml_serialize(ByVal obj As Object) As String
Dim serializer As New Serialization.XmlSerializer(obj.GetType)
Dim s As String
Dim ms As New MemoryStream()
serializer.Serialize(ms, obj)
' --- Stream in String umwandeln
Dim r As StreamReader = New StreamReader(ms)
r.BaseStream.Seek(0, SeekOrigin.Begin)
s = r.ReadToEnd
Return s
End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim xml As XmlDocument = CollectSnapData()
CasparDevice.SendString("DATA STORE TEST " & xml_serialize(xml).Replace(vbCrLf, ";"))
End Sub
whereas “CollectSnapData” is a Function that produces a XML looking like
Yeah that code doesn’t look like it’s quoting the data. Are you using the libdotnet library? Then you should probably use something like CasparDevice.StoreData('TEST', xml)
That makes the XML invalid. You can simply remove the CRLF or keep them, that does not make a difference.
To send the XML via DATA STORE (and also with CG ADD) all quotes " needs to be replaced by \" (escaped) and then the whole XML needs to be enclosed in with (unescaped) ". Without the escaping of the quotes, Caspar will interpret the second quote it finds as the end of the data.
Thanks for your input. You’re right: Spoiling the XML-file dosen’t lead to a proper outcome
However hrreinbecks solution works for me with some modifications.