Hello,
I am creating an XML file and I need to have data types defined in the section.
Here is my code. How do I set datatypes for the XML File?
Any help would be appreciated.Code:Dim xmlDoc As MSXML2.DOMDocument Dim xmlProcess As MSXML2.IXMLDOMProcessingInstruction Dim xmlObjSubData As IXMLDOMNode Dim xmlObjCycle As IXMLDOMNode Dim xmlObjCU As IXMLDOMNode Dim xmlObjDetails As IXMLDOMNode Dim lstrXMLFile As String Set xmlDoc = New MSXML2.DOMDocument lstrXMLFile = myxmlfile.xml If Dir(lstrXMLFile) <> "" Then Call KillFile(lstrXMLFile) 'this kills the file to start over.... End If Set xmlProcess = xmlDoc.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'") xmlDoc.appendChild xmlProcess 'create root node Set xmlObjSubData = xmlDoc.createElement("SubmissionData") xmlDoc.appendChild xmlObjSubData xmlObjSubData.appendChild xmlObjSubData.ownerDocument.createTextNode(vbCrLf + Space$(5)) Set xmlObjCycle = xmlDoc.createElement("Cycle") xmlObjSubData.appendChild xmlObjCycle xmlObjCycle.appendChild xmlObjCycle.ownerDocument.createTextNode(vbCrLf + Space$(10)) Set xmlObjDetails = xmlDoc.createElement("Month") xmlObjDetails.text = Left$(Parm5300.mstrCycleDate, 2) xmlObjDetails.dataType = "string" xmlObjCycle.appendChild xmlObjDetails xmlObjCycle.appendChild xmlObjCycle.ownerDocument.createTextNode(vbCrLf + Space$(10)) Set xmlObjDetails = xmlDoc.createElement("Year") xmlObjDetails.text = Right$(Parm5300.mstrCycleDate, 4) xmlObjDetails.dataType = "String" xmlObjCycle.appendChild xmlObjDetails xmlObjCycle.appendChild xmlObjCycle.ownerDocument.createTextNode(vbCrLf + Space$(5)) Set xmlObjCycle = Nothing 'not sure how to end the cycle...
Thanks
Dave




Reply With Quote