XML Support in 4.0

Tim Hall edited this page Apr 8, 2015 · 4 revisions

Currently, XML is not supported in 4.0.0 due to lack of Mac support. An updated parser is being created that supports Mac and Windows, but in order to avoid future breaking changes, ParseXml and ConvertToXml are not currently implemented.

To use XML in Windows in the meantime, follow these steps:

1. Create XML Converter

In a new or existing module, add the following:

' ModuleName.bas
Public Function ParseXml(Value As String) As Object
    Set ParseXml = CreateObject("MSXML2.DOMDocument")
    ParseXml.Async = False
    ParseXml.LoadXML Value
End Function

Public Function ConvertToXml(Value As Variant) As String
    ConvertToXml = Trim(Replace(Value.Xml, vbCrLf, ""))
End Function

2. Register XML Converter

Register converter before it is used in WebRequest

WebHelpers.RegisterConverter "xml", "application/xml", "ModuleName.ConvertToXml", "ModuleName.ParseXml"

3. Use XML Converter in WebRequest

Request.CustomRequestFormat = "xml"
Request.CustomResponseFormat = "xml"
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.