Skip to content

Commit 81de0f6

Browse files
authored
Merge pull request #316 from dotnet/jeffhandley/6.0-backport-xmlsqlbinaryreader
[release/6.0] Introduce SqlXml.CreateReader test files in SqlBinaryXml and Text formats
2 parents 2bb7dce + 5a041f6 commit 81de0f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+145
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# System.Data.Common Test Files
2+
3+
## SqlXml.CreateReader
4+
5+
Test files this folder are used by the `SqlXml.CreateReader()` tests to confirm the API can process both Text and SQL Binary XML formats, and that processed SQL Binary XML matches the expected baseline text representations.
6+
7+
### Baseline-Text
8+
9+
These files serve two purposes:
10+
11+
1. They are the baselines used for validating the behavior of processing the `SqlBinaryXml` files
12+
2. They are also used to validate `SqlXml.CreateReader()` can process text files
13+
14+
These files are generated by converting the `SqlBinaryXml` files to text, using the `SqlXml.CreateReader()` API and the following code snippet.
15+
16+
```c#
17+
string sqlBinaryXmlFile = @"SqlBinaryXml\file.bmx";
18+
string textXmlFile = @"Baseline-Text\file.xml";
19+
20+
using FileStream sqlBinaryXmlStream = new FileStream(sqlBinaryXmlFile, FileMode.Open);
21+
SqlXml sqlXml = new(sqlBinaryXmlStream);
22+
23+
using XmlReader sqlXmlReader = sqlXml.CreateReader();
24+
using XmlWriter xmlWriter = new XmlTextWriter(textXmlFile, Encoding.UTF8);
25+
26+
while (sqlXmlReader.Read())
27+
{
28+
xmlWriter.WriteNode(sqlXmlReader, false);
29+
}
30+
```
31+
32+
Because these files are treated as the baselines for the `SqlBinaryXml` validation, they must not be edited independently from the `SqlBinaryXml` files. Even whitespace and formatting changes will cause the tests to fail.
33+
34+
### SqlBinaryXml
35+
36+
These files are stored in SQL Binary XML ([MS-BINXML](https://learn.microsoft.com/en-us/openspecs/sql_server_protocols/ms-binxml/d5bd1f42-8643-435c-a0df-0ba8680a19ee)) format, representing a variety of scenarios salient for `SqlXml` scenarios.
37+
38+
The `SqlXml.CreateReader()` tests process these files and then validate that the results match the XML loaded from the corresponding files in the `Baseline-Text` folder. Therefore, there must be a 1:1 match between the files in the two folders.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!-- test comments & pis --><root>
2+
<?pi with text?>
3+
<e></e>
4+
<!-- comment -->
5+
</root>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="utf-8"?><!-- test ability to grow buffer for element content --><root>
2+
0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
3+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
4+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
5+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
6+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
7+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
8+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
9+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
10+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
11+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
12+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
13+
14+
0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
15+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
16+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
17+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
18+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
19+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
20+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
21+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
22+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
23+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
24+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
25+
26+
0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
27+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
28+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
29+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
30+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
31+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
32+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
33+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
34+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
35+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
36+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
37+
38+
0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
39+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
40+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
41+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
42+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
43+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
44+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
45+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
46+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
47+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
48+
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
49+
</root>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root xmlns:a="urn:empty"><a:a></a:a><x><a:a></a:a>some text</x></root>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root><e /></root>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root a="abc"><root a="abc"><root a="abc">xyz</root><root />def</root><root /></root>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root></root>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<root><!--test element stack growing -->
2+
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
3+
<e1 xml:space="preserve"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
4+
<e1 xml:lang="en-us"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
5+
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
6+
<e1 xml:space="default"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
7+
<e1 xml:lang="en-br"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
8+
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
9+
<e1 xml:space="preserve"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
10+
<e1 xml:lang="fr"><e2><e3><e4><e5><e6><e7><e8><e9><e0>
11+
<e1><e2><e3><e4><e5><e6><e7><e8><e9><e0>
12+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
13+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
14+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
15+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
16+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
17+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
18+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
19+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
20+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
21+
</e0></e9></e8></e7></e6></e5></e4></e3></e2></e1>
22+
</root>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="yes"?><!-- test ability to grow buffer for tag name --><e0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789>
2+
</e0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789__0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789_0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root>root<e a="attr-text" x="123" /><e>[text1]</e><e></e><e x="321"><e x="123">[text2]</e></e><!--comment-text-->[text3]<?pi-name pi-text?></root>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<e a=" " xml:space="default">
2+
<e a=" " xml:space="preserve">
3+
<e a=" " xml:space="default">
4+
</e>
5+
<e><e /></e>
6+
</e>
7+
<e />
8+
</e>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root> </root>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<root a="root" b="prefix:local">root</root>

0 commit comments

Comments
 (0)