1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
Dim objDom As DOMDocument
Dim objParent As IXMLDOMElement
Dim objChild As IXMLDOMElement
Dim oNode As IXMLDOMNode
Dim Cmt As IXMLDOMComment
Dim rowCount As String
Dim columnCount As String
Dim value As String
Dim temp As String
'Configuration
locationZip = Sheets("Configuration").Range("B3").value
fileNamexml = "test.xml"
'Initialization
rowCount = Application.WorksheetFunction.CountA(Range("A1:A65536"))
columnCount = Range("A1:A255").End(xlToRight).Column
Set objDom = New DOMDocument
'properties xml file
Set oNode = objDom.createProcessingInstruction("xml", "version='1.0' encoding='UTF-8'")
Set oNode = objDom.InsertBefore(oNode, objDom.ChildNodes.Item(0))
'Creates root element core:cdm
Set objParent = objDom.createElement("cdm:CDM")
Call memberElementAttribute(objParent, objDom, "xmlns:cdm", "urn:be:fgov:ehealth:cobrha:core")
Call memberElementAttribute(objParent, objDom, "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
Call memberElementAttribute(objParent, objDom, "xsi:schemaLocation", "urn:be:fgov:ehealth:cobrha:core test.xsd")
objDom.appendChild objParent
i = 2
Do While i <= Application.WorksheetFunction.CountA(Range("A1:A65536"))
'individual
Call memberElement(objParent, objChild, objDom, "Individual", "")
Call memberElementAttribute(objChild, objDom, "OperationID", Trim(Str(i - 1)))
Call memberElementAttribute(objChild, objDom, "StartDate", "2009-01-01")
Call memberElementAttribute(objChild, objDom, "InvalidElement", "0")
i = i + 1
Loop
objDom.Save ("C:\Temp\Testcase\" & fileNamexml)
End Sub |
Partager