I'm fairly new to developing XML (I know enough to be dangerous) and I am having a problem (in VBA) when I load an XML document, it seems to reformat my XML (and incorrectly at that). I don't want the XML formatted. How do I keep it from reformatting?
Here are is some of the code I am using:
Here is the XML before load:Code:Dim xmlDoc As MSXML2.DOMDocument60 'early bind ... Set xmlDoc = New MSXML2.DOMDocument60 'early bind ... xmlDoc.async = False xmlDoc.validateOnParse = False 'put this attempting to stop formatting xmlDoc.resolveExternals = False 'put this attempting to stop formatting 'open the XML file If xmlDoc.Load(fso.BuildPath(xmlDocPath, UIN & ".xml")) Then Debug.Print xmlDoc.XML ... Else ... End If
Here is the XML generated immediately after load (debug.print xmlDoc.XML):Code:<?xml version="1.0" encoding="UTF-8"?><assessmentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" keyType="SingleResponse" schema="our XML schema" schemaVersion="1.0" guid="4EE3791C-BB87-4577-BAE3-973A4C8E2FAB" uin="123456"><itemBody><stemArea id="stem1"><text id="text1">some text here<i> </i>text<i> </i>more text here</text></stemArea</itemBody></assessmentItem>
Again, how can I stop it from reformatting the XML? I need it to be unformatted.Code:<?xml version="1.0"?> <assessmentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" keyType="SingleResponse" schema="our XML schema" schemaVersion="1.0" guid="4EE3791C-BB87-4577-BAE3-973A4C8E2FAB" uin="123456"><itemBody><stemArea id="stem1"><text id="text1">some text here<i> </i>text<i> </i>more text here</text></stemArea></itemBody></assessmentItem>




Reply With Quote