BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XML DOM
The DOM Method: reset()
The DOM Method: replaceChild()
The DOM Method: removeNamedItem()
The DOM Method: removeChild()
The DOM Method: removeAttributeNode()
The DOM Method: removeAttribute()
The DOM Method: nodeFromID()
The DOM Method: nextNode()
The DOM Method: loadXML()
The DOM Method: load()
The DOM Method: insertBefore()
The DOM Method: hasChildNodes()
The DOM Method: getNamedItem()
The DOM Method: getElementsByTagName()
The DOM Method: getAttributeNode()
The DOM Method: getAttribute()
The DOM Method: createNode()
The DOM Method: Create - other examples
The DOM Method: cloneNode()
The DOM Method: appendChild()
<< XHTML
XmlSerializer >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :2518

 

save()

Is a member of:

XML DOM Document

Syntax

objDOMDocument.save(objTarget)

Remark

The parameter objTarget can be a file name, an ASP response object, an XML document object, or a custom object that supports persistence and specific interfaces.

If you have manipulated the DOMDocument in any way by appending, removing, or whatever, remember that it is not saved to the XML file until you have called the save() method.

The save() method does not return anything; however, if an error is reported, the error can expose one of the return values listed in table  .

0.0.1 save() method return values (continued)

Returned
Description
S_OK
Success
XML_BAD_ENCODING
The document contains a character that does not belong in the specified encoding
E_INVALIDARG
A string was provided but it is not a valid file name. or an object was provided that does not support any of the above interfaces
E_ACCESSDENIED
save() operation is not permitted
E_OUTOFMEMORY
save() cannot allocate buffers
Other values
Any other file system error

Saving in ADO 2.5

You may have noticed in previous examples that we tend to save our XML to a file and then load the file into a DOMDocument. In Microsoft ADO 2.5 that ships with Windows 2000, you will be able to save directly to a DOMDocument.

This is how you will be able to do it:

Dim strSQL As String

Dim adoCon As ADODB.Connection

Dim adoRst As ADODB.Recordset

Dim objDOMDocument As DOMDocument

strSQL = "SELECT * FROM categories"

Set adoCon = New ADODB.Connection

Set adoRst = New ADODB.Recordset

adoCon.ConnectionString = "northwind"

adoCon.CursorLocation = adUseClient

adoCon.Open

Set adoRst.ActiveConnection = adoCon

adoRst.Open strSQL, , adOpenForwardOnly, _

adLockReadOnly, adCmdText

Set objDOMDocument = New DOMDocument

objDOMDocument.async = False

adoRst.Save objDOMDocument, 1 ' save this to DOM

adoRst.Close

adoCon.Close

Set adoCon = Nothing

¬ Prepare ADO objects.

¬ Open database connection.

¬ Get resultset.

¬ Prepare the DOMDocument.

¬ Save the recordset to the DOMDocument.


This manuscript is an abridged version of a chapter from the Manning Publications book XML Programming with VB and ASP. This chapter looks at the Microsoft DOM objects. NOTE: Most images have been removed to increase speed and many of the code comments have also been removed for presentation. Please purchase the book to enjoy the full experience of all the chapters with images and code comments!


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Integration Specialist Needed - Wor
Virtualization Server Infrastructur
A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En

View all Jobs (Add yours)
View all CV (Add yours)




Chicago Web Site Design
conference call for CA
it outsourcing
Emporio armani sunglasses
air freshener
odor remover


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP