diff --git a/src/4.3_to_5.0/__snapshots__/getCalculatedMeasures.test.ts.snap b/src/4.3_to_5.0/__snapshots__/getCalculatedMeasures.test.ts.snap
index 369cecbc..d1b93a10 100644
--- a/src/4.3_to_5.0/__snapshots__/getCalculatedMeasures.test.ts.snap
+++ b/src/4.3_to_5.0/__snapshots__/getCalculatedMeasures.test.ts.snap
@@ -1,5 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`getCalculatedMeasures parses an XML calculated measure with a namespace 1`] = `
+[
+ {
+ "expression": "[Measures].[deltaMTM]",
+ "formatStringExpression": ""#,###,,"",
+ "owners": [
+ "43890025",
+ ],
+ "readers": [
+ "43890025",
+ ],
+ "uniqueName": "[Measures].[CC Impact MtM]",
+ },
+]
+`;
+
exports[`getCalculatedMeasures returns the parsed calculated measure objects 1`] = `
[
{
diff --git a/src/4.3_to_5.0/getCalculatedMeasures.test.ts b/src/4.3_to_5.0/getCalculatedMeasures.test.ts
index 7434594d..3a872cca 100644
--- a/src/4.3_to_5.0/getCalculatedMeasures.test.ts
+++ b/src/4.3_to_5.0/getCalculatedMeasures.test.ts
@@ -53,4 +53,45 @@ describe("getCalculatedMeasures", () => {
expect(result).toMatchSnapshot();
});
+
+ // https://activeviam.atlassian.net/browse/UI-8803
+ it("parses an XML calculated measure with a namespace", async () => {
+ // The "calculateMember" tag has a namespace: "ns2".
+ const legacyCalculatedMeasuresFolder = {
+ entry: {
+ isDirectory: true,
+ owners: ["ROLE_CS_ROOT"],
+ readers: ["ROLE_CS_ROOT"],
+ },
+ children: {
+ EquityDerivativesCube: {
+ entry: {
+ isDirectory: true,
+ owners: ["ROLE_CS_ROOT"],
+ readers: ["ROLE_CS_ROOT"],
+ },
+
+ children: {
+ "[Measures].[CC Impact MtM]": {
+ entry: {
+ content:
+ '\n\n \n\n',
+ isDirectory: false,
+ owners: ["43890025"],
+ readers: ["43890025"],
+ timestamp: 1569424639841,
+ lastEditor: "43890025",
+ canRead: true,
+ canWrite: true,
+ },
+ },
+ },
+ },
+ },
+ };
+
+ const result = await getCalculatedMeasures(legacyCalculatedMeasuresFolder);
+
+ expect(result).toMatchSnapshot();
+ });
});
diff --git a/src/4.3_to_5.0/getCalculatedMeasures.ts b/src/4.3_to_5.0/getCalculatedMeasures.ts
index 50a57dc9..fd7d190a 100644
--- a/src/4.3_to_5.0/getCalculatedMeasures.ts
+++ b/src/4.3_to_5.0/getCalculatedMeasures.ts
@@ -2,6 +2,7 @@ import { ContentRecord } from "@activeviam/activeui-sdk-5.0";
import xml2js from "xml2js";
import _flatMap from "lodash/flatMap";
import { LegacyCalculatedMeasure } from "./migrateCalculatedMeasures";
+import { stripPrefix } from "xml2js/lib/processors";
/**
* Extracts and parses the XML calculated measure objects from the /pivot/entitlements/cm folder.
@@ -9,7 +10,7 @@ import { LegacyCalculatedMeasure } from "./migrateCalculatedMeasures";
export const getCalculatedMeasures = async (
calculatedMeasuresFolder: ContentRecord,
): Promise => {
- const parser = new xml2js.Parser();
+ const parser = new xml2js.Parser({ tagNameProcessors: [stripPrefix] });
const calculatedMeasures: LegacyCalculatedMeasure[] = [];