Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bump xmldom to 0.6.0 to avoid bug where it keeps "<" in attributes (#…
…1974) * bump xmldom to 0.6.0 to avoid bug where it keeps "<" in attributes see xmldom/xmldom#198 * add test which fails on version of 0.5.0 because of bad serialization * add valid entity serialization test * move serialization test down to serializer package instead of up at transformer level * better test name not referencing round trip Co-authored-by: Michael Belousov <MichaelBelousov@users.noreply.github.com> (cherry picked from commit 97a229f) # Conflicts: # common/config/rush/pnpm-lock.yaml
- Loading branch information
1 parent
01a350d
commit 4a930ea
Showing
11 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
common/changes/@bentley/ecschema-editing/bump-xmldom_2021-07-30-17-07.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@bentley/ecschema-editing", | ||
"comment": "switch to xmldom@0.6.0 which correctly escapes entities in attributes when serializing", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@bentley/ecschema-editing", | ||
"email": "MichaelBelousov@users.noreply.github.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
common/changes/@bentley/ecschema-locaters/bump-xmldom_2021-07-30-17-07.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@bentley/ecschema-locaters", | ||
"comment": "switch to xmldom@0.6.0 which correctly escapes entities in attributes when serializing", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@bentley/ecschema-locaters", | ||
"email": "MichaelBelousov@users.noreply.github.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
common/changes/@bentley/ecschema-metadata/bump-xmldom_2021-07-30-17-07.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@bentley/ecschema-metadata", | ||
"comment": "switch to xmldom@0.6.0 which correctly escapes entities in attributes when serializing", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@bentley/ecschema-metadata", | ||
"email": "MichaelBelousov@users.noreply.github.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
common/changes/@bentley/ecschema2ts/bump-xmldom_2021-07-30-17-07.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@bentley/ecschema2ts", | ||
"comment": "switch to xmldom@0.6.0 which correctly escapes entities in attributes when serializing", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@bentley/ecschema2ts", | ||
"email": "MichaelBelousov@users.noreply.github.com" | ||
} |
11 changes: 11 additions & 0 deletions
11
common/changes/@bentley/itwin-client/bump-xmldom_2021-07-30-17-07.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"changes": [ | ||
{ | ||
"packageName": "@bentley/itwin-client", | ||
"comment": "switch to xmldom@0.6.0 which correctly escapes entities in attributes when serializing", | ||
"type": "none" | ||
} | ||
], | ||
"packageName": "@bentley/itwin-client", | ||
"email": "MichaelBelousov@users.noreply.github.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
core/ecschema-metadata/src/test/Serialization/XmlSerializer.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Bentley Systems, Incorporated. All rights reserved. | ||
* See LICENSE.md in the project root for license terms and full copyright notice. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { assert } from "chai"; | ||
import { SchemaContext } from "../../Context"; | ||
import { MutableSchema, Schema } from "../../Metadata/Schema"; | ||
import { MutableEntityClass } from "../../Metadata/EntityClass"; | ||
|
||
describe("XmlSerializer", () => { | ||
it("try serializing attributes with html entities '<' '&' ", async () => { | ||
const ctx = new SchemaContext(); | ||
const schema = new Schema(ctx, "TestSchema", "ts", 1, 0, 0) as MutableSchema; | ||
const entityClass = (await schema.createEntityClass("TestElement")) as MutableEntityClass; | ||
entityClass.setDisplayLabel("escape < us & please; except > I'm ok apparently"); | ||
const serializedXml = await schema.toXmlString(); | ||
|
||
// use regex to find the displayLabel quote, because the DOMParser implementation could be lenient | ||
assert( | ||
/displayLabel\s*=\s*"escape < us & please; except > I'm ok apparently"/.test(serializedXml), | ||
"< and & must be escaped in serialized xml" | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters