CatalogManager3.ImportXML Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Sub ImportXML(vrXML As Object,
  Optional fUpdateOnly As BooleanOptional fRunSynchronously As Boolean,
  Optional fGenerateFullTextIndexes As Boolean)

[C#]

using Microsoft.CommerceServer.Interop.Catalog;
…
public void ImportXML(objectvrXML,
  boolfUpdateOnlyboolfRunSynchronously,
  bool fGenerateFullTextIndexes);

Parameters

[Visual Basic .NET]

  • vrXML
    An Object that contains the XML file name or IStream object that is the target of the import.
  • fUpdateOnly
    A Boolean that specifies whether to update an existing catalog or create a new one. A value of True indicates that if the system contains a catalog whose name is the same as the one specified in the strCatalogName parameter, it will be updated with the imported data. A value of False indicates to delete the catalog if it already exists and create a new one with the imported data. The default is False.
  • fRunSynchronously
    A Boolean that specifies whether the method should be run synchronously. A value of True indicates that the method will not return until the import is completed. A value of False indicates that the method will return immediately after spawning the import thread. The default is False.
  • fGenerateFullTextIndexes
    A Boolean that specifies whether the method should generate full text indexes. A value of True indicates that indexes should be generated. A value of False indicates that indexes should not be generated. The default is True.

[C#]

  • vrXML
    An object that contains the XML file name or IStream object that is the target of the import.
  • fUpdateOnly
    A bool that specifies whether to update an existing catalog or create a new one. A value of True indicates that if the system contains a catalog whose name is the same as the one specified in the strCatalogName parameter, it will be updated with the imported data. A value of False indicates to delete the catalog if it already exists and create a new one with the imported data.
  • fRunSynchronously
    A bool that specifies whether the method should be run synchronously. A value of True indicates that the method will not return until the import is completed. A value of False indicates that the method will return immediately after spawning the import thread.
  • fGenerateFullTextIndexes
    A bool that specifies whether the method should generate full text indexes. A value of True indicates that indexes should be generated. A value of False indicates that indexes should not be generated. The default is True.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The following table shows the custom COM errors that a COMException can wrap.

Name Value Description
E_CAT_CATMGR_NOT_INITIALIZED

[C#] 0x889800B

[Visual Basic .NET] &H8898005

The CatalogManager object has not been initialized. The CatalogManager object should be initialized before calling this method.
E_CAT_FILE_OPEN_ERROR

[C#] 0x8898002

[Visual Basic .NET] &H8898000

Unable to open the file. Check that the file exists and you have the necessary permissions on the file.
E_CAT_IMPORT_IN_PROGRESS

[C#] 0x8898002

[Visual Basic .NET] &H8898005

This operation cannot be started because an import operation is currently in progress.
E_CAT_MSXML3_MISSING

[C#] 0x889800C

[Visual Basic .NET] &H8898001

The Catalog import operation was unable to instantiate the XML parser. Please check that msxml3.dll is installed and registered on this machine. Refer to the Commerce Server installation documents for more information.
E_CAT_INVALID_XML error There has been an error. See the error message for more information.

Remarks

When performing a partial or delta import (when updating an existing catalog by importing new or changed catalog data), it is important that the schema of the data being imported matches the schema of the existing catalog. For more information about the catalog schema, see Import Semantic.

This method runs in a separate thread. Prior to spawning the thread, it checks that the specified file can be opened and that there is not an existing ExportCSV, ExportXML, ImportCSV, or ImportXML method in progress. Once the new thread is spawned, this method returns immediately, if 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.

This method cannot be called in a transacted object. This method involves the creation, deletion, or updating of free text indexes. SQL Server does not allow these operations in a transaction.

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.

The names of catalogs in the source file cannot begin with "#" or consist solely of spaces.

If a property existing in the catalog has one type and the property of the same name existing in the import file has a different type, the import will fail. For example, the following will cause an error: the catalog has a SKU property that is a string, and the XML file being imported has a SKU property that is an integer.

[Visual Basic .NET]

Example

myCatalogManager.ImportXML("c:\imports\ourcatalog.xml", True)

Requirements

Namespace: Microsoft.CommerceServer.Interop.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: cataloglib (in cataloglib.dll)

See Also

CatalogManager3 Class

CatalogManager3.ExportXML

CatalogManager3.ImportCSV

Copyright © 2005 Microsoft Corporation.
All rights reserved.