Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1393 lines
48 KiB

  1. Attribute VB_Name = "Main"
  2. Option Explicit
  3. Private Const FIRST_C As Long = 0
  4. Private Const SECOND_C As Long = 1
  5. Private Const SEP_C As String = "<SEPARATOR>"
  6. Private Const TAXONOMY_HHT_C As String = "Taxonomy.hht"
  7. Private Const STOP_SIGNS_HHT_C As String = "StopSigns.hht"
  8. Private Const STOP_WORDS_HHT_C As String = "StopWords.hht"
  9. Private Const SYN_TABLE_HHT_C As String = "SynTable.hht"
  10. Private Const SCOPE_DEFINITION_HHT_C As String = "ScopeDefinition.hht"
  11. Private Const NO_LOC_HHT_C As String = "NoLoc.hht"
  12. Private Const OPERATORS_HHT_C As String = "OperatorEntries.hht"
  13. Private Const ELEM_METADATA_C As String = "METADATA"
  14. Private Const ELEM_STOPWORD_ENTRIES_C As String = "STOPWORD_ENTRIES"
  15. Private Const ELEM_STOPWORD_C As String = "STOPWORD"
  16. Private Const ELEM_SCOPE_DEFINITION_C As String = "SCOPE_DEFINITION"
  17. Private Const ELEM_SCOPE_C As String = "SCOPE"
  18. Private Const ELEM_OPERATOR_ENTRIES_C As String = "OPERATOR_ENTRIES"
  19. Private Const ELEM_OPERATOR_C As String = "OPERATOR"
  20. Private Const ELEM_STOPSIGN_ENTRIES_C As String = "STOPSIGN_ENTRIES"
  21. Private Const ELEM_STOPSIGN_C As String = "STOPSIGN"
  22. Private Const ELEM_FTS_C As String = "FTS"
  23. Private Const ELEM_INDEX_C As String = "INDEX"
  24. Private Const ELEM_HELPIMAGE_C As String = "HELPIMAGE"
  25. Private Const ELEM_HELPFILE_C As String = "HELPFILE"
  26. Private Const ELEM_SYNTABLE_C As String = "SYNTABLE"
  27. Private Const ELEM_SYNSET_C As String = "SYNSET"
  28. Private Const ELEM_SYNONYM_C As String = "SYNONYM"
  29. Private Const ELEM_KEYWORD_C As String = "KEYWORD"
  30. Private Const ELEM_TAXONOMY_ENTRIES_C As String = "TAXONOMY_ENTRIES"
  31. Private Const ELEM_TAXONOMY_ENTRY_C As String = "TAXONOMY_ENTRY"
  32. Private Const ELEM_HHT_C As String = "HHT"
  33. Private Const ATTR_STOPWORD_C As String = "STOPWORD"
  34. Private Const ATTR_ACTION_C As String = "ACTION"
  35. Private Const ATTR_ID_C As String = "ID"
  36. Private Const ATTR_DISPLAYNAME_C As String = "DISPLAYNAME"
  37. Private Const ATTR_OPERATION_C As String = "OPERATION"
  38. Private Const ATTR_OPERATOR_C As String = "OPERATOR"
  39. Private Const ATTR_CONTEXT_C As String = "CONTEXT"
  40. Private Const ATTR_STOPSIGN_C As String = "STOPSIGN"
  41. Private Const ATTR_CHM_C As String = "CHM"
  42. Private Const ATTR_CHQ_C As String = "CHQ"
  43. Private Const ATTR_HHK_C As String = "HHK"
  44. Private Const ATTR_SCOPE_C As String = "SCOPE"
  45. Private Const ATTR_CATEGORY_C As String = "CATEGORY"
  46. Private Const ATTR_ENTRY_C As String = "ENTRY"
  47. Private Const ATTR_URI_C As String = "URI"
  48. Private Const ATTR_ICONURI_C As String = "ICONURI"
  49. Private Const ATTR_TITLE_C As String = "TITLE"
  50. Private Const ATTR_DESCRIPTION_C As String = "DESCRIPTION"
  51. Private Const ATTR_TYPE_C As String = "TYPE"
  52. Private Const ATTR_VISIBLE_C As String = "VISIBLE"
  53. Private Const ATTR_SUBSITE_C As String = "SUBSITE"
  54. Private Const ATTR_NAVIGATIONMODEL_C As String = "NAVIGATIONMODEL"
  55. Private Const ATTR_PRIORITY_C As String = "PRIORITY"
  56. Private Const ATTR_VALUE_C As String = "VALUE"
  57. Private Const ATTR_FILE_C As String = "FILE"
  58. Private Const VALUE_ADD_C As String = "ADD"
  59. Private Const VALUE_DEL_C As String = "DEL"
  60. Private Const VALUE_AND_C As String = "AND"
  61. Private Const VALUE_OR_C As String = "OR"
  62. Private Const VALUE_NOT_C As String = "NOT"
  63. Private Const VALUE_ANYWHERE_C As String = "ANYWHERE"
  64. Private Const VALUE_ENDOFWORD_C As String = "ENDOFWORD"
  65. Private p_dictStopWords(1) As Scripting.Dictionary
  66. Private p_dictHelpImage(1) As Scripting.Dictionary
  67. Private p_dictScopes(1) As Scripting.Dictionary
  68. Private p_dictFTS(1) As Scripting.Dictionary
  69. Private p_dictOperators(1) As Scripting.Dictionary
  70. Private p_dictStopSigns(1) As Scripting.Dictionary
  71. Private p_dictIndex(1) As Scripting.Dictionary
  72. Private p_dictSynTable(1) As Scripting.Dictionary
  73. Private p_dictTaxonomy(1) As Scripting.Dictionary
  74. Private p_strVersion As String
  75. Private p_blnIgnoreKeywords As Boolean
  76. Public Sub MainFunction( _
  77. ByVal i_strCab1 As String, _
  78. ByVal i_strCab2 As String, _
  79. ByVal i_strCabOut As String, _
  80. ByVal i_strVersion As String, _
  81. ByVal i_blnIgnoreKeywords As Boolean _
  82. )
  83. On Error GoTo LError
  84. Dim strFolder1 As String
  85. Dim strFolder2 As String
  86. Dim strFolderOut As String
  87. Dim intErrorNumber As Long
  88. Dim FSO As Scripting.FileSystemObject
  89. Dim Folder As Scripting.Folder
  90. Dim File As Scripting.File
  91. p_strVersion = i_strVersion
  92. p_blnIgnoreKeywords = i_blnIgnoreKeywords
  93. strFolder1 = Cab2Folder(i_strCab1)
  94. strFolder2 = Cab2Folder(i_strCab2)
  95. Set FSO = New Scripting.FileSystemObject
  96. strFolderOut = Environ$("TEMP") & "\__HSCCAB"
  97. If (FSO.FolderExists(strFolderOut)) Then
  98. FSO.DeleteFolder strFolderOut, Force:=True
  99. End If
  100. FSO.CreateFolder strFolderOut
  101. p_GatherData FIRST_C, strFolder1
  102. p_GatherData SECOND_C, strFolder2
  103. p_CreateDeltaHHTs strFolderOut
  104. Set Folder = FSO.GetFolder(strFolder1)
  105. For Each File In Folder.Files
  106. File.Copy strFolderOut & "\" & File.Name
  107. Next
  108. p_FixPackageDescription strFolderOut
  109. Folder2Cab strFolderOut, i_strCabOut
  110. LEnd:
  111. DeleteCabFolder strFolder1
  112. DeleteCabFolder strFolder2
  113. DeleteCabFolder strFolderOut
  114. Exit Sub
  115. LError:
  116. frmMain.Output Err.Description, LOGGING_TYPE_ERROR_E
  117. intErrorNumber = Err.Number
  118. DeleteCabFolder strFolder1
  119. DeleteCabFolder strFolder2
  120. DeleteCabFolder strFolderOut
  121. Err.Raise intErrorNumber
  122. End Sub
  123. Private Sub p_GatherData( _
  124. ByVal i_intIndex As Long, _
  125. ByVal i_strFolder As String _
  126. )
  127. Dim DOMDocPkgDesc As MSXML2.DOMDocument
  128. Dim intNumHHTs As Long
  129. Dim intIndex As Long
  130. Dim strFile As String
  131. Set p_dictStopWords(i_intIndex) = New Scripting.Dictionary
  132. p_dictStopWords(i_intIndex).CompareMode = TextCompare
  133. Set p_dictHelpImage(i_intIndex) = New Scripting.Dictionary
  134. p_dictHelpImage(i_intIndex).CompareMode = TextCompare
  135. Set p_dictScopes(i_intIndex) = New Scripting.Dictionary
  136. p_dictScopes(i_intIndex).CompareMode = TextCompare
  137. Set p_dictFTS(i_intIndex) = New Scripting.Dictionary
  138. p_dictFTS(i_intIndex).CompareMode = TextCompare
  139. Set p_dictOperators(i_intIndex) = New Scripting.Dictionary
  140. p_dictOperators(i_intIndex).CompareMode = TextCompare
  141. Set p_dictStopSigns(i_intIndex) = New Scripting.Dictionary
  142. p_dictStopSigns(i_intIndex).CompareMode = TextCompare
  143. Set p_dictIndex(i_intIndex) = New Scripting.Dictionary
  144. p_dictIndex(i_intIndex).CompareMode = TextCompare
  145. Set p_dictSynTable(i_intIndex) = New Scripting.Dictionary
  146. p_dictSynTable(i_intIndex).CompareMode = TextCompare
  147. Set p_dictTaxonomy(i_intIndex) = New Scripting.Dictionary
  148. p_dictTaxonomy(i_intIndex).CompareMode = TextCompare
  149. Set DOMDocPkgDesc = GetPackageDescription(i_strFolder)
  150. intNumHHTs = GetNumberOfHHTsListedInPackageDescription(DOMDocPkgDesc)
  151. For intIndex = 1 To intNumHHTs
  152. strFile = GetNthHHTListedInPackageDescription(DOMDocPkgDesc, intIndex)
  153. p_ReadFile i_intIndex, i_strFolder, strFile
  154. Next
  155. End Sub
  156. Private Sub p_ReadFile( _
  157. ByVal i_intIndex As Long, _
  158. ByVal i_strFolder As String, _
  159. ByVal i_strFile As String _
  160. )
  161. Dim strLocation As String
  162. Dim strPath As String
  163. Dim DOMDoc As MSXML2.DOMDocument
  164. If (i_intIndex = FIRST_C) Then
  165. strLocation = " in first CAB"
  166. Else
  167. strLocation = " in second CAB"
  168. End If
  169. frmMain.Output "Processing " & i_strFile & strLocation & "...", LOGGING_TYPE_NORMAL_E
  170. strPath = i_strFolder & "\" & i_strFile
  171. Set DOMDoc = GetFileAsDomDocument(strPath)
  172. p_ReadStopWords i_intIndex, DOMDoc
  173. p_ReadHelpImage i_intIndex, DOMDoc
  174. p_ReadScopes i_intIndex, DOMDoc
  175. p_ReadFTS i_intIndex, DOMDoc
  176. p_ReadOperators i_intIndex, DOMDoc
  177. p_ReadStopSigns i_intIndex, DOMDoc
  178. p_ReadIndex i_intIndex, DOMDoc
  179. p_ReadSynTable i_intIndex, DOMDoc
  180. p_ReadTaxonomy i_intIndex, DOMDoc
  181. End Sub
  182. Private Sub p_ReadStopWords( _
  183. ByVal i_intIndex As Long, _
  184. ByVal i_DOMDoc As MSXML2.DOMDocument _
  185. )
  186. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  187. Dim DOMNode As MSXML2.IXMLDOMNode
  188. Dim strStopWord As String
  189. Dim strAction As String
  190. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/STOPWORD_ENTRIES/STOPWORD")
  191. For Each DOMNode In DOMNodeList
  192. DoEvents
  193. strAction = p_GetAttribute(DOMNode, "ACTION")
  194. strStopWord = p_GetAttribute(DOMNode, "STOPWORD")
  195. p_CheckAction "StopWord " & strStopWord, strAction
  196. If (Not p_dictStopWords(i_intIndex).Exists(strStopWord)) Then
  197. p_dictStopWords(i_intIndex).Add strStopWord, True
  198. Else
  199. frmMain.Output _
  200. "StopWord " & strStopWord & " is defined twice.", LOGGING_TYPE_WARNING_E
  201. End If
  202. Next
  203. End Sub
  204. Private Sub p_ReadHelpImage( _
  205. ByVal i_intIndex As Long, _
  206. ByVal i_DOMDoc As MSXML2.DOMDocument _
  207. )
  208. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  209. Dim DOMNode As MSXML2.IXMLDOMNode
  210. Dim strChm As String
  211. Dim strAction As String
  212. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/HELPIMAGE/HELPFILE")
  213. For Each DOMNode In DOMNodeList
  214. DoEvents
  215. strAction = p_GetAttribute(DOMNode, "ACTION")
  216. strChm = p_GetAttribute(DOMNode, "CHM")
  217. p_CheckAction "HelpFile " & strChm, strAction
  218. If (Not p_dictHelpImage(i_intIndex).Exists(strChm)) Then
  219. p_dictHelpImage(i_intIndex).Add strChm, True
  220. Else
  221. frmMain.Output "HelpFile " & strChm & " is defined twice.", LOGGING_TYPE_WARNING_E
  222. End If
  223. Next
  224. End Sub
  225. Private Sub p_ReadScopes( _
  226. ByVal i_intIndex As Long, _
  227. ByVal i_DOMDoc As MSXML2.DOMDocument _
  228. )
  229. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  230. Dim DOMNode As MSXML2.IXMLDOMNode
  231. Dim strId As String
  232. Dim strAction As String
  233. Dim strDisplayName As String
  234. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/SCOPE_DEFINITION/SCOPE")
  235. For Each DOMNode In DOMNodeList
  236. DoEvents
  237. strAction = p_GetAttribute(DOMNode, "ACTION")
  238. strId = p_GetAttribute(DOMNode, "ID")
  239. strDisplayName = p_GetAttribute(DOMNode, "DISPLAYNAME")
  240. p_CheckAction "Scope " & strId, strAction
  241. If (Not p_dictScopes(i_intIndex).Exists(strId)) Then
  242. p_dictScopes(i_intIndex).Add strId, strDisplayName
  243. Else
  244. p_dictScopes(i_intIndex).Remove strId
  245. p_dictScopes(i_intIndex).Add strId, strDisplayName
  246. frmMain.Output _
  247. "Scope " & strId & " is defined twice; previous definition will be ignored.", LOGGING_TYPE_WARNING_E
  248. End If
  249. Next
  250. End Sub
  251. Private Sub p_ReadFTS( _
  252. ByVal i_intIndex As Long, _
  253. ByVal i_DOMDoc As MSXML2.DOMDocument _
  254. )
  255. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  256. Dim DOMNode As MSXML2.IXMLDOMNode
  257. Dim strAction As String
  258. Dim strChm As String
  259. Dim strChq As String
  260. Dim strKey As String
  261. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/FTS/HELPFILE")
  262. For Each DOMNode In DOMNodeList
  263. DoEvents
  264. strAction = p_GetAttribute(DOMNode, "ACTION")
  265. strChm = p_GetAttribute(DOMNode, "CHM")
  266. strChq = p_GetAttribute(DOMNode, "CHQ", False)
  267. strKey = strChm & SEP_C & strChq
  268. p_CheckAction "FTS file " & strKey, strAction
  269. If (Not p_dictFTS(i_intIndex).Exists(strKey)) Then
  270. p_dictFTS(i_intIndex).Add strKey, True
  271. Else
  272. frmMain.Output "FTS file " & strKey & " is defined twice.", LOGGING_TYPE_WARNING_E
  273. End If
  274. Next
  275. End Sub
  276. Private Sub p_ReadOperators( _
  277. ByVal i_intIndex As Long, _
  278. ByVal i_DOMDoc As MSXML2.DOMDocument _
  279. )
  280. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  281. Dim DOMNode As MSXML2.IXMLDOMNode
  282. Dim strOperator As String
  283. Dim strAction As String
  284. Dim strOperation As String
  285. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/OPERATOR_ENTRIES/OPERATOR")
  286. For Each DOMNode In DOMNodeList
  287. DoEvents
  288. strAction = p_GetAttribute(DOMNode, "ACTION")
  289. strOperation = p_GetAttribute(DOMNode, "OPERATION")
  290. strOperator = p_GetAttribute(DOMNode, "OPERATOR")
  291. p_CheckAction "Operator " & strOperator, strAction
  292. p_CheckOperation "Operator " & strOperator, strOperation
  293. If (Not p_dictOperators(i_intIndex).Exists(strOperator)) Then
  294. p_dictOperators(i_intIndex).Add strOperator, strOperation
  295. Else
  296. Err.Raise E_FAIL, , "Operator " & strOperator & " is defined twice."
  297. End If
  298. Next
  299. End Sub
  300. Private Sub p_ReadStopSigns( _
  301. ByVal i_intIndex As Long, _
  302. ByVal i_DOMDoc As MSXML2.DOMDocument _
  303. )
  304. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  305. Dim DOMNode As MSXML2.IXMLDOMNode
  306. Dim strStopSign As String
  307. Dim strAction As String
  308. Dim strContext As String
  309. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/STOPSIGN_ENTRIES/STOPSIGN")
  310. For Each DOMNode In DOMNodeList
  311. DoEvents
  312. strAction = p_GetAttribute(DOMNode, "ACTION")
  313. strContext = p_GetAttribute(DOMNode, "CONTEXT")
  314. strStopSign = p_GetAttribute(DOMNode, "STOPSIGN")
  315. p_CheckAction "StopSign " & strStopSign, strAction
  316. p_CheckContext "StopSign " & strStopSign, strContext
  317. If (Not p_dictStopSigns(i_intIndex).Exists(strStopSign)) Then
  318. p_dictStopSigns(i_intIndex).Add strStopSign, strContext
  319. Else
  320. Err.Raise E_FAIL, , "StopSign " & strStopSign & " is defined twice."
  321. End If
  322. Next
  323. End Sub
  324. Private Sub p_ReadIndex( _
  325. ByVal i_intIndex As Long, _
  326. ByVal i_DOMDoc As MSXML2.DOMDocument _
  327. )
  328. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  329. Dim DOMNode As MSXML2.IXMLDOMNode
  330. Dim strAction As String
  331. Dim strChm As String
  332. Dim strHhk As String
  333. Dim strScope As String
  334. Dim strKey As String
  335. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/INDEX/HELPFILE")
  336. For Each DOMNode In DOMNodeList
  337. DoEvents
  338. strAction = p_GetAttribute(DOMNode, "ACTION")
  339. strChm = p_GetAttribute(DOMNode, "CHM")
  340. strHhk = p_GetAttribute(DOMNode, "HHK")
  341. strScope = p_GetAttribute(DOMNode, "SCOPE", False)
  342. strKey = strChm & SEP_C & strHhk
  343. p_CheckAction "Index " & strKey, strAction
  344. If (Not p_dictIndex(i_intIndex).Exists(strKey)) Then
  345. p_dictIndex(i_intIndex).Add strKey, strScope
  346. Else
  347. Err.Raise E_FAIL, , "Index " & strChm & "/" & strHhk & " is defined twice."
  348. End If
  349. Next
  350. End Sub
  351. Private Sub p_ReadSynTable( _
  352. ByVal i_intIndex As Long, _
  353. ByVal i_DOMDoc As MSXML2.DOMDocument _
  354. )
  355. Dim DOMNodeSynSetList As MSXML2.IXMLDOMNodeList
  356. Dim DOMNodeSynonymList As MSXML2.IXMLDOMNodeList
  357. Dim DOMNodeSynSet As MSXML2.IXMLDOMNode
  358. Dim DOMNodeSynonym As MSXML2.IXMLDOMNode
  359. Dim dict As Scripting.Dictionary
  360. Dim strId As String
  361. Dim strSynonym As String
  362. Dim strAction As String
  363. Set DOMNodeSynSetList = i_DOMDoc.selectNodes("METADATA/SYNTABLE/SYNSET")
  364. For Each DOMNodeSynSet In DOMNodeSynSetList
  365. DoEvents
  366. strId = p_GetAttribute(DOMNodeSynSet, "ID")
  367. If (p_dictSynTable(i_intIndex).Exists(strId)) Then
  368. Set dict = p_dictSynTable(i_intIndex)(strId)
  369. Else
  370. Set dict = New Scripting.Dictionary
  371. dict.CompareMode = TextCompare
  372. p_dictSynTable(i_intIndex).Add strId, dict
  373. End If
  374. Set DOMNodeSynonymList = DOMNodeSynSet.selectNodes("SYNONYM")
  375. For Each DOMNodeSynonym In DOMNodeSynonymList
  376. DoEvents
  377. strSynonym = DOMNodeSynonym.Text
  378. strAction = p_GetAttribute(DOMNodeSynonym, "ACTION")
  379. p_CheckAction "SynSet " & strId & ": " & "Synonym " & strSynonym, strAction
  380. If (Not dict.Exists(strSynonym)) Then
  381. dict.Add strSynonym, True
  382. Else
  383. frmMain.Output "Synonym " & strSynonym & " is defined twice in SynSet " & strId & ".", _
  384. LOGGING_TYPE_WARNING_E
  385. End If
  386. Next
  387. Next
  388. End Sub
  389. Private Sub p_ReadTaxonomy( _
  390. ByVal i_intIndex As Long, _
  391. ByVal i_DOMDoc As MSXML2.DOMDocument _
  392. )
  393. Dim DOMNodeList As MSXML2.IXMLDOMNodeList
  394. Dim DOMNode As MSXML2.IXMLDOMNode
  395. Dim DOMNodeListKW As MSXML2.IXMLDOMNodeList
  396. Dim DOMNodeKW As MSXML2.IXMLDOMNode
  397. Dim strCategory As String
  398. Dim strEntry As String
  399. Dim strURI As String
  400. Dim strKey As String
  401. Dim strKeyword As String
  402. Dim strPriority As String
  403. Dim Taxonomy As Taxonomy
  404. Dim intIndex As Long
  405. Dim blnNode As Boolean
  406. Set DOMNodeList = i_DOMDoc.selectNodes("METADATA/TAXONOMY_ENTRIES/TAXONOMY_ENTRY")
  407. If (DOMNodeList.length <> 0) Then
  408. frmMain.ProgresBar_SetMax DOMNodeList.length
  409. End If
  410. For Each DOMNode In DOMNodeList
  411. intIndex = intIndex + 1
  412. frmMain.ProgresBar_SetValue intIndex
  413. DoEvents
  414. strCategory = p_GetAttribute(DOMNode, ATTR_CATEGORY_C)
  415. strEntry = p_GetAttribute(DOMNode, ATTR_ENTRY_C, False)
  416. strURI = p_GetAttribute(DOMNode, ATTR_URI_C, False)
  417. Set Taxonomy = New Taxonomy
  418. With Taxonomy
  419. If (strEntry <> "") Then
  420. blnNode = True
  421. strKey = strCategory & SEP_C & strEntry
  422. Else
  423. blnNode = False
  424. strKey = strCategory & SEP_C & strURI
  425. End If
  426. .strCategory = strCategory
  427. .strEntry = strEntry
  428. .strURI = strURI
  429. .strIconURI = p_GetAttribute(DOMNode, ATTR_ICONURI_C, False)
  430. .strTitle = p_GetAttribute(DOMNode, ATTR_TITLE_C, False)
  431. .strDescription = p_GetAttribute(DOMNode, ATTR_DESCRIPTION_C, False)
  432. .strType = p_GetAttribute(DOMNode, ATTR_TYPE_C, False)
  433. .strVisible = p_GetAttribute(DOMNode, ATTR_VISIBLE_C, False)
  434. .strSubSite = p_GetAttribute(DOMNode, ATTR_SUBSITE_C, False)
  435. .strNavigationModel = p_GetAttribute(DOMNode, ATTR_NAVIGATIONMODEL_C, False)
  436. If (Not blnNode) Then
  437. Set .dictKeywords = New Scripting.Dictionary
  438. Set DOMNodeListKW = DOMNode.selectNodes(ELEM_KEYWORD_C)
  439. For Each DOMNodeKW In DOMNodeListKW
  440. strKeyword = DOMNodeKW.Text
  441. strPriority = p_GetAttribute(DOMNodeKW, ATTR_PRIORITY_C, False)
  442. .dictKeywords.Add strKeyword, strPriority
  443. Next
  444. End If
  445. End With
  446. If (Not p_dictTaxonomy(i_intIndex).Exists(strKey)) Then
  447. p_dictTaxonomy(i_intIndex).Add strKey, Taxonomy
  448. Else
  449. frmMain.Output "Taxonomy entry """ & strKey & """ is defined twice", LOGGING_TYPE_WARNING_E
  450. End If
  451. Next
  452. frmMain.ProgresBar_SetValue 0
  453. End Sub
  454. Private Sub p_CheckAction( _
  455. ByVal i_strPrefix As String, _
  456. ByVal i_strAction As String _
  457. )
  458. If (UCase$(i_strAction) <> VALUE_ADD_C) Then
  459. Err.Raise E_FAIL, , i_strPrefix & ": ACTION " & i_strAction & " cannot be handled."
  460. End If
  461. End Sub
  462. Private Sub p_CheckOperation( _
  463. ByVal i_strPrefix As String, _
  464. ByVal i_strOperation As String _
  465. )
  466. Dim strOperation As String
  467. strOperation = UCase$(i_strOperation)
  468. If ((strOperation <> "AND") And (strOperation <> "OR") And (strOperation <> "NOT")) Then
  469. Err.Raise E_FAIL, , i_strPrefix & ": Bad OPERATION: " & i_strOperation
  470. End If
  471. End Sub
  472. Private Sub p_CheckContext( _
  473. ByVal i_strPrefix As String, _
  474. ByVal i_strContext As String _
  475. )
  476. Dim strContext As String
  477. strContext = UCase$(i_strContext)
  478. If ((strContext <> "ANYWHERE") And (strContext <> "ENDOFWORD")) Then
  479. Err.Raise E_FAIL, , i_strPrefix & ": Bad CONTEXT: " & i_strContext
  480. End If
  481. End Sub
  482. Private Function p_GetAttribute( _
  483. ByVal i_DOMNode As MSXML2.IXMLDOMNode, _
  484. ByVal i_strAttributeName As String, _
  485. Optional ByVal i_blnRequired As Boolean = True _
  486. ) As String
  487. Dim DOMAttribute As MSXML2.IXMLDOMAttribute
  488. Set DOMAttribute = i_DOMNode.Attributes.getNamedItem(i_strAttributeName)
  489. If (DOMAttribute Is Nothing) Then
  490. If (Not i_blnRequired) Then
  491. Exit Function
  492. Else
  493. Err.Raise E_FAIL, , "Attribute " & i_strAttributeName & " is missing in: " & i_DOMNode.xml
  494. End If
  495. End If
  496. ' p_GetAttribute = Replace$(DOMAttribute.Text, "\", "\\")
  497. p_GetAttribute = DOMAttribute.Text
  498. End Function
  499. Private Sub p_CreateDeltaHHTs( _
  500. ByVal i_strFolder As String _
  501. )
  502. p_CreateStopWordsDelta i_strFolder & "\" & p_strVersion & "_" & STOP_WORDS_HHT_C
  503. p_CreateHelpImageFTSIndexDelta i_strFolder & "\" & p_strVersion & "_" & NO_LOC_HHT_C
  504. p_CreateScopesDelta i_strFolder & "\" & p_strVersion & "_" & SCOPE_DEFINITION_HHT_C
  505. p_CreateOperatorsDelta i_strFolder & "\" & p_strVersion & "_" & OPERATORS_HHT_C
  506. p_CreateStopSignsDelta i_strFolder & "\" & p_strVersion & "_" & STOP_SIGNS_HHT_C
  507. p_CreateSynTableDelta i_strFolder & "\" & p_strVersion & "_" & SYN_TABLE_HHT_C
  508. p_CreateTaxonomyDelta i_strFolder & "\" & p_strVersion & "_" & TAXONOMY_HHT_C
  509. End Sub
  510. Private Function p_GetNewDomDoc( _
  511. ) As MSXML2.DOMDocument
  512. Dim DOMDoc As MSXML2.DOMDocument
  513. Dim PI As MSXML2.IXMLDOMProcessingInstruction
  514. Dim DOMComment As MSXML2.IXMLDOMComment
  515. Dim DOMElement As MSXML2.IXMLDOMElement
  516. Set DOMDoc = New MSXML2.DOMDocument
  517. DOMDoc.preserveWhiteSpace = True
  518. Set PI = DOMDoc.createProcessingInstruction("xml", "version='1.0' encoding='UTF-16'")
  519. DOMDoc.appendChild PI
  520. Set DOMComment = DOMDoc.createComment("Insert your comments here")
  521. DOMDoc.appendChild DOMComment
  522. Set DOMElement = DOMDoc.createElement(ELEM_METADATA_C)
  523. DOMDoc.appendChild DOMElement
  524. Set p_GetNewDomDoc = DOMDoc
  525. End Function
  526. Private Sub p_CreateStopWordsDelta( _
  527. ByVal i_strFile As String _
  528. )
  529. Dim DOMDoc As MSXML2.DOMDocument
  530. Dim DOMNode As MSXML2.IXMLDOMNode
  531. Dim DOMElement As MSXML2.IXMLDOMElement
  532. Dim strStopWord As Variant
  533. Set DOMDoc = p_GetNewDomDoc
  534. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  535. Set DOMElement = DOMDoc.createElement(ELEM_STOPWORD_ENTRIES_C)
  536. DOMNode.appendChild DOMElement
  537. Set DOMNode = DOMElement
  538. For Each strStopWord In p_dictStopWords(SECOND_C).Keys
  539. p_dictStopWords(SECOND_C).Remove strStopWord
  540. If (p_dictStopWords(FIRST_C).Exists(strStopWord)) Then
  541. ' StopWord exists in both CABs. Ignore.
  542. p_dictStopWords(FIRST_C).Remove strStopWord
  543. Else
  544. ' StopWord exists only in the new CAB. Add it in the Delta.
  545. Set DOMElement = DOMDoc.createElement(ELEM_STOPWORD_C)
  546. With DOMElement
  547. .setAttribute ATTR_STOPWORD_C, strStopWord
  548. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  549. End With
  550. DOMNode.appendChild DOMElement
  551. End If
  552. Next
  553. For Each strStopWord In p_dictStopWords(FIRST_C).Keys
  554. ' StopWord exists only in the old CAB. Remove it in the Delta.
  555. Set DOMElement = DOMDoc.createElement(ELEM_STOPWORD_C)
  556. With DOMElement
  557. .setAttribute ATTR_STOPWORD_C, strStopWord
  558. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  559. End With
  560. DOMNode.appendChild DOMElement
  561. Next
  562. DOMDoc.Save i_strFile
  563. End Sub
  564. Private Sub p_CreateScopesDelta( _
  565. ByVal i_strFile As String _
  566. )
  567. Dim DOMDoc As MSXML2.DOMDocument
  568. Dim DOMNode As MSXML2.IXMLDOMNode
  569. Dim DOMElement As MSXML2.IXMLDOMElement
  570. Dim strId As Variant
  571. Dim strName1 As String
  572. Dim strName2 As String
  573. Dim blnAdd As Boolean
  574. Set DOMDoc = p_GetNewDomDoc
  575. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  576. Set DOMElement = DOMDoc.createElement(ELEM_SCOPE_DEFINITION_C)
  577. DOMNode.appendChild DOMElement
  578. Set DOMNode = DOMElement
  579. For Each strId In p_dictScopes(SECOND_C).Keys
  580. strName2 = p_dictScopes(SECOND_C)(strId)
  581. p_dictScopes(SECOND_C).Remove strId
  582. If (p_dictScopes(FIRST_C).Exists(strId)) Then
  583. strName1 = p_dictScopes(FIRST_C)(strId)
  584. p_dictScopes(FIRST_C).Remove strId
  585. If (strName1 = strName2) Then
  586. blnAdd = False
  587. Else
  588. ' Scope name changed. Add it in the Delta.
  589. blnAdd = True
  590. End If
  591. Else
  592. ' Scope exists only in the new CAB. Add it in the Delta.
  593. blnAdd = True
  594. End If
  595. If (blnAdd) Then
  596. Set DOMElement = DOMDoc.createElement(ELEM_SCOPE_C)
  597. With DOMElement
  598. .setAttribute ATTR_ID_C, strId
  599. .setAttribute ATTR_DISPLAYNAME_C, strName2
  600. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  601. End With
  602. DOMNode.appendChild DOMElement
  603. End If
  604. Next
  605. For Each strId In p_dictScopes(FIRST_C).Keys
  606. ' Scope exists only in the old CAB. Remove it in the Delta.
  607. Set DOMElement = DOMDoc.createElement(ELEM_SCOPE_C)
  608. With DOMElement
  609. .setAttribute ATTR_ID_C, strId
  610. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  611. End With
  612. DOMNode.appendChild DOMElement
  613. Next
  614. DOMDoc.Save i_strFile
  615. End Sub
  616. Private Sub p_CreateOperatorsDelta( _
  617. ByVal i_strFile As String _
  618. )
  619. Dim DOMDoc As MSXML2.DOMDocument
  620. Dim DOMNode As MSXML2.IXMLDOMNode
  621. Dim DOMElement As MSXML2.IXMLDOMElement
  622. Dim strOperator As Variant
  623. Dim strOperation1 As String
  624. Dim strOperation2 As String
  625. Dim blnAdd As Boolean
  626. Dim blnDel As Boolean
  627. Set DOMDoc = p_GetNewDomDoc
  628. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  629. Set DOMElement = DOMDoc.createElement(ELEM_OPERATOR_ENTRIES_C)
  630. DOMNode.appendChild DOMElement
  631. Set DOMNode = DOMElement
  632. For Each strOperator In p_dictOperators(SECOND_C).Keys
  633. strOperation2 = p_dictOperators(SECOND_C)(strOperator)
  634. p_dictOperators(SECOND_C).Remove strOperator
  635. blnDel = False
  636. If (p_dictOperators(FIRST_C).Exists(strOperator)) Then
  637. strOperation1 = p_dictOperators(FIRST_C)(strOperator)
  638. p_dictOperators(FIRST_C).Remove strOperator
  639. If (strOperation1 = strOperation2) Then
  640. blnAdd = False
  641. Else
  642. ' Operation changed. Add it in the Delta.
  643. blnAdd = True
  644. blnDel = True
  645. End If
  646. Else
  647. ' Operator exists only in the new CAB. Add it in the Delta.
  648. blnAdd = True
  649. End If
  650. If (blnDel) Then
  651. Set DOMElement = DOMDoc.createElement(ELEM_OPERATOR_C)
  652. With DOMElement
  653. .setAttribute ATTR_OPERATOR_C, strOperator
  654. .setAttribute ATTR_OPERATION_C, strOperation1
  655. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  656. End With
  657. DOMNode.appendChild DOMElement
  658. End If
  659. If (blnAdd) Then
  660. Set DOMElement = DOMDoc.createElement(ELEM_OPERATOR_C)
  661. With DOMElement
  662. .setAttribute ATTR_OPERATOR_C, strOperator
  663. .setAttribute ATTR_OPERATION_C, strOperation2
  664. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  665. End With
  666. DOMNode.appendChild DOMElement
  667. End If
  668. Next
  669. For Each strOperator In p_dictOperators(FIRST_C).Keys
  670. strOperation1 = p_dictOperators(FIRST_C)(strOperator)
  671. ' Operator exists only in the old CAB. Remove it in the Delta.
  672. Set DOMElement = DOMDoc.createElement(ELEM_OPERATOR_C)
  673. With DOMElement
  674. .setAttribute ATTR_OPERATOR_C, strOperator
  675. .setAttribute ATTR_OPERATION_C, strOperation1
  676. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  677. End With
  678. DOMNode.appendChild DOMElement
  679. Next
  680. DOMDoc.Save i_strFile
  681. End Sub
  682. Private Sub p_CreateStopSignsDelta( _
  683. ByVal i_strFile As String _
  684. )
  685. Dim DOMDoc As MSXML2.DOMDocument
  686. Dim DOMNode As MSXML2.IXMLDOMNode
  687. Dim DOMElement As MSXML2.IXMLDOMElement
  688. Dim strStopSign As Variant
  689. Dim strContext1 As String
  690. Dim strContext2 As String
  691. Dim blnAdd As Boolean
  692. Dim blnDel As Boolean
  693. Set DOMDoc = p_GetNewDomDoc
  694. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  695. Set DOMElement = DOMDoc.createElement(ELEM_STOPSIGN_ENTRIES_C)
  696. DOMNode.appendChild DOMElement
  697. Set DOMNode = DOMElement
  698. For Each strStopSign In p_dictStopSigns(SECOND_C).Keys
  699. strContext2 = p_dictStopSigns(SECOND_C)(strStopSign)
  700. p_dictStopSigns(SECOND_C).Remove strStopSign
  701. blnDel = False
  702. If (p_dictStopSigns(FIRST_C).Exists(strStopSign)) Then
  703. strContext1 = p_dictStopSigns(FIRST_C)(strStopSign)
  704. p_dictStopSigns(FIRST_C).Remove strStopSign
  705. If (strContext1 = strContext2) Then
  706. blnAdd = False
  707. Else
  708. ' Context changed. Add it in the Delta.
  709. blnAdd = True
  710. blnDel = True
  711. End If
  712. Else
  713. ' StopSign exists only in the new CAB. Add it in the Delta.
  714. blnAdd = True
  715. End If
  716. If (blnDel) Then
  717. Set DOMElement = DOMDoc.createElement(ELEM_STOPSIGN_C)
  718. With DOMElement
  719. .setAttribute ATTR_STOPSIGN_C, strStopSign
  720. .setAttribute ATTR_CONTEXT_C, strContext1
  721. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  722. End With
  723. DOMNode.appendChild DOMElement
  724. End If
  725. If (blnAdd) Then
  726. Set DOMElement = DOMDoc.createElement(ELEM_STOPSIGN_C)
  727. With DOMElement
  728. .setAttribute ATTR_STOPSIGN_C, strStopSign
  729. .setAttribute ATTR_CONTEXT_C, strContext2
  730. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  731. End With
  732. DOMNode.appendChild DOMElement
  733. End If
  734. Next
  735. For Each strStopSign In p_dictStopSigns(FIRST_C).Keys
  736. strContext1 = p_dictStopSigns(FIRST_C)(strStopSign)
  737. ' StopSign exists only in the old CAB. Remove it in the Delta.
  738. Set DOMElement = DOMDoc.createElement(ELEM_STOPSIGN_C)
  739. With DOMElement
  740. .setAttribute ATTR_STOPSIGN_C, strStopSign
  741. .setAttribute ATTR_CONTEXT_C, strContext1
  742. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  743. End With
  744. DOMNode.appendChild DOMElement
  745. Next
  746. DOMDoc.Save i_strFile
  747. End Sub
  748. Private Sub p_CreateHelpImageFTSIndexDelta( _
  749. ByVal i_strFile As String _
  750. )
  751. Dim DOMDoc As MSXML2.DOMDocument
  752. Dim DOMNode As MSXML2.IXMLDOMNode
  753. Dim DOMElement As MSXML2.IXMLDOMElement
  754. Set DOMDoc = p_GetNewDomDoc
  755. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  756. Set DOMElement = DOMDoc.createElement(ELEM_HELPIMAGE_C)
  757. DOMNode.appendChild DOMElement
  758. p_CreateHelpImageDelta DOMDoc, DOMElement
  759. Set DOMElement = DOMDoc.createElement(ELEM_FTS_C)
  760. DOMNode.appendChild DOMElement
  761. p_CreateFTSDelta DOMDoc, DOMElement
  762. Set DOMElement = DOMDoc.createElement(ELEM_INDEX_C)
  763. DOMNode.appendChild DOMElement
  764. p_CreateIndexDelta DOMDoc, DOMElement
  765. DOMDoc.Save i_strFile
  766. End Sub
  767. Private Sub p_CreateHelpImageDelta( _
  768. ByVal u_DOMDoc As MSXML2.DOMDocument, _
  769. ByVal u_DOMNode As MSXML2.IXMLDOMNode _
  770. )
  771. Dim DOMElement As MSXML2.IXMLDOMElement
  772. Dim strChm As Variant
  773. For Each strChm In p_dictHelpImage(SECOND_C).Keys
  774. p_dictHelpImage(SECOND_C).Remove strChm
  775. If (p_dictHelpImage(FIRST_C).Exists(strChm)) Then
  776. ' HelpImage exists in both CABs. Ignore.
  777. p_dictHelpImage(FIRST_C).Remove strChm
  778. Else
  779. ' HelpImage exists only in the new CAB. Add it in the Delta.
  780. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  781. With DOMElement
  782. .setAttribute ATTR_CHM_C, strChm
  783. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  784. End With
  785. u_DOMNode.appendChild DOMElement
  786. End If
  787. Next
  788. For Each strChm In p_dictHelpImage(FIRST_C).Keys
  789. ' HelpImage exists only in the old CAB. Remove it in the Delta.
  790. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  791. With DOMElement
  792. .setAttribute ATTR_CHM_C, strChm
  793. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  794. End With
  795. u_DOMNode.appendChild DOMElement
  796. Next
  797. End Sub
  798. Private Sub p_CreateFTSDelta( _
  799. ByVal u_DOMDoc As MSXML2.DOMDocument, _
  800. ByVal u_DOMNode As MSXML2.IXMLDOMNode _
  801. )
  802. Dim DOMElement As MSXML2.IXMLDOMElement
  803. Dim strKey As Variant
  804. Dim arr() As String
  805. For Each strKey In p_dictFTS(SECOND_C).Keys
  806. p_dictFTS(SECOND_C).Remove strKey
  807. If (p_dictFTS(FIRST_C).Exists(strKey)) Then
  808. ' FTS exists in both CABs. Ignore.
  809. p_dictFTS(FIRST_C).Remove strKey
  810. Else
  811. ' FTS exists only in the new CAB. Add it in the Delta.
  812. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  813. arr = Split(strKey, SEP_C)
  814. With DOMElement
  815. .setAttribute ATTR_CHM_C, arr(0)
  816. If (arr(1) <> "") Then
  817. .setAttribute ATTR_CHQ_C, arr(1)
  818. End If
  819. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  820. End With
  821. u_DOMNode.appendChild DOMElement
  822. End If
  823. Next
  824. For Each strKey In p_dictFTS(FIRST_C).Keys
  825. ' FTS exists only in the old CAB. Remove it in the Delta.
  826. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  827. arr = Split(strKey, SEP_C)
  828. With DOMElement
  829. .setAttribute ATTR_CHM_C, arr(0)
  830. If (arr(1) <> "") Then
  831. .setAttribute ATTR_CHQ_C, arr(1)
  832. End If
  833. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  834. End With
  835. u_DOMNode.appendChild DOMElement
  836. Next
  837. End Sub
  838. Private Sub p_CreateIndexDelta( _
  839. ByVal u_DOMDoc As MSXML2.DOMDocument, _
  840. ByVal u_DOMNode As MSXML2.IXMLDOMNode _
  841. )
  842. Dim DOMElement As MSXML2.IXMLDOMElement
  843. Dim strKey As Variant
  844. Dim arr() As String
  845. Dim strScope1 As String
  846. Dim strScope2 As String
  847. Dim blnAdd As Boolean
  848. Dim blnDel As Boolean
  849. For Each strKey In p_dictIndex(SECOND_C).Keys
  850. strScope2 = p_dictIndex(SECOND_C)(strKey)
  851. p_dictIndex(SECOND_C).Remove strKey
  852. blnDel = False
  853. If (p_dictIndex(FIRST_C).Exists(strKey)) Then
  854. strScope1 = p_dictIndex(FIRST_C)(strKey)
  855. p_dictIndex(FIRST_C).Remove strKey
  856. If (strScope1 = strScope2) Then
  857. blnAdd = False
  858. Else
  859. ' Scope changed. Add it in the Delta.
  860. blnAdd = True
  861. blnDel = True
  862. End If
  863. Else
  864. ' Index exists only in the new CAB. Add it in the Delta.
  865. blnAdd = True
  866. End If
  867. arr = Split(strKey, SEP_C)
  868. If (blnDel) Then
  869. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  870. With DOMElement
  871. .setAttribute ATTR_CHM_C, arr(0)
  872. .setAttribute ATTR_HHK_C, arr(1)
  873. If (strScope1 <> "") Then
  874. .setAttribute ATTR_SCOPE_C, strScope1
  875. End If
  876. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  877. End With
  878. u_DOMNode.appendChild DOMElement
  879. End If
  880. If (blnAdd) Then
  881. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  882. With DOMElement
  883. .setAttribute ATTR_CHM_C, arr(0)
  884. .setAttribute ATTR_HHK_C, arr(1)
  885. If (strScope2 <> "") Then
  886. .setAttribute ATTR_SCOPE_C, strScope2
  887. End If
  888. .setAttribute ATTR_ACTION_C, VALUE_ADD_C
  889. End With
  890. u_DOMNode.appendChild DOMElement
  891. End If
  892. Next
  893. For Each strKey In p_dictIndex(FIRST_C).Keys
  894. strScope1 = p_dictIndex(FIRST_C)(strKey)
  895. arr = Split(strKey, SEP_C)
  896. ' Index exists only in the old CAB. Remove it in the Delta.
  897. Set DOMElement = u_DOMDoc.createElement(ELEM_HELPFILE_C)
  898. With DOMElement
  899. .setAttribute ATTR_CHM_C, arr(0)
  900. .setAttribute ATTR_HHK_C, arr(1)
  901. If (strScope1 <> "") Then
  902. .setAttribute ATTR_SCOPE_C, strScope1
  903. End If
  904. .setAttribute ATTR_ACTION_C, VALUE_DEL_C
  905. End With
  906. u_DOMNode.appendChild DOMElement
  907. Next
  908. End Sub
  909. Private Sub p_CreateSynTableDelta( _
  910. ByVal i_strFile As String _
  911. )
  912. Dim DOMDoc As MSXML2.DOMDocument
  913. Dim DOMNode As MSXML2.IXMLDOMNode
  914. Dim DOMNodeSynSet As MSXML2.IXMLDOMNode
  915. Dim DOMElement As MSXML2.IXMLDOMElement
  916. Dim strId As Variant
  917. Dim dict1 As Scripting.Dictionary
  918. Dim dict2 As Scripting.Dictionary
  919. Dim strSynonym As Variant
  920. Set DOMDoc = p_GetNewDomDoc
  921. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  922. Set DOMElement = DOMDoc.createElement(ELEM_SYNTABLE_C)
  923. DOMNode.appendChild DOMElement
  924. Set DOMNode = DOMElement
  925. Dim strKey As Variant
  926. Dim arr() As String
  927. Dim strScope1 As String
  928. Dim strScope2 As String
  929. Dim blnAdd As Boolean
  930. Dim blnDel As Boolean
  931. For Each strId In p_dictSynTable(SECOND_C).Keys
  932. Set dict2 = p_dictSynTable(SECOND_C)(strId)
  933. If (p_dictSynTable(FIRST_C).Exists(strId)) Then
  934. Set dict1 = p_dictSynTable(FIRST_C)(strId)
  935. p_dictSynTable(FIRST_C).Remove strId
  936. p_dictSynTable(SECOND_C).Remove strId
  937. For Each strSynonym In dict2.Keys
  938. If (dict1.Exists(strSynonym)) Then
  939. dict1.Remove strSynonym
  940. dict2.Remove strSynonym
  941. End If
  942. Next
  943. If ((dict1.Count <> 0) Or (dict2.Count <> 0)) Then
  944. Set DOMElement = DOMDoc.createElement(ELEM_SYNSET_C)
  945. DOMElement.setAttribute ATTR_ID_C, strId
  946. DOMNode.appendChild DOMElement
  947. Set DOMNodeSynSet = DOMElement
  948. For Each strSynonym In dict1.Keys
  949. Set DOMElement = DOMDoc.createElement(ELEM_SYNONYM_C)
  950. DOMElement.setAttribute ATTR_ACTION_C, VALUE_DEL_C
  951. DOMElement.Text = strSynonym
  952. DOMNodeSynSet.appendChild DOMElement
  953. Next
  954. For Each strSynonym In dict2.Keys
  955. Set DOMElement = DOMDoc.createElement(ELEM_SYNONYM_C)
  956. DOMElement.setAttribute ATTR_ACTION_C, VALUE_ADD_C
  957. DOMElement.Text = strSynonym
  958. DOMNodeSynSet.appendChild DOMElement
  959. Next
  960. End If
  961. End If
  962. Next
  963. For Each strId In p_dictSynTable(FIRST_C).Keys
  964. Set dict1 = p_dictSynTable(FIRST_C)(strId)
  965. p_dictSynTable(FIRST_C).Remove strId
  966. Set DOMElement = DOMDoc.createElement(ELEM_SYNSET_C)
  967. DOMElement.setAttribute ATTR_ID_C, strId
  968. DOMNode.appendChild DOMElement
  969. Set DOMNodeSynSet = DOMElement
  970. For Each strSynonym In dict1.Keys
  971. Set DOMElement = DOMDoc.createElement(ELEM_SYNONYM_C)
  972. DOMElement.setAttribute ATTR_ACTION_C, VALUE_DEL_C
  973. DOMElement.Text = strSynonym
  974. DOMNodeSynSet.appendChild DOMElement
  975. Next
  976. Next
  977. For Each strId In p_dictSynTable(SECOND_C).Keys
  978. Set dict2 = p_dictSynTable(SECOND_C)(strId)
  979. p_dictSynTable(SECOND_C).Remove strId
  980. Set DOMElement = DOMDoc.createElement(ELEM_SYNSET_C)
  981. DOMElement.setAttribute ATTR_ID_C, strId
  982. DOMNode.appendChild DOMElement
  983. Set DOMNodeSynSet = DOMElement
  984. For Each strSynonym In dict2.Keys
  985. Set DOMElement = DOMDoc.createElement(ELEM_SYNONYM_C)
  986. DOMElement.setAttribute ATTR_ACTION_C, VALUE_ADD_C
  987. DOMElement.Text = strSynonym
  988. DOMNodeSynSet.appendChild DOMElement
  989. Next
  990. Next
  991. DOMDoc.Save i_strFile
  992. End Sub
  993. Private Sub p_CreateTaxonomyDelta( _
  994. ByVal i_strFile As String _
  995. )
  996. Dim DOMDoc As MSXML2.DOMDocument
  997. Dim DOMNode As MSXML2.IXMLDOMNode
  998. Dim DOMElement As MSXML2.IXMLDOMElement
  999. Dim strKey As Variant
  1000. Dim Taxonomy1 As Taxonomy
  1001. Dim Taxonomy2 As Taxonomy
  1002. Dim blnKeywordsRemoved As Boolean
  1003. Dim intIndex As Long
  1004. Set DOMDoc = p_GetNewDomDoc
  1005. Set DOMNode = DOMDoc.selectSingleNode(ELEM_METADATA_C)
  1006. Set DOMElement = DOMDoc.createElement(ELEM_TAXONOMY_ENTRIES_C)
  1007. DOMNode.appendChild DOMElement
  1008. Set DOMNode = DOMElement
  1009. If (p_dictTaxonomy(SECOND_C).Count <> 0) Then
  1010. frmMain.ProgresBar_SetMax p_dictTaxonomy(SECOND_C).Count
  1011. End If
  1012. For Each strKey In p_dictTaxonomy(SECOND_C).Keys
  1013. intIndex = intIndex + 1
  1014. frmMain.ProgresBar_SetValue intIndex
  1015. DoEvents
  1016. Set Taxonomy2 = p_dictTaxonomy(SECOND_C)(strKey)
  1017. p_dictTaxonomy(SECOND_C).Remove strKey
  1018. Set Taxonomy1 = Nothing
  1019. If (p_dictTaxonomy(FIRST_C).Exists(strKey)) Then
  1020. Set Taxonomy1 = p_dictTaxonomy(FIRST_C)(strKey)
  1021. p_dictTaxonomy(FIRST_C).Remove strKey
  1022. End If
  1023. blnKeywordsRemoved = False
  1024. If ((Taxonomy1 Is Nothing) Or _
  1025. (Not Taxonomy2.SameAs(Taxonomy1, p_blnIgnoreKeywords, blnKeywordsRemoved))) Then
  1026. If (blnKeywordsRemoved) Then
  1027. frmMain.Output "Keywords have been removed from Taxonomy entry """ & strKey & """.", _
  1028. LOGGING_TYPE_WARNING_E
  1029. frmMain.Output "Keyword removal is not supported.", LOGGING_TYPE_WARNING_E
  1030. Else
  1031. p_InsertTaxonomyEntry DOMDoc, DOMNode, Taxonomy2, True
  1032. End If
  1033. End If
  1034. Next
  1035. frmMain.ProgresBar_SetValue 0
  1036. If (p_dictTaxonomy(FIRST_C).Count <> 0) Then
  1037. frmMain.ProgresBar_SetMax p_dictTaxonomy(FIRST_C).Count
  1038. End If
  1039. intIndex = 0
  1040. For Each strKey In p_dictTaxonomy(FIRST_C).Keys
  1041. intIndex = intIndex + 1
  1042. frmMain.ProgresBar_SetValue intIndex
  1043. DoEvents
  1044. Set Taxonomy1 = p_dictTaxonomy(FIRST_C)(strKey)
  1045. If (Taxonomy1.strEntry <> "") Then
  1046. Err.Raise E_FAIL, , "Node """ & strKey & """ has been deleted. This is not supported."
  1047. End If
  1048. p_InsertTaxonomyEntry DOMDoc, DOMNode, Taxonomy1, False
  1049. Next
  1050. frmMain.ProgresBar_SetValue 0
  1051. DOMDoc.Save i_strFile
  1052. End Sub
  1053. Private Sub p_InsertTaxonomyEntry( _
  1054. ByRef u_DOMDoc As MSXML2.DOMDocument, _
  1055. ByRef u_DOMNode As MSXML2.IXMLDOMNode, _
  1056. ByRef i_Taxonomy As Taxonomy, _
  1057. ByVal i_blnAdd As Boolean _
  1058. )
  1059. Dim DOMElement As MSXML2.IXMLDOMElement
  1060. Dim DOMElementKw As MSXML2.IXMLDOMElement
  1061. Dim strKeyword As Variant
  1062. Dim strPriority As String
  1063. Set DOMElement = u_DOMDoc.createElement(ELEM_TAXONOMY_ENTRY_C)
  1064. With i_Taxonomy
  1065. DOMElement.setAttribute ATTR_CATEGORY_C, .strCategory
  1066. If (.strEntry <> "") Then
  1067. DOMElement.setAttribute ATTR_ENTRY_C, .strEntry
  1068. End If
  1069. DOMElement.setAttribute ATTR_URI_C, .strURI
  1070. DOMElement.setAttribute ATTR_TITLE_C, .strTitle
  1071. If (i_blnAdd) Then
  1072. DOMElement.setAttribute ATTR_ICONURI_C, .strIconURI
  1073. DOMElement.setAttribute ATTR_DESCRIPTION_C, .strDescription
  1074. If (.strType <> "") Then
  1075. DOMElement.setAttribute ATTR_TYPE_C, .strType
  1076. End If
  1077. If (.strVisible <> "") Then
  1078. DOMElement.setAttribute ATTR_VISIBLE_C, .strVisible
  1079. End If
  1080. If (.strSubSite <> "") Then
  1081. DOMElement.setAttribute ATTR_SUBSITE_C, .strSubSite
  1082. End If
  1083. If (.strNavigationModel <> "") Then
  1084. DOMElement.setAttribute ATTR_NAVIGATIONMODEL_C, .strNavigationModel
  1085. End If
  1086. End If
  1087. If (i_blnAdd) Then
  1088. DOMElement.setAttribute ATTR_ACTION_C, VALUE_ADD_C
  1089. Else
  1090. DOMElement.setAttribute ATTR_ACTION_C, VALUE_DEL_C
  1091. End If
  1092. If (i_blnAdd And (Not .dictKeywords Is Nothing)) Then
  1093. For Each strKeyword In .dictKeywords.Keys
  1094. Set DOMElementKw = u_DOMDoc.createElement(ELEM_KEYWORD_C)
  1095. DOMElementKw.Text = strKeyword
  1096. strPriority = .dictKeywords(strKeyword)
  1097. If (strPriority <> "") Then
  1098. DOMElementKw.setAttribute ATTR_PRIORITY_C, strPriority
  1099. End If
  1100. DOMElement.appendChild DOMElementKw
  1101. Next
  1102. End If
  1103. End With
  1104. u_DOMNode.appendChild DOMElement
  1105. End Sub
  1106. Private Sub p_FixPackageDescription( _
  1107. ByVal i_strFolder As String _
  1108. )
  1109. Dim DOMDoc As MSXML2.DOMDocument
  1110. Dim DOMElement As MSXML2.IXMLDOMElement
  1111. Dim DOMElementHHT As MSXML2.IXMLDOMElement
  1112. Set DOMDoc = GetPackageDescription(i_strFolder)
  1113. Set DOMElement = DOMDoc.selectSingleNode("HELPCENTERPACKAGE/VERSION")
  1114. DOMElement.setAttribute ATTR_VALUE_C, p_strVersion
  1115. Set DOMElement = DOMDoc.selectSingleNode("HELPCENTERPACKAGE/METADATA")
  1116. ' The order in which the HHTs are listed is important.
  1117. ' For example, The synonym table must appear before the taxonomy.
  1118. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1119. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & OPERATORS_HHT_C
  1120. DOMElement.appendChild DOMElementHHT
  1121. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1122. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & STOP_SIGNS_HHT_C
  1123. DOMElement.appendChild DOMElementHHT
  1124. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1125. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & STOP_WORDS_HHT_C
  1126. DOMElement.appendChild DOMElementHHT
  1127. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1128. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & SYN_TABLE_HHT_C
  1129. DOMElement.appendChild DOMElementHHT
  1130. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1131. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & TAXONOMY_HHT_C
  1132. DOMElement.appendChild DOMElementHHT
  1133. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1134. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & SCOPE_DEFINITION_HHT_C
  1135. DOMElement.appendChild DOMElementHHT
  1136. Set DOMElementHHT = DOMDoc.createElement(ELEM_HHT_C)
  1137. DOMElementHHT.setAttribute ATTR_FILE_C, p_strVersion & "_" & NO_LOC_HHT_C
  1138. DOMElement.appendChild DOMElementHHT
  1139. DOMDoc.Save i_strFolder & "\" & PKG_DESC_FILE_C
  1140. End Sub