The VariantString contains a base64 encoded xmlstructure.
Code:
Get AddElementNS of hMessage XMLVANSENVELOPE_NS "Data" "" to hData
// Get AddElement of hMessage "Data" "" to hData
If (hData) Begin
// Indholdet i Data er altid Base64 encoded.
Address aTest
Boolean bok
Get Create (RefClass(cCharTranslate)) to hCharTranslate
Get VariantStrToBuffer of hCharTranslate lsMessage.lsData.vData CP_UTF8 to aTest
Move (CStringLength(aTest)) to lsMessage.lsData.iDataLength
Get Base64EncodeToVariantStr of hCharTranslate aTest lsMessage.lsData.iDataLength to vBase64Data
Move (Free(aTest)) to bok
Get FirstChild of hData to hTextNode
If (hTextNode) Begin
Set pvNodeValue of hTextNode to vBase64Data
Send Destroy of hTextNode
End
This does not work since the FirstChild function does not return a textnode.
If I comment out the namespaceaware AddElementNS and use the non-namespaceaware AddElement like this:
Code:
// Get AddElementNS of hMessage XMLVANSENVELOPE_NS "Data" "" to hData
Get AddElement of hMessage "Data" "" to hData
...
it does give a hTextNode handle. But it does not work either since the Data element is no longer a part of the XMLVANSENVELOPE_NS namespace and the schemavalidation fails.
How do I add a VariantString to an element that is namespace aware?
The result should be something like this
Code:
... part of XMLVANSENVELOPE_NS namespace ...
<Data>{base64data}</Data>
...