|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XML sampleHi guys,
can me give a example how to do this in VB 6 using XMLDocument ? <WebSync> <Download> <Table LastSuccessfulProcessedDate="25/05/2005" LastProcessedOn="25/05/2005" PK="cCompanyNo,cItemCode" TableName="Alternative"/> </Download> </WebSync> Appreciate your help... -Aruna > can me give a example how to do this in VB 6 using XMLDocument ? What do you mean by "do this", parse an XML file looking like the example posted, create an XML file like the one you> > <WebSync> > <Download> > <Table LastSuccessfulProcessedDate="25/05/2005" > LastProcessedOn="25/05/2005" PK="cCompanyNo,cItemCode" > TableName="Alternative"/> > </Download> > </WebSync> posted? Assuming for the time being the latter then add a reference to MSXML to your project [Project -> Preferences -> Microsoft XML #.#] where #.# is at least 3.0. First off you need a document object: '*** Dim MyDOM As DOMDocument Set MyDOM = New DOMDocument ' Rest of code goes here.. Set MyDOM = Nothing '*** Next up you need to create a node: '*** Dim NewNode As IXMLDOMElement .... Set NewNode = MyDOM.createElement("WebSync") '*** Now we could append attributes to this node: '*** Call NewNode.setAttribute("LastSuccessfulProcessedDate", _ Format$(Now(), "Short date")) '*** Finally you need to add this node to the document (you can append nodes to other nodes in exactly the same way) and write the file: '*** Call MyDOM.appendChild(NewNode) Call MyDOM.save("x:\Path\File.xml") '*** Have a look at this old post and the links from it for more information: http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/c8f73ad9971fd89 Hope this helps, Mike - Microsoft Visual Basic MVP - E-Mail: ED***@mvps.org WWW: Http://EDais.mvps.org/ |
|||||||||||||||||||||||