BizTalk Utilities CV ,   Jobs ,   Code library  
 
 

Microsoft DOM Objects Reference

Download ReferenceDownload this Reference 

Previous PageTable Of ContentsIndexNext Page

save()

Is a member of:

XMLDOMDocument

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.

Previous PageTable Of ContentsIndexNext Page

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!

 

Recent Jobs

A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En
A Greate Opportunituy as a SQL Deve
An immediate job opportunity as a B

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



Information Online

swimming pool contractor
chicago web site design
desktop fax online
Domain Names
unlimited conferencing
Dolce&gabbana sunglasses
answering service


    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