开发者

MSXML2.DOMDocument.xml give me malformed xml

开发者 https://www.devze.com 2023-01-24 00:33 出处:网络
We have an old legacy system that where a component is writter in VB6. One method returns a string that is xml data. The xml data is created with msxml3.dll MSXML2.DOMDocument and returns the data of

We have an old legacy system that where a component is writter in VB6. One method returns a string that is xml data. The xml data is created with msxml3.dll MSXML2.DOMDocument and returns the data of the document with the property xml: http://msdn.microsoft.com/en-us/library/ms755989(v=VS.85).aspx

However, some data of the xmldocument is from the database and one field is a hashed password string. The code that set the data for the element:

            Set cellNode = rowNode.appendChild(xml.createElement("COL"))
            If IsNull(rs(oField.name).Value) Then
                cellNode.Text = ""
            Else
                cellNode.Text = rs(oField.name).Value
            End If

This gives me malformed/non-wellformed 开发者_开发技巧xml:

<ROWS><ROW><COL>r<í</COL></ROW></ROWS>

Is there a workaround for this?


You should escape unicode characters. Or put them in a CDATA tag (which is not such a nice solution though) Btw < > and & should be escaped as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消