BizTalk Utilities CV ,   Jobs ,   Code library
 
Home Page


Add/Edit your code items
Search the code library
Browse for the code library


XML DOM
XML DOM: Inserting, Modifying and Deleting elements using VBScript
XML DOM: Adding an Child Element and an attribute using VBScript
Combining XML Documents using XSLT - a collection of 5 approaches
How to use InsertAfter() with XmlDocument?
How to remove xml elements using RemoveChild() with XmlDocument?
How to select specific nodes in XmlDocument() when having a namespace ?
How to Load a XML From a String with XmlDocument?
How to remove an attribute with XmlDocument and RemoveAll?
How to create a navigator with XmlDocument and CreateNavigator?
Whats the 'push model'?
Hybrid Model Part Two: Choosing between SAX and DOM


 
 

<< XHTMLXmlSerializer >>


By John Workman
First Posted 05/06/2003
Times viewed 2673

CSV to XML using the DOM


This post contains attachments
v20030506123458.zip 

Summary I've seen too many programs where developers use string commands to build XML files. Attached are Visual Basic and JScript examples of how to read a comma delimited file and build an XML file using DOM commands.

Building an XML file is quite easy, but for some reason developers always try to do it the hard way. By using the DOM, you don't have to worry about nesting your code to keep track of open tags. Below are very clear examples in both VB and JScript that demonstrate how this is done. One thing that this example does not show is how to add an element with Text. That is done with: var objXMLDOMElement = objDOMDocument.createElement("Name"); objXMLDOMElement.text = Employee.name; or Set objXMLDOMElement = objDOMDocument.createElement("Name") objXMLDOMElement.Text = eEmp.sName

Additional information

Further additional information


Rate this article on a scale of 1 to 10 (3 votes, average 6)

Your vote :  

<< XHTMLXmlSerializer >>





Leave a comment for this article
Your name
Your email (optional)
Your comment
Optional: Upload an attachment
Enter the code shown:

 
 

    Email TopXML