diff --git a/src/linter/xmlTemplate/Parser.ts b/src/linter/xmlTemplate/Parser.ts
index 4fd7561f4..b598214ac 100644
--- a/src/linter/xmlTemplate/Parser.ts
+++ b/src/linter/xmlTemplate/Parser.ts
@@ -168,14 +168,14 @@ export default class Parser {
}
popTag(_tag: SaxTag) { // No need to use the parsed tag, we rely on our nodeStack
- const level = this.#nodeStack.length;
const closingNode = this.#nodeStack.pop();
+ const level = this.#nodeStack.length;
if (closingNode &&
(closingNode.kind & (NodeKind.Control | NodeKind.FragmentDefinition))) {
// Generate view code for this control
// If this is the root control, export it
- if (level === 1) {
+ if (level === 0) {
// Actually closingNode might be a FragmentDefinitionDeclaration here
// But that's tricky with the current generator signatures
this.#generator.writeRootControl(closingNode as ControlDeclaration);
diff --git a/test/fixtures/linter/rules/NoDeprecatedApi/MultipleXmlns.fragment.xml b/test/fixtures/linter/rules/NoDeprecatedApi/MultipleXmlns.fragment.xml
new file mode 100644
index 000000000..96c3e3582
--- /dev/null
+++ b/test/fixtures/linter/rules/NoDeprecatedApi/MultipleXmlns.fragment.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
index a14ea08ab..837c2edb1 100644
--- a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
+++ b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
@@ -981,6 +981,78 @@ Generated by [AVA](https://avajs.dev).
},
]
+## General: MultipleXmlns.fragment.xml
+
+> Snapshot 1
+
+ [
+ {
+ coverageInfo: [],
+ errorCount: 4,
+ fatalErrorCount: 0,
+ filePath: 'MultipleXmlns.fragment.xml',
+ messages: [
+ {
+ column: 30,
+ line: 3,
+ message: 'Event handler \'onGroup\' must be prefixed by a dot \'.\' or refer to a local name',
+ messageDetails: 'If the handler is defined on the controller, use the leading dot notation. Otherwise import the module via core:require and use the handler via the local name. See Handling Events in XML Views (https://ui5.sap.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe)',
+ ruleId: 'no-ambiguous-event-handler',
+ severity: 1,
+ },
+ {
+ column: 30,
+ line: 3,
+ message: 'Use of deprecated property \'group\' of class \'Table\'',
+ messageDetails: 'Deprecated test message',
+ ruleId: 'no-deprecated-api',
+ severity: 2,
+ },
+ {
+ column: 46,
+ line: 3,
+ message: 'Use of deprecated property \'visibleRowCountMode\' of class \'Table\'',
+ messageDetails: 'Deprecated test message',
+ ruleId: 'no-deprecated-api',
+ severity: 2,
+ },
+ {
+ column: 26,
+ line: 5,
+ message: 'Event handler \'onTap\' must be prefixed by a dot \'.\' or refer to a local name',
+ messageDetails: 'If the handler is defined on the controller, use the leading dot notation. Otherwise import the module via core:require and use the handler via the local name. See Handling Events in XML Views (https://ui5.sap.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe)',
+ ruleId: 'no-ambiguous-event-handler',
+ severity: 1,
+ },
+ {
+ column: 26,
+ line: 5,
+ message: 'Use of deprecated property \'tap\' of class \'Button\'',
+ messageDetails: 'Deprecated test message',
+ ruleId: 'no-deprecated-api',
+ severity: 2,
+ },
+ {
+ column: 10,
+ line: 9,
+ message: 'Event handler \'onTap\' must be prefixed by a dot \'.\' or refer to a local name',
+ messageDetails: 'If the handler is defined on the controller, use the leading dot notation. Otherwise import the module via core:require and use the handler via the local name. See Handling Events in XML Views (https://ui5.sap.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe)',
+ ruleId: 'no-ambiguous-event-handler',
+ severity: 1,
+ },
+ {
+ column: 10,
+ line: 9,
+ message: 'Use of deprecated property \'tap\' of class \'Button\'',
+ messageDetails: 'Deprecated test message',
+ ruleId: 'no-deprecated-api',
+ severity: 2,
+ },
+ ],
+ warningCount: 3,
+ },
+ ]
+
## General: NoDeprecatedApi.js
> Snapshot 1
diff --git a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap
index d82280142..e1b890cfc 100644
Binary files a/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap and b/test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap differ
diff --git a/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.md b/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.md
index 7cc9f2cae..65ace4549 100644
--- a/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.md
+++ b/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.md
@@ -517,6 +517,88 @@ Generated by [AVA](https://avajs.dev).
Map {}
+## Transpile MultipleXmlns.fragment.xml
+
+> source
+
+ `import Button from "sap/m/Button";␊
+ import Button2 from "sap/m/Button";␊
+ import Table from "sap/ui/table/Table";␊
+ import VBox from "sap/m/VBox";␊
+ const oButton = new Button({␊
+ tap: "onTap",␊
+ });␊
+ ␊
+ const oTable = new Table({␊
+ group: "onGroup",␊
+ footer: [␊
+ oButton,␊
+ ],␊
+ });␊
+ ␊
+ const oButton2 = new Button2({␊
+ tap: "onTap",␊
+ });␊
+ ␊
+ const oVBox = new VBox({␊
+ items: [␊
+ oTable,␊
+ oButton2,␊
+ ],␊
+ });␊
+ ␊
+ export default {␊
+ createContent: function () {␊
+ return oVBox;␊
+ }␊
+ }␊
+ `
+
+> map
+
+ {
+ file: 'MultipleXmlns.fragment.js',
+ mappings: 'AAIG,kCAAoC;AAItC,mCAAsB;AANtB,uCAA4C;AAF7C,8BAAoB;gBAIjB,YAAoC;IAAd,aAAW;;;eAFnC,WAA4C;IAAhB,iBAAe;IAC1C,MAAQ;;;;;iBAKT,aAAsB;IAAd,aAAW;;;cARpB,UAAoB;IAEnB,KAA4C',
+ names: [],
+ sources: [
+ 'MultipleXmlns.fragment.xml',
+ ],
+ version: 3,
+ }
+
+> messages
+
+ [
+ {
+ column: 30,
+ line: 3,
+ message: 'Event handler \'onGroup\' must be prefixed by a dot \'.\' or refer to a local name',
+ messageDetails: 'If the handler is defined on the controller, use the leading dot notation. Otherwise import the module via core:require and use the handler via the local name. See Handling Events in XML Views (https://ui5.sap.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe)',
+ ruleId: 'no-ambiguous-event-handler',
+ severity: 1,
+ },
+ {
+ column: 26,
+ line: 5,
+ message: 'Event handler \'onTap\' must be prefixed by a dot \'.\' or refer to a local name',
+ messageDetails: 'If the handler is defined on the controller, use the leading dot notation. Otherwise import the module via core:require and use the handler via the local name. See Handling Events in XML Views (https://ui5.sap.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe)',
+ ruleId: 'no-ambiguous-event-handler',
+ severity: 1,
+ },
+ {
+ column: 10,
+ line: 9,
+ message: 'Event handler \'onTap\' must be prefixed by a dot \'.\' or refer to a local name',
+ messageDetails: 'If the handler is defined on the controller, use the leading dot notation. Otherwise import the module via core:require and use the handler via the local name. See Handling Events in XML Views (https://ui5.sap.com/#/topic/b0fb4de7364f4bcbb053a99aa645affe)',
+ ruleId: 'no-ambiguous-event-handler',
+ severity: 1,
+ },
+ ]
+
+> controllerByIdInfo
+
+ Map {}
+
## Transpile UnknownAttrNamespace.fragment.xml
> source
diff --git a/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.snap b/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.snap
index f8d8048aa..d85394c70 100644
Binary files a/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.snap and b/test/lib/linter/xmlTemplate/snapshots/transpiler.ts.snap differ