I have an Access Table that was originally imported from XML. When I export it I do not have the same XML structure as the original XML table.
The original imported table looks as follows:
<?xml version="1.0" standalone="true"?>
<profiling>
<program>
<name>118CDSpro</name>
<p1on>1</p1on>
<p1tool>36</p1tool>
<p2on>OFF</p2on>
<cut>OFF</cut>
<rule>OFF</rule>
<desc>118 Clad DirectSet Profile</desc>
<pic>akv.bmp</pic>
<ten>dilec_F</ten>
</program>
<profiling/>
This is what I get in an export:
<?xml version="1.0" encoding="UTF-8"?>
<dataroot generated="2016-06-27T12:16:29" xmlns:od="urn:schemas microsoft-com:officedata">
<Profiling>
<name>Din_C92S_pro2</name>
<p1on>1</p1on>
<p1tool>40</p1tool>
<p2on>OFF</p2on>
<cut>OFF</cut>
<rule>OFF</rule>
<desc>Inswing Door Sash Profile 2 (Storm)</desc>
<ten>dilec_F</ten>
</Profiling>
</dataroot>
I think the problem lies within an .xsl file, but I am new to VBA and am unsure of how it is used.
This code has to very specific as to the original format.
Any suggestions would be very appreciated.
Option 2 Code:
Sub ProfileXML2()
' RAW XML EXPORT
Application.ExportXML acExportTable, "Profiling", "C:\MyData\Crafter 0610\Crafter\MACHINE\SCHEMAS\ProfileExport.xml"
' TRANSFORM RAW XML (OPTION 2 - full XSLT processor)
Dim xmlDoc As Object, xslDoc As Object, newDoc As Object
Set xmlDoc = CreateObject("MSXML2.DOMDocument")
Set xslDoc = CreateObject("MSXML2.DOMDocument")
Set newDoc = CreateObject("MSXML2.DOMDocument")
' LOAD XML AND XSL FILES
xmlDoc.Load "C:\MyData\Crafter 0610\Crafter\MACHINE\SCHEMAS\ProfileExport.xml"
xmlDoc.async = False
xslDoc.Load "C:\MyData\Crafter 0610\Crafter\MACHINE\SCHEMAS\ProfilingSchema.xsl"
xslDoc.async = False
' TRANSFORM SOURCE TO FINAL
xmlDoc.transformNodeToObject xslDoc, newDoc
newDoc.Save "C:\MyData\Crafter 0610\Crafter\DATA\ProfilingTest.xml"
Set newDoc = Nothing
Set xslDoc = Nothing
Set xmlDoc = Nothing
End Sub