'1. ArcCatalogの検索で指定のフォルダからメタデータを設定したい対象のフィーチャクラスを絞り込み検索 '2. 検索結果をカタログ ツリーで選択し、マクロを実行 Private Const XMLFile As String = "D:\metadata.xml" 'インポートするメタデータのフルパス Public Sub CopyMetadataFromXML() Dim pGxApp As IGxApplication Dim pGxSel As IGxSelection Dim pGxObjectCont As IGxObjectContainer Dim pEnumGxObj As IEnumGxObject Dim pGxObj As IGxObject Dim pGxObj1 As IGxObject Dim pMD As IMetadata Dim m_pImportXml As ImportXML Dim pImport As IMetadataImport Set pGxApp = Application Set pGxObj = pGxApp.SelectedObject If Not TypeOf pGxObj Is ISearchResults Then MsgBox "Please select a 検索結果", vbExclamation Exit Sub Else Set pGxObjectCont = pGxObj 'Check to see if there are children Set pEnumGxObj = pGxObjectCont.Children If pEnumGxObj Is Nothing Then MsgBox "Nothing was found in the " & pGxObj.FullName & " Folder" Exit Sub Else 'For each object that is in the Folder, import the XML document as metadata Set pGxObj1 = pEnumGxObj.Next Dim intCount As Integer Do While Not pGxObj1 Is Nothing Dim strName As String strName = pGxObj1.Name Set pMD = pGxObj1 Set m_pImportXml = New ImportXML Set pImport = m_pImportXml 'Import a local xml document to metadata pImport.Import XMLFile, pMD Set pGxObj1 = pEnumGxObj.Next intCount = intCount + 1 Loop End If End If MsgBox "終了しました。" End Sub
XML の複製
2016/9/1 (木)