ICatalogManager3::ExportXML Method [C++]

Use this method to export catalog data to an Extensible Markup Language (XML) file.

Definition

[C++]

HRESULT ICatalogManager3::ExportXML(VARIANTvrXML,
  VARIANTstrCatalogsToExport,
  VARIANT_BOOLfRunSynchronously,
  CatalogXMLFmtEnumeXMLFmtBSTRstrLang,
);

[Visual Basic]

Sub ExportXML(vrXML As Variant,
  Optional strCatalogsToExport As Variant,
  Optional fRunSynchronously As Boolean,
  Optional eXMLFmt As CatalogXMLFmtEnumOptional strLang As String,
)

Parameters

  • vrXML[C++]
    [in] A VARIANT that contains the XML file name or IStream object that is the target of the export.
  • vrXML[Visual Basic]
    A Variant that contains the XML file name or IStream object that is the target of the export.
  • strCatalogsToExport[C++]
    [in, optional] A VARIANT that contains the catalogs to export. See the Remarks section for more information.
  • strCatalogsToExport[Visual Basic]
    A Variant that contains the catalogs to export. See the Remarks section for more information.
  • fRunSynchronously [C++]
    [in, defaultvalue (0)] A VARIANT_BOOL that specifies whether the method should be run synchronously. A value of True indicates that the method will not return until the export is completed. A value of False indicates that the method will return immediately after spawning the export thread.
  • fRunSynchronously [Visual Basic]
    A Boolean that specifies whether the method should be run synchronously. A value of True indicates that the method will not return until the export is completed. A value of False indicates that the method will return immediately after spawning the export thread. The default value is False.
  • eXMLFmt[C++]
    [in, optional, defaultvalue (0)] A CatalogXMLFmtEnum enumeration that specifies the XML format. See the Remarks section for valid values.
  • eXMLFmt[Visual Basic]
    A CatalogXMLFmtEnum enumeration that specifies the XML format. See the Remarks section for valid values.
  • strLang[C++]
    [in, optional, defaultvalue ("")] A BSTR that contains the culture name. that contains the culture name. The culture name follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>" where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. Some culture names have prefixes that specify the script; for example, "Cy" specifies the Cyrillic script, and "Lt" specifies the Latin script. For more information, see . Table of Language Culture Names, Culture Codes, and ISO Values.
  • strLang[Visual Basic]
    A String that contains the culture name. The default value is (""). The culture name follows the RFC 1766 standard in the format "<languagecode2>-<country/regioncode2>" where <languagecode2> is a lowercase two-letter code derived from ISO 639-1 and <country/regioncode2> is an uppercase two-letter code derived from ISO 3166. Some culture names have prefixes that specify the script; for example, "Cy" specifies the Cyrillic script, and "Lt" specifies the Latin script. For more information, see . Table of Language Culture Names, Culture Codes, and ISO Values.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully.

[Visual Basic] None.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_IMPORT_IN_PROGRESS

[C++] 0x88980025

[Visual Basic] &H88980025

There was an existing import method call that had not yet completed. This method cannot run while an import is in progress.
E_CAT_FILE_CREATION_FAILED

[C++] 0x88980018

[Visual Basic] &H88980018

The method was unable to create the output file.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

If the strCatalogsToExport parameter is missing or contains an empty string, then all catalogs are exported. Otherwise the parameter strCatalogsToExport is a comma-separated list of catalog names to be exported. If you specify a virtual catalog in the strCatalogsToExport parameter, a snapshot of the virtual catalog will be exported as a base catalog.

If the strLang parameter is not specified then the default system language of the Web server will be used for multilingual properties.

The following table shows the values in the CatalogXMLFmtEnum enumeration, their associated names, and describes their use.

Name Value Description
cscFmtElementCentric 0 Export in Commerce Server 2000 format. (Default)
cscFmtAttributeCentric 1 Export in Commerce Server 2002 format.
cscFmtXDR 2 Export the Commerce Server 2002 schema as XDR. (No data)

This method runs in a separate thread. Prior to spawning the thread, it checks that there is not an existing ImportCSV or ImportXML method in progress. After the new thread is spawned, this method returns immediately, if the parameter fRunSynchronously is False, with no errors. Any errors that occurred while importing the catalog are logged to the Windows NT Event Log. Use the Windows Event Viewer to view the Windows NT Event Log.

If there is a temporary loss of the SQL Server connection, longer than two minutes, an import or export will be aborted. Other methods should work after the interruption.

Some characters are not valid in an XML attribute name. When a catalog is exported in the attribute-centric mode these characters are encoded in the form _xHHHH_ where HHHH is the hex value of the character. The following characters are encoded:

  • Back slash (\)
  • Forward slash (/)
  • Ampersand (&)
  • Left angle bracket (<)
  • Right angle bracket (>)
  • All characters in the range 0xF900 to 0xFFFE

Ee798297.caution(en-US,CS.20).gifCaution

  • If you call this method from Visual Basic Scripting Edition (VBScript) with the fRunSynchronously parameter set to False, VBScript will unload the object as soon as the script ends. If the script ends before the spawned thread finishes exporting the catalog it will be terminated prematurely and the catalog will not be exported successfully.
  • Changes made to the catalog while an export is in progress may or may not be reflected in the output file. Additions and deletions made during the export could result in a corrupt file. Changes should be avoided during an export.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

myCatalogManager.ExportXML "c:\exports\ourcatalog.xml", "OurStore"

See Also

[C++]CatalogManager Object

[Visual Basic]CatalogManager Object

[C++]ICatalogManager3::ExportCSV

[Visual Basic]CatalogManager.ExportCSV

[C++]ICatalogManager3::ImportXML

[Visual Basic]CatalogManager.ImportXML

[C++]Table of Language Culture Names, Codes, and ISO Values

[Visual Basic]Table of Language Culture Names, Codes, and ISO Values

Copyright © 2005 Microsoft Corporation.
All rights reserved.