Fix ID scanning in form-add and title emission in form-compile

form-add: Scan column IDs (same pool as attribute IDs) to prevent
duplicate ID collisions. Use XPath .//*[@id] instead of ChildItems
recursion to capture companion element IDs (ExtendedTooltip, ContextMenu).

form-compile: Extract title from properties and route through Emit-MLText
instead of generic Emit-Properties, which produced plain text <Title>
rejected by 1C XDTO schema.

Found during E2E testing of full pipeline (epf-init → form-compile →
form-add → epf-build).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-09 14:40:23 +03:00
co-authored by Claude Opus 4.6
parent 99f57a5ff2
commit a9e59265dd
2 changed files with 41 additions and 27 deletions
+22 -22
View File
@@ -63,37 +63,37 @@ $script:nextElemId = 0
$script:nextAttrId = 0
$script:nextCmdId = 0
function Scan-ElementIds($node) {
foreach ($child in $node.ChildNodes) {
if ($child.NodeType -ne 'Element') { continue }
$id = $child.GetAttribute("id")
if ($id -and $id -ne "" -and $id -ne "-1") {
try {
$intId = [int]$id
if ($intId -gt $script:nextElemId) { $script:nextElemId = $intId }
} catch {}
# Scan ALL element IDs via XPath (includes companions like ExtendedTooltip, ContextMenu)
$rootCI = $root.SelectSingleNode("f:ChildItems", $nsMgr)
if ($rootCI) {
foreach ($elem in $rootCI.SelectNodes(".//*[@id]")) {
$id = $elem.GetAttribute("id")
if ($id -and $id -ne "-1") {
try { $intId = [int]$id; if ($intId -gt $script:nextElemId) { $script:nextElemId = $intId } } catch {}
}
$ci = $child.SelectSingleNode("f:ChildItems", $nsMgr)
if ($ci) { Scan-ElementIds $ci }
}
}
$acb = $root.SelectSingleNode("f:AutoCommandBar", $nsMgr)
if ($acb) {
$id = $acb.GetAttribute("id")
if ($id -and $id -ne "-1") {
try { $intId = [int]$id; if ($intId -gt $script:nextElemId) { $script:nextElemId = $intId } } catch {}
}
}
$rootCI = $root.SelectSingleNode("f:ChildItems", $nsMgr)
if ($rootCI) { Scan-ElementIds $rootCI }
# Also scan AutoCommandBar children
$acb = $root.SelectSingleNode("f:AutoCommandBar", $nsMgr)
if ($acb) {
$acbCI = $acb.SelectSingleNode("f:ChildItems", $nsMgr)
if ($acbCI) { Scan-ElementIds $acbCI }
}
# Scan attribute IDs
# Scan attribute IDs (including column IDs — same pool)
foreach ($attr in $root.SelectNodes("f:Attributes/f:Attribute", $nsMgr)) {
$id = $attr.GetAttribute("id")
if ($id) {
try { $intId = [int]$id; if ($intId -gt $script:nextAttrId) { $script:nextAttrId = $intId } } catch {}
}
# Column IDs are in the same pool as attribute IDs
foreach ($col in $attr.SelectNodes("f:Columns/f:Column", $nsMgr)) {
$colId = $col.GetAttribute("id")
if ($colId) {
try { $intColId = [int]$colId; if ($intColId -gt $script:nextAttrId) { $script:nextAttrId = $intColId } } catch {}
}
}
}
# Scan command IDs