We can create an Object Repository Via XML as Well
Function XmlController()
Set doc = CreateObject("Microsoft.XMLDOM")
doc.async = false
doc.ValidateonParse = False
doc.resolveExternals = False
doc.LoadXml("
doc.save "C:\Test.xml"
Set doc= Nothing
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("C:\Test.xml")
Dim objCurrNode, objNewNode, objNewText
Call makeDisc(objXMLDoc)
Call makeFiles(objXMLDoc)
objXMLDoc.save("C:\Test.xml")
set objXMLDoc =Nothing
End Function
'*******************************
'* makeDisc *
'*******************************
Sub makeDisc(objXMLDoc)
getElem= GetElement()
getNo= GetNode()
Set objNewNode = objXMLDoc.createElement(getElem)
Set objNewText = objXMLDoc.createTextNode(getNo)
objNewNode.appendChild(objNewText)
Set objCurrNode = objXMLDoc.documentElement
objCurrNode.appendChild(objNewNode)
Set objCurrNode = objCurrNode.lastChild
End Sub 'makeDisc subroutine
'******************************
'* makeFiles *
'******************************
Sub makeFiles(objXMLDoc)
Set Root = objXMLDoc.documentElement
Set NodeList = Root.getElementsByTagName("disc")
For Each Elem In NodeList
Set objNewNode = objXMLDoc.createElement("title")
Set objNewText = objXMLDoc.createTextNode("AVI 2")
objNewNode.appendChild(objNewText)
Set objCurrNode = objXMLDoc.documentElement
objCurrNode.appendChild(objNewNode)
Set objCurrNode = objCurrNode.lastChild
objNewNode.appendChild(objNewText)
Next
End Sub 'makeDisc subroutine
Function GetElement()
message = "Enter Project Id"
title = "Input Project id value"
var = InputBox(message, title)
Msgbox var
GetElement =var
End Function
Function GetNode()
message = "Enter Project Id"
title = "Input Project id value"
var = InputBox(message, title)
Msgbox var
GetNode =var
End Function
Call XmlController
إرسال تعليق