I have a legacy VB 6 application to maintain which uses msxml4.dll.
It uses the .loadXML Method of MSXML2.DOMDocument to create from xml strings and then uses the .xml Property to output strings of xml:
Dim doc As MSXML2.DOMDocument
Set doc = CreateObject("MSXML2.DOMDocument.4.0")
Call doc.loadXML("<doc/>")
' ... manipulation of doc ...
Dim xml As String
xml = doc.xml
I have discovered an issue with the .xml Property. When using the above code the string xml has a NewLine at the end:

How can I stop this from happening?
If it can't be stopped (i.e. if it's a bug in MSXML or by design) then how can I remove it in VB 6? Trim(xml) doesn't work
EDIT I have updated the question as it it the .xml Property not the .loadXML Method which appears to be at fault. If I select the doc as an Element:
Dim elm As MSXML2.IXMLDOMElement
Set elm = doc.selectSingleNode("doc")
xml = elm.xml
then the .xml Property acts as expected with no added NewLine character, so it appears it is specific to the DOMDocument.xml Property.
EDIT 2: Following SpectralGhost's answer, here is what I ended up using:
If Right(xml, Len(vbNewLine)) = vbNewLine Then
xml = Left(xml, Len(xml) - Len(vbNewLine))
End If
I use vbNewLine to avoid platform specific issues.