" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-104", () => {
+ // 3.1 [40] — Test demonstrates that extra whitespace within an Attribute of a Start-tag is normalized
+ // to a single space character.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x y" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-105", () => {
+ // 3.3.3 — Basically an output test, this requires a CDATA attribute with a tab character to be passed
+ // through as one space.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x\ty" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-106", () => {
+ // 3.3.3 — Basically an output test, this requires a CDATA attribute with a newline character to be
+ // passed through as one space.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x\ny" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-107", () => {
+ // 3.3.3 — Basically an output test, this requires a CDATA attribute with a return character to be
+ // passed through as one space.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x\ry" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-108", () => {
+ // 2.11, 3.3.3 — This tests normalization of end-of-line characters (CRLF) within entities to LF,
+ // primarily as an output test.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x y" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-109", () => {
+ // 2.3 3.1 [10][40][41] — Test demonstrates that an attribute can have a null value.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-110", () => {
+ // 3.3.3 — Basically an output test, this requires that a CDATA attribute with a CRLF be normalized to
+ // one space.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x y" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-111", () => {
+ // 3.3.3 — Character references expanding to spaces doesn't affect treatment of attributes.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a": "x y" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-112", () => {
+ // 3.2.1 [48][49] — Test demonstrates shows the use of content particles within the element content.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: { a: "" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-113", () => {
+ // 3.3 [52][53] — Test demonstrates that it is not an error to have attributes declared for an element
+ // not itself declared.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-114", () => {
+ // 2.7 [20] — Test demonstrates that all text within a valid CDATA section is considered text and not
+ // recognized as markup.
+ const input: string =
+ '\r\n">\r\n]>\r\n&e;\r\n';
+ const canonical = "&foo;";
+ const compact: unknown = { doc: "&foo;" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-115", () => {
+ // 3.3.3 — Test demonstrates that an entity reference is processed by recursively processing the
+ // replacement text of the entity.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n&e1;\r\n';
+ const canonical = "v";
+ const compact: unknown = { doc: "v" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-116", () => {
+ // 2.11 — Test demonstrates that a line break within CDATA will be normalized.
+ const input: string = "\r\n]>\r\n\r\n";
+ const canonical = "
";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-117", () => {
+ // 4.5 — Test demonstrates that entity expansion is done while processing entity declarations.
+ const input: string =
+ '\r\n\r\n]>\r\n]\r\n';
+ const canonical = "]";
+ const compact: unknown = { doc: "]" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-118", () => {
+ // 4.5 — Test demonstrates that entity expansion is done while processing entity declarations.
+ const input: string =
+ '\r\n\r\n]>\r\n]\r\n';
+ const canonical = "]]";
+ const compact: unknown = { doc: "]]" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-sa-119", () => {
+ // 2.5 — Comments may contain any legal XML characters; only the string "--" is disallowed.
+ const input: string = "\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-not-sa-001", () => {
+ // 4.2.2 [75] — Test demonstrates the use of an ExternalID within a document type definition.
+ // (upstream: valid; external general and parameter entities are not read)
+ const input: string = '\r\n]>\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-not-sa-002", () => {
+ // 4.2.2 [75] — Test demonstrates the use of an ExternalID within a document type definition.
+ // (upstream: valid; external general and parameter entities are not read)
+ const input: string = '\r\n]>\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-not-sa-003", () => {
+ // 4.1 [69] — Test demonstrates the expansion of an external parameter entity that declares an
+ // attribute. (upstream: valid; external general and parameter entities are not read; output depends on
+ // them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-004", () => {
+ // 4.1 [69] — Expands an external parameter entity in two different ways, with one of them declaring an
+ // attribute. (upstream: valid; external general and parameter entities are not read; output depends on
+ // them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-005", () => {
+ // 4.1 [69] — Test demonstrates the expansion of an external parameter entity that declares an
+ // attribute. (upstream: valid; external general and parameter entities are not read; output depends on
+ // them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-006", () => {
+ // 3.3 [52] — Test demonstrates that when more than one definition is provided for the same attribute
+ // of a given element type only the first declaration is binding. (upstream: valid; external general
+ // and parameter entities are not read; output depends on them)
+ const input: string = '\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-007", () => {
+ // 3.3 [52] — Test demonstrates the use of an Attribute list declaration within an external entity.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-008", () => {
+ // 4.2.2 [75] — Test demonstrates that an external identifier may include a public identifier.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-009", () => {
+ // 4.2.2 [75] — Test demonstrates that an external identifier may include a public identifier.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-010", () => {
+ // 3.3 [52] — Test demonstrates that when more that one definition is provided for the same attribute
+ // of a given element type only the first declaration is binding. (upstream: valid; external general
+ // and parameter entities are not read)
+ const input: string = '\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { doc: { "@a1": "v1" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-not-sa-011", () => {
+ // 4.2 4.2.1 [72] [75] — Test demonstrates a parameter entity declaration whose parameter entity
+ // definition is an ExternalID. (upstream: valid; external general and parameter entities are not read;
+ // output depends on them)
+ const input: string = '\r\n%e;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-012", () => {
+ // 4.3.1 [77] — Test demonstrates an enternal parsed entity that begins with a text declaration.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n%e;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-013", () => {
+ // 3.4 [62] — Test demonstrates the use of the conditional section INCLUDE that will include its
+ // contents as part of the DTD. (upstream: valid; external general and parameter entities are not read;
+ // output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-014", () => {
+ // 3.4 [62] — Test demonstrates the use of the conditional section INCLUDE that will include its
+ // contents as part of the DTD. The keyword is a parameter-entity reference. (upstream: valid; external
+ // general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-015", () => {
+ // 3.4 [63] — Test demonstrates the use of the conditonal section IGNORE the will ignore its content
+ // from being part of the DTD. The keyword is a parameter-entity reference. (upstream: valid; external
+ // general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-016", () => {
+ // 3.4 [62] — Test demonstrates the use of the conditional section INCLUDE that will include its
+ // contents as part of the DTD. The keyword is a parameter-entity reference. (upstream: valid; external
+ // general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-017", () => {
+ // 4.2 [72] — Test demonstrates a parameter entity declaration that contains an attribute list
+ // declaration. (upstream: valid; external general and parameter entities are not read; output depends
+ // on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-018", () => {
+ // 4.2.2 [75] — Test demonstrates an EnternalID whose contents contain an parameter entity declaration
+ // and a attribute list definition. (upstream: valid; external general and parameter entities are not
+ // read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-019", () => {
+ // 4.4.8 — Test demonstrates that a parameter entity will be expanded with spaces on either side.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-020", () => {
+ // 4.4.8 — Parameter entities expand with spaces on either side. (upstream: valid; external general and
+ // parameter entities are not read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-021", () => {
+ // 4.2 [72] — Test demonstrates a parameter entity declaration that contains a partial attribute list
+ // declaration. (upstream: valid; external general and parameter entities are not read; output depends
+ // on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-023", () => {
+ // 2.3 4.1 [10] [69] — Test demonstrates the use of a parameter entity reference within an attribute
+ // list declaration. (upstream: valid; external general and parameter entities are not read; output
+ // depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-024", () => {
+ // 2.8, 4.1 [69] — Constructs an declaration from several PEs. (upstream: valid; external
+ // general and parameter entities are not read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-025", () => {
+ // 4.2 — Test demonstrates that when more that one definition is provided for the same entity only the
+ // first declaration is binding. (upstream: valid; external general and parameter entities are not
+ // read; output depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-026", () => {
+ // 3.3 [52] — Test demonstrates that when more that one definition is provided for the same attribute
+ // of a given element type only the first declaration is binding. (upstream: valid; external general
+ // and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n%e;\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-027", () => {
+ // 4.1 [69] — Test demonstrates a parameter entity reference whose value is NULL. (upstream: valid;
+ // external general and parameter entities are not read)
+ const input: string = '\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-not-sa-028", () => {
+ // 3.4 [62] — Test demonstrates the use of the conditional section INCLUDE that will include its
+ // contents. (upstream: valid; external general and parameter entities are not read; output depends on
+ // them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-029", () => {
+ // 3.4 [62] — Test demonstrates the use of the conditonal section IGNORE the will ignore its content
+ // from being used. (upstream: valid; external general and parameter entities are not read; output
+ // depends on them)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("valid-not-sa-030", () => {
+ // 3.4 [62] — Test demonstrates the use of the conditonal section IGNORE the will ignore its content
+ // from being used. (upstream: valid; external general and parameter entities are not read)
+ const input: string = '\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("valid-not-sa-031", () => {
+ // 2.7 — Expands a general entity which contains a CDATA section with what looks like a markup
+ // declaration (but is just text since it's in a CDATA section). (upstream: valid; external general and
+ // parameter entities are not read; output depends on them)
+ const input: string = '\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-001", () => {
+ // 2.11 — A combination of carriage return line feed in an external entity must be normalized to a
+ // single newline. (upstream: valid; external general and parameter entities are not read; output
+ // depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-002", () => {
+ // 2.11 — A carriage return (also CRLF) in an external entity must be normalized to a single newline.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-003", () => {
+ // 3.1 4.1 [43] [68] — Test demonstrates that the content of an element can be empty. In this case the
+ // external entity is an empty file. (upstream: valid; external general and parameter entities are not
+ // read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-004", () => {
+ // 2.11 — A carriage return (also CRLF) in an external entity must be normalized to a single newline.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-005", () => {
+ // 3.2.1 4.2.2 [48] [75] — Test demonstrates the use of optional character and content particles within
+ // an element content. The test also show the use of external entity. (upstream: valid; external
+ // general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-006", () => {
+ // 2.11 3.2.1 3.2.2 4.2.2 [48] [51] [75] — Test demonstrates the use of optional character and content
+ // particles within mixed element content. The test also shows the use of an external entity and that a
+ // carriage control line feed in an external entity must be normalized to a single newline. (upstream:
+ // valid; external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-007", () => {
+ // 4.2.2 4.4.3 [75] — Test demonstrates the use of external entity and how replacement text is
+ // retrieved and processed. (upstream: valid; external general and parameter entities are not read;
+ // output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\nX&e;Z\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-008", () => {
+ // 4.2.2 4.3.3. 4.4.3 [75] [80] — Test demonstrates the use of external entity and how replacement text
+ // is retrieved and processed. Also tests the use of an EncodingDecl of UTF-16. (upstream: valid;
+ // external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\nX&e;Z\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-009", () => {
+ // 2.11 — A carriage return (also CRLF) in an external entity must be normalized to a single newline.
+ // (upstream: valid; external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-011", () => {
+ // 2.11 4.2.2 [75] — Test demonstrates the use of a public identifier with and external entity. The
+ // test also show that a carriage control line feed combination in an external entity must be
+ // normalized to a single newline. (upstream: valid; external general and parameter entities are not
+ // read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-012", () => {
+ // 4.2.1 4.2.2 — Test demonstrates both internal and external entities and that processing of entity
+ // references may be required to produce the correct replacement text. (upstream: valid; external
+ // general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n&e1;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-013", () => {
+ // 3.3.3 — Test demonstrates that whitespace is handled by adding a single whitespace to the normalized
+ // value in the attribute list. (upstream: valid; external general and parameter entities are not read;
+ // output depends on them)
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&x;\r\n';
+ expectParses(input);
+ });
+
+ test("valid-ext-sa-014", () => {
+ // 4.1 4.4.3 [68] — Test demonstrates use of characters outside of normal ASCII range. (upstream:
+ // valid; external general and parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n&e;\r\n';
+ expectParses(input);
+ });
+});
+
+describe("japanese", () => {
+ test("weekly-euc-jp", () => {
+ // 4.3.3 [4,84] — Test support for EUC-JP encoding, and XML names which contain Japanese characters. If
+ // a processor does not support this encoding, it must report a fatal error. (upstream: optional error)
+ const input = Buffer.from(
+ "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iZXVjLWpwIj8+DQo8IURPQ1RZUEUgvbXK8yBTWVNURU0gIndlZWtseS1ldWMtanAuZHRkIj4NCjwhLS0gvbXK86W1pfOl16XrIC0tPg0KPL21yvM+DQogIDzHr7fuvbU+DQogICAgPMevxdk+MTk5Nzwvx6/F2T4NCiAgICA8t+7F2T4xPC+37sXZPg0KICAgIDy9tT4xPC+9tT4NCiAgPC/Hr7fuvbU+DQoNCiAgPLvhzL4+DQogICAgPLvhPruzxcQ8L7vhPg0KICAgIDzMvj7CwM+6PC/Mvj4NCiAgPC+74cy+Pg0KDQogIDy2yMyzyvO58KXqpbmlyD4NCiAgICA8tsjMs8rzufA+DQogICAgICA8tsjMs8y+PlhNTKWopcelo6W/obykzrruwK48L7bIzLPMvj4NCiAgICAgIDy2yMyzpbOhvKXJPlgzMzU1LTIzPC+2yMyzpbOhvKXJPg0KICAgICAgPLmpv/S0yc39Pg0KICAgICAgICA8uKvA0aTipOq5qb/0PjE2MDA8L7irwNGk4qTquam/9D4NCiAgICAgICAgPLzCwNO5qb/0PjMyMDwvvMLA07mpv/Q+DQogICAgICAgIDzF9rfuuKvA0aTipOq5qb/0PjE2MDwvxfa37rirwNGk4qTquam/9D4NCiAgICAgICAgPMX2t+68wsDTuam/9D4yNDwvxfa37rzCwNO5qb/0Pg0KICAgICAgPC+5qb/0tMnN/T4NCiAgICAgIDzNvcTqueDM3KXqpbmlyD4NCiAgICAgICAgPM29xOq54MzcPg0KICAgICAgICAgIDxQPlhNTKWopcelo6W/obykzrTwy9y7xc3NpM667sCuPC9QPg0KICAgICAgICA8L829xOq54MzcPg0KICAgICAgPC/NvcTqueDM3KXqpbmlyD4NCiAgICAgIDy8wrvcu/a54KXqpbmlyD4NCiAgICAgICAgPLzCu9y79rngPg0KICAgICAgICAgIDxQPlhNTKWopcelo6W/obykzrTwy9y7xc3NpM667sCuPC9QPg0KICAgICAgICA8L7zCu9y79rngPg0KICAgICAgICA8vMK73Lv2ueA+DQogICAgICAgICAgPFA+tqW558K+vNLAvcnKpM61oce9xLS6ujwvUD4NCiAgICAgICAgPC+8wrvcu/a54D4NCiAgICAgIDwvvMK73Lv2ueCl6qW5pcg+DQogICAgICA8vuXEuaTYpM7N18DBu/a54KXqpbmlyD4NCiAgICAgICAgPL7lxLmk2KTOzdfAwbv2ueA+DQogICAgICAgICAgPFA+xsOky6TKpLc8L1A+DQogICAgICAgIDwvvuXEuaTYpM7N18DBu/a54D4NCiAgICAgIDwvvuXEuaTYpM7N18DBu/a54KXqpbmlyD4NCiAgICAgIDzM5MLqxcDC0Lr2Pg0KICAgICAgICA8UD5YTUykyKTPsr+kq6TvpKuk6aTKpKShozwvUD4NCiAgICAgIDwvzOTC6sXAwtC69j4NCiAgICA8L7bIzLPK87nwPg0KDQogICAgPLbIzLPK87nwPg0KICAgICAgPLbIzLPMvj64obr3pail86W4pfOkzrOryK88L7bIzLPMvj4NCiAgICAgIDy2yMyzpbOhvKXJPlM4ODIxLTc2PC+2yMyzpbOhvKXJPg0KICAgICAgPLmpv/S0yc39Pg0KICAgICAgICA8uKvA0aTipOq5qb/0PjEyMDwvuKvA0aTipOq5qb/0Pg0KICAgICAgICA8vMLA07mpv/Q+NjwvvMLA07mpv/Q+DQogICAgICAgIDzF9rfuuKvA0aTipOq5qb/0PjMyPC/F9rfuuKvA0aTipOq5qb/0Pg0KICAgICAgICA8xfa37rzCwNO5qb/0PjI8L8X2t+68wsDTuam/9D4NCiAgICAgIDwvuam/9LTJzf0+DQogICAgICA8zb3E6rngzNyl6qW5pcg+DQogICAgICAgIDzNvcTqueDM3D4NCiAgICAgICAgICA8UD48QSBocmVmPSJodHRwOi8vd3d3Lmdvby5uZS5qcCI+Z29vPC9BPqTOtaHHvaTyxLSk2aTGpN+k6zwvUD4NCiAgICAgICAgPC/NvcTqueDM3D4NCiAgICAgIDwvzb3E6rngzNyl6qW5pcg+DQogICAgICA8vMK73Lv2ueCl6qW5pcg+DQogICAgICAgIDy8wrvcu/a54D4NCiAgICAgICAgICA8UD65uaTLoaKkyaSmpKSkprihuvelqKXzpbil86SspKKk66SrxLS6uqS5pOs8L1A+DQogICAgICAgIDwvvMK73Lv2ueA+DQogICAgICA8L7zCu9y79rngpeqluaXIPg0KICAgICAgPL7lxLmk2KTOzdfAwbv2ueCl6qW5pcg+DQogICAgICAgIDy+5cS5pNikzs3XwMG79rngPg0KICAgICAgICAgIDxQPrOryK+k8qS5pOukzqTPpOGk86TJpKakyqTOpMehollhaG9vIaTyx+O8/aS3pMayvKS1pKShozwvUD4NCiAgICAgICAgPC++5cS5pNikzs3XwMG79rngPg0KICAgICAgPC++5cS5pNikzs3XwMG79rngpeqluaXIPg0KICAgICAgPMzkwurFwMLQuvY+DQogICAgICAgIDxQPrihuvelqKXzpbil86THvNak8sH2pOmku6TrpLOkyKSspMekraTKpKSho6HKzdfEtLq6ocs8L1A+DQogICAgICA8L8zkwurFwMLQuvY+DQogICAgPC+2yMyzyvO58D4NCiAgPC+2yMyzyvO58KXqpbmlyD4NCjwvvbXK8z4NCg==",
+ "base64",
+ );
+ expectRejects(input, "XML Parse error: Unsupported encoding 'euc-jp' (supported: UTF-8, UTF-16, ISO-8859-1)");
+ });
+
+ test("weekly-iso-2022-jp", () => {
+ // 4.3.3 [4,84] — Test support for ISO-2022-JP encoding, and XML names which contain Japanese
+ // characters. If a processor does not support this encoding, it must report a fatal error. (upstream:
+ // optional error)
+ const input = Buffer.from(
+ '\r\n\r\n\r\n<\u001b$B=5Js\u001b(B>\r\n <\u001b$BG/7n=5\u001b(B>\r\n <\u001b$BG/EY\u001b(B>1997\u001b$BG/EY\u001b(B>\r\n <\u001b$B7nEY\u001b(B>1\u001b$B7nEY\u001b(B>\r\n <\u001b$B=5\u001b(B>1\u001b$B=5\u001b(B>\r\n \u001b$BG/7n=5\u001b(B>\r\n\r\n <\u001b$B;aL>\u001b(B>\r\n <\u001b$B;a\u001b(B>\u001b$B;3ED\u001b(B\u001b$B;a\u001b(B>\r\n <\u001b$BL>\u001b(B>\u001b$BB@O:\u001b(B\u001b$BL>\u001b(B>\r\n \u001b$B;aL>\u001b(B>\r\n\r\n <\u001b$B6HL3Js9p%j%9%H\u001b(B>\r\n <\u001b$B6HL3Js9p\u001b(B>\r\n <\u001b$B6HL3L>\u001b(B>XML\u001b$B%(%G%#%?!<$N:n@.\u001b(B\u001b$B6HL3L>\u001b(B>\r\n <\u001b$B6HL3%3!<%I\u001b(B>X3355-23\u001b$B6HL3%3!<%I\u001b(B>\r\n <\u001b$B9)?t4IM}\u001b(B>\r\n <\u001b$B8+@Q$b$j9)?t\u001b(B>1600\u001b$B8+@Q$b$j9)?t\u001b(B>\r\n <\u001b$B320\u001b$B\r\n <\u001b$BEv7n8+@Q$b$j9)?t\u001b(B>160\u001b$BEv7n8+@Q$b$j9)?t\u001b(B>\r\n <\u001b$BEv7n24\u001b$BEv7n\r\n \u001b$B9)?t4IM}\u001b(B>\r\n <\u001b$BM=Dj9`L\\%j%9%H\u001b(B>\r\n <\u001b$BM=Dj9`L\\\u001b(B>\r\n XML\u001b$B%(%G%#%?!<$N4pK\\;EMM$N:n@.\u001b(B
\r\n \u001b$BM=Dj9`L\\\u001b(B>\r\n \u001b$BM=Dj9`L\\%j%9%H\u001b(B>\r\n <\u001b$B\r\n <\u001b$B\r\n XML\u001b$B%(%G%#%?!<$N4pK\\;EMM$N:n@.\u001b(B
\r\n \u001b$B\r\n <\u001b$B\r\n \u001b$B6%9gB>\r\n \u001b$B\r\n \u001b$B\r\n <\u001b$B>eD9$X$NMW@A;v9`%j%9%H\u001b(B>\r\n <\u001b$B>eD9$X$NMW@A;v9`\u001b(B>\r\n \u001b$BFC$K$J$7\u001b(B
\r\n \u001b$B>eD9$X$NMW@A;v9`\u001b(B>\r\n \u001b$B>eD9$X$NMW@A;v9`%j%9%H\u001b(B>\r\n <\u001b$BLdBjE@BP:v\u001b(B>\r\n XML\u001b$B$H$O2?$+$o$+$i$J$$!#\u001b(B
\r\n \u001b$BLdBjE@BP:v\u001b(B>\r\n \u001b$B6HL3Js9p\u001b(B>\r\n\r\n <\u001b$B6HL3Js9p\u001b(B>\r\n <\u001b$B6HL3L>\u001b(B>\u001b$B8!:w%(%s%8%s$N3+H/\u001b(B\u001b$B6HL3L>\u001b(B>\r\n <\u001b$B6HL3%3!<%I\u001b(B>S8821-76\u001b$B6HL3%3!<%I\u001b(B>\r\n <\u001b$B9)?t4IM}\u001b(B>\r\n <\u001b$B8+@Q$b$j9)?t\u001b(B>120\u001b$B8+@Q$b$j9)?t\u001b(B>\r\n <\u001b$B6\u001b$B\r\n <\u001b$BEv7n8+@Q$b$j9)?t\u001b(B>32\u001b$BEv7n8+@Q$b$j9)?t\u001b(B>\r\n <\u001b$BEv7n2\u001b$BEv7n\r\n \u001b$B9)?t4IM}\u001b(B>\r\n <\u001b$BM=Dj9`L\\%j%9%H\u001b(B>\r\n <\u001b$BM=Dj9`L\\\u001b(B>\r\n goo\u001b$B$N5!G=$rD4$Y$F$_$k\u001b(B
\r\n \u001b$BM=Dj9`L\\\u001b(B>\r\n \u001b$BM=Dj9`L\\%j%9%H\u001b(B>\r\n <\u001b$B\r\n <\u001b$B\r\n \u001b$B99$K!"$I$&$$$&8!:w%(%s%8%s$,$"$k$+D4::$9$k\u001b(B
\r\n \u001b$B\r\n \u001b$B\r\n <\u001b$B>eD9$X$NMW@A;v9`%j%9%H\u001b(B>\r\n <\u001b$B>eD9$X$NMW@A;v9`\u001b(B>\r\n \u001b$B3+H/$r$9$k$N$O$a$s$I$&$J$N$G!"\u001b(BYahoo!\u001b$B$rGc<}$7$F2<$5$$!#\u001b(B
\r\n \u001b$B>eD9$X$NMW@A;v9`\u001b(B>\r\n \u001b$B>eD9$X$NMW@A;v9`%j%9%H\u001b(B>\r\n <\u001b$BLdBjE@BP:v\u001b(B>\r\n \u001b$B8!:w%(%s%8%s$G\r\n \u001b$BLdBjE@BP:v\u001b(B>\r\n \u001b$B6HL3Js9p\u001b(B>\r\n \u001b$B6HL3Js9p%j%9%H\u001b(B>\r\n\u001b$B=5Js\u001b(B>\r\n',
+ );
+ expectRejects(input, "XML Parse error: Unsupported encoding 'iso-2022-jp' (supported: UTF-8, UTF-16, ISO-8859-1)");
+ });
+
+ test("weekly-little", () => {
+ // 4.3.3 [4,84] — Test support for little-endian UTF-16 encoding, and XML names which contain Japanese
+ // characters. (upstream: valid; external parameter entities are not read)
+ const input = Buffer.from(
+ "//48AD8AeABtAGwAIAB2AGUAcgBzAGkAbwBuAD0AIgAxAC4AMAAiAD8APgANAAoAPAAhAEQATwBDAFQAWQBQAEUAIAAxkDFYIABTAFkAUwBUAEUATQAgACIAdwBlAGUAawBsAHkALQB1AHQAZgAtADEANgAuAGQAdABkACIAPgANAAoAPAAhAC0ALQAgADGQMVi1MPMw1zDrMCAALQAtAD4ADQAKADwAMZAxWD4ADQAKACAAIAA8AHReCGcxkD4ADQAKACAAIAAgACAAPAB0XqZePgAxADkAOQA3ADwALwB0XqZePgANAAoAIAAgACAAIAA8AAhnpl4+ADEAPAAvAAhnpl4+AA0ACgAgACAAIAAgADwAMZA+ADEAPAAvADGQPgANAAoAIAAgADwALwB0XghnMZA+AA0ACgANAAoAIAAgADwAD2wNVD4ADQAKACAAIAAgACAAPAAPbD4AcVwwdTwALwAPbD4ADQAKACAAIAAgACAAPAANVD4AKlnOkDwALwANVD4ADQAKACAAIAA8AC8AD2wNVD4ADQAKAA0ACgAgACAAPABtadlSMVhKVOowuTDIMD4ADQAKACAAIAAgACAAPABtadlSMVhKVD4ADQAKACAAIAAgACAAIAAgADwAbWnZUg1UPgBYAE0ATACoMMcwozC/MPwwbjBcTxBiPAAvAG1p2VINVD4ADQAKACAAIAAgACAAIAAgADwAbWnZUrMw/DDJMD4AWAAzADMANQA1AC0AMgAzADwALwBtadlSszD8MMkwPgANAAoAIAAgACAAIAAgACAAPADlXXBloXsGdD4ADQAKACAAIAAgACAAIAAgACAAIAA8AIuJTXqCMIow5V1wZT4AMQA2ADAAMAA8AC8Ai4lNeoIwijDlXXBlPgANAAoAIAAgACAAIAAgACAAIAAgADwAn1s+fuVdcGU+ADMAMgAwADwALwCfWz5+5V1wZT4ADQAKACAAIAAgACAAIAAgACAAIAA8AFNfCGeLiU16gjCKMOVdcGU+ADEANgAwADwALwBTXwhni4lNeoIwijDlXXBlPgANAAoAIAAgACAAIAAgACAAIAAgADwAU18IZ59bPn7lXXBlPgAyADQAPAAvAFNfCGefWz5+5V1wZT4ADQAKACAAIAAgACAAIAAgADwALwDlXXBloXsGdD4ADQAKACAAIAAgACAAIAAgADwAiE6aWwWY7nbqMLkwyDA+AA0ACgAgACAAIAAgACAAIAAgACAAPACITppbBZjudj4ADQAKACAAIAAgACAAIAAgACAAIAAgACAAPABQAD4AWABNAEwAqDDHMKMwvzD8MG4w+lcsZ9VO2GluMFxPEGI8AC8AUAA+AA0ACgAgACAAIAAgACAAIAAgACAAPAAvAIhOmlsFmO52PgANAAoAIAAgACAAIAAgACAAPAAvAIhOmlsFmO526jC5MMgwPgANAAoAIAAgACAAIAAgACAAPACfW71li04FmOowuTDIMD4ADQAKACAAIAAgACAAIAAgACAAIAA8AJ9bvWWLTgWYPgANAAoAIAAgACAAIAAgACAAIAAgACAAIAA8AFAAPgBYAE0ATACoMMcwozC/MPwwbjD6Vyxn1U7YaW4wXE8QYjwALwBQAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AC8An1u9ZYtOBZg+AA0ACgAgACAAIAAgACAAIAAgACAAPACfW71li04FmD4ADQAKACAAIAAgACAAIAAgACAAIAAgACAAPABQAD4A9noIVNZOPnn9iMFUbjBfav2Av4r7ZzwALwBQAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AC8An1u9ZYtOBZg+AA0ACgAgACAAIAAgACAAIAA8AC8An1u9ZYtOBZjqMLkwyDA+AA0ACgAgACAAIAAgACAAIAA8AApOd5V4MG4wgYnLiotOBZjqMLkwyDA+AA0ACgAgACAAIAAgACAAIAAgACAAPAAKTneVeDBuMIGJy4qLTgWYPgANAAoAIAAgACAAIAAgACAAIAAgACAAIAA8AFAAPgB5cmswajBXMDwALwBQAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AC8ACk53lXgwbjCBicuKi04FmD4ADQAKACAAIAAgACAAIAAgADwALwAKTneVeDBuMIGJy4qLTgWY6jC5MMgwPgANAAoAIAAgACAAIAAgACAAPABPVUyYuXD+W1Z7PgANAAoAIAAgACAAIAAgACAAIAAgADwAUAA+AFgATQBMAGgwbzBVT0swjzBLMIkwajBEMAIwPAAvAFAAPgANAAoAIAAgACAAIAAgACAAPAAvAE9VTJi5cP5bVns+AA0ACgAgACAAIAAgADwALwBtadlSMVhKVD4ADQAKAA0ACgAgACAAIAAgADwAbWnZUjFYSlQ+AA0ACgAgACAAIAAgACAAIAA8AG1p2VINVD4AHGkifagw8zC4MPMwbjCLlXp2PAAvAG1p2VINVD4ADQAKACAAIAAgACAAIAAgADwAbWnZUrMw/DDJMD4AUwA4ADgAMgAxAC0ANwA2ADwALwBtadlSszD8MMkwPgANAAoAIAAgACAAIAAgACAAPADlXXBloXsGdD4ADQAKACAAIAAgACAAIAAgACAAIAA8AIuJTXqCMIow5V1wZT4AMQAyADAAPAAvAIuJTXqCMIow5V1wZT4ADQAKACAAIAAgACAAIAAgACAAIAA8AJ9bPn7lXXBlPgA2ADwALwCfWz5+5V1wZT4ADQAKACAAIAAgACAAIAAgACAAIAA8AFNfCGeLiU16gjCKMOVdcGU+ADMAMgA8AC8AU18IZ4uJTXqCMIow5V1wZT4ADQAKACAAIAAgACAAIAAgACAAIAA8AFNfCGefWz5+5V1wZT4AMgA8AC8AU18IZ59bPn7lXXBlPgANAAoAIAAgACAAIAAgACAAPAAvAOVdcGWhewZ0PgANAAoAIAAgACAAIAAgACAAPACITppbBZjuduowuTDIMD4ADQAKACAAIAAgACAAIAAgACAAIAA8AIhOmlsFmO52PgANAAoAIAAgACAAIAAgACAAIAAgACAAIAA8AFAAPgA8AEEAIABoAHIAZQBmAD0AIgBoAHQAdABwADoALwAvAHcAdwB3AC4AZwBvAG8ALgBuAGUALgBqAHAAIgA+AGcAbwBvADwALwBBAD4AbjBfav2AkjC/inkwZjB/MIswPAAvAFAAPgANAAoAIAAgACAAIAAgACAAIAAgADwALwCITppbBZjudj4ADQAKACAAIAAgACAAIAAgADwALwCITppbBZjuduowuTDIMD4ADQAKACAAIAAgACAAIAAgADwAn1u9ZYtOBZjqMLkwyDA+AA0ACgAgACAAIAAgACAAIAAgACAAPACfW71li04FmD4ADQAKACAAIAAgACAAIAAgACAAIAAgACAAPABQAD4A9GZrMAEwaTBGMEQwRjAcaSJ9qDDzMLgw8zBMMEIwizBLML+K+2dZMIswPAAvAFAAPgANAAoAIAAgACAAIAAgACAAIAAgADwALwCfW71li04FmD4ADQAKACAAIAAgACAAIAAgADwALwCfW71li04FmOowuTDIMD4ADQAKACAAIAAgACAAIAAgADwACk53lXgwbjCBicuKi04FmOowuTDIMD4ADQAKACAAIAAgACAAIAAgACAAIAA8AApOd5V4MG4wgYnLiotOBZg+AA0ACgAgACAAIAAgACAAIAAgACAAIAAgADwAUAA+AIuVenaSMFkwizBuMG8wgTCTMGkwRjBqMG4wZzABMFkAYQBoAG8AbwAhAJIwt4zOU1cwZjALTlUwRDACMDwALwBQAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AC8ACk53lXgwbjCBicuKi04FmD4ADQAKACAAIAAgACAAIAAgADwALwAKTneVeDBuMIGJy4qLTgWY6jC5MMgwPgANAAoAIAAgACAAIAAgACAAPABPVUyYuXD+W1Z7PgANAAoAIAAgACAAIAAgACAAIAAgADwAUAA+ABxpIn2oMPMwuDDzMGcwyo6SMHCNiTBbMIswUzBoMEwwZzBNMGowRDACMAj/gYm/ivtnCf88AC8AUAA+AA0ACgAgACAAIAAgACAAIAA8AC8AT1VMmLlw/ltWez4ADQAKACAAIAAgACAAPAAvAG1p2VIxWEpUPgANAAoAIAAgADwALwBtadlSMVhKVOowuTDIMD4ADQAKADwALwAxkDFYPgANAAoA",
+ "base64",
+ );
+ expectParses(input);
+ });
+
+ test("weekly-shift_jis", () => {
+ // 4.3.3 [4,84] — Test support for Shift_JIS encoding, and XML names which contain Japanese characters.
+ // If a processor does not support this encoding, it must report a fatal error. (upstream: optional
+ // error)
+ const input = Buffer.from(
+ "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iU2hpZnRfSklTIj8+DQo8IURPQ1RZUEUgj1SV8SBTWVNURU0gIndlZWtseS1zaGlmdF9qaXMuZHRkIj4NCjwhLS0gj1SV8YNUg5ODdoOLIC0tPg0KPI9UlfE+DQogIDyUToyOj1Q+DQogICAgPJROk3g+MTk5NzwvlE6TeD4NCiAgICA8jI6TeD4xPC+MjpN4Pg0KICAgIDyPVD4xPC+PVD4NCiAgPC+UToyOj1Q+DQoNCiAgPI6Blrw+DQogICAgPI6BPo5Sk2M8L46BPg0KICAgIDyWvD6RvphZPC+WvD4NCiAgPC+OgZa8Pg0KDQogIDyLxpaxlfGNkIOKg1iDZz4NCiAgICA8i8aWsZXxjZA+DQogICAgICA8i8aWsZa8PlhNTINHg2aDQoNegVuCzI3skKw8L4vGlrGWvD4NCiAgICAgIDyLxpaxg1KBW4NoPlgzMzU1LTIzPC+Lxpaxg1KBW4NoPg0KICAgICAgPI1IkJSKx5edPg0KICAgICAgICA8jKmQz4LgguiNSJCUPjE2MDA8L4ypkM+C4ILojUiQlD4NCiAgICAgICAgPI7AkNGNSJCUPjMyMDwvjsCQ0Y1IkJQ+DQogICAgICAgIDyTloyOjKmQz4LgguiNSJCUPjE2MDwvk5aMjoypkM+C4ILojUiQlD4NCiAgICAgICAgPJOWjI6OwJDRjUiQlD4yNDwvk5aMjo7AkNGNSJCUPg0KICAgICAgPC+NSJCUiseXnT4NCiAgICAgIDyXXJLojYCW2oOKg1iDZz4NCiAgICAgICAgPJdckuiNgJbaPg0KICAgICAgICAgIDxQPlhNTINHg2aDQoNegVuCzIrulnuOZJdsgsyN7JCsPC9QPg0KICAgICAgICA8L5dckuiNgJbaPg0KICAgICAgPC+XXJLojYCW2oOKg1iDZz4NCiAgICAgIDyOwI57jpaNgIOKg1iDZz4NCiAgICAgICAgPI7AjnuOlo2APg0KICAgICAgICAgIDxQPlhNTINHg2aDQoNegVuCzIrulnuOZJdsgsyN7JCsPC9QPg0KICAgICAgICA8L47AjnuOlo2APg0KICAgICAgICA8jsCOe46WjYA+DQogICAgICAgICAgPFA+i6ONh5G8jtCQu5VpgsyLQJRckrKNuDwvUD4NCiAgICAgICAgPC+OwI57jpaNgD4NCiAgICAgIDwvjsCOe46WjYCDioNYg2c+DQogICAgICA8j+OSt4LWgsyXdpC/jpaNgIOKg1iDZz4NCiAgICAgICAgPI/jkreC1oLMl3aQv46WjYA+DQogICAgICAgICAgPFA+k8GCyYLIgrU8L1A+DQogICAgICAgIDwvj+OSt4LWgsyXdpC/jpaNgD4NCiAgICAgIDwvj+OSt4LWgsyXdpC/jpaNgIOKg1iDZz4NCiAgICAgIDyW4pHok1+Rzo30Pg0KICAgICAgICA8UD5YTUyCxoLNib2CqYLtgqmC54LIgqKBQjwvUD4NCiAgICAgIDwvluKR6JNfkc6N9D4NCiAgICA8L4vGlrGV8Y2QPg0KDQogICAgPIvGlrGV8Y2QPg0KICAgICAgPIvGlrGWvD6Mn431g0eDk4NXg5OCzIpKlK08L4vGlrGWvD4NCiAgICAgIDyLxpaxg1KBW4NoPlM4ODIxLTc2PC+Lxpaxg1KBW4NoPg0KICAgICAgPI1IkJSKx5edPg0KICAgICAgICA8jKmQz4LgguiNSJCUPjEyMDwvjKmQz4LgguiNSJCUPg0KICAgICAgICA8jsCQ0Y1IkJQ+NjwvjsCQ0Y1IkJQ+DQogICAgICAgIDyTloyOjKmQz4LgguiNSJCUPjMyPC+TloyOjKmQz4LgguiNSJCUPg0KICAgICAgICA8k5aMjo7AkNGNSJCUPjI8L5OWjI6OwJDRjUiQlD4NCiAgICAgIDwvjUiQlIrHl50+DQogICAgICA8l1yS6I2AltqDioNYg2c+DQogICAgICAgIDyXXJLojYCW2j4NCiAgICAgICAgICA8UD48QSBocmVmPSJodHRwOi8vd3d3Lmdvby5uZS5qcCI+Z29vPC9BPoLMi0CUXILwkrKC14LEgt2C6TwvUD4NCiAgICAgICAgPC+XXJLojYCW2j4NCiAgICAgIDwvl1yS6I2AltqDioNYg2c+DQogICAgICA8jsCOe46WjYCDioNYg2c+DQogICAgICAgIDyOwI57jpaNgD4NCiAgICAgICAgICA8UD6NWILJgUGCx4KkgqKCpIyfjfWDR4OTg1eDk4KqgqCC6YKpkrKNuIK3guk8L1A+DQogICAgICAgIDwvjsCOe46WjYA+DQogICAgICA8L47AjnuOlo2Ag4qDWINnPg0KICAgICAgPI/jkreC1oLMl3aQv46WjYCDioNYg2c+DQogICAgICAgIDyP45K3gtaCzJd2kL+Olo2APg0KICAgICAgICAgIDxQPopKlK2C8IK3gumCzILNgt+C8YLHgqSCyILMgsWBQVlhaG9vIYLwlIOO+4K1gsSJuoKzgqKBQjwvUD4NCiAgICAgICAgPC+P45K3gtaCzJd2kL+Olo2APg0KICAgICAgPC+P45K3gtaCzJd2kL+Olo2Ag4qDWINnPg0KICAgICAgPJbikeiTX5HOjfQ+DQogICAgICAgIDxQPoyfjfWDR4OTg1eDk4LFjtSC8JGWgueCuYLpgrGCxoKqgsWCq4LIgqKBQoFpl3aSso24gWo8L1A+DQogICAgICA8L5bikeiTX5HOjfQ+DQogICAgPC+LxpaxlfGNkD4NCiAgPC+LxpaxlfGNkIOKg1iDZz4NCjwvj1SV8T4NCg==",
+ "base64",
+ );
+ expectRejects(input, "XML Parse error: Unsupported encoding 'Shift_JIS' (supported: UTF-8, UTF-16, ISO-8859-1)");
+ });
+
+ test("weekly-utf-16", () => {
+ // 4.3.3 [4,84] — Test support for UTF-16 encoding, and XML names which contain Japanese characters.
+ // (upstream: valid; external parameter entities are not read)
+ const input = Buffer.from(
+ "/v8APAA/AHgAbQBsACAAdgBlAHIAcwBpAG8AbgA9ACIAMQAuADAAIgA/AD4ADQAKADwAIQBEAE8AQwBUAFkAUABFACCQMVgxACAAUwBZAFMAVABFAE0AIAAiAHcAZQBlAGsAbAB5AC0AdQB0AGYALQAxADYALgBkAHQAZAAiAD4ADQAKADwAIQAtAC0AIJAxWDEwtTDzMNcw6wAgAC0ALQA+AA0ACgA8kDFYMQA+AA0ACgAgACAAPF50ZwiQMQA+AA0ACgAgACAAIAAgADxedF6mAD4AMQA5ADkANwA8AC9edF6mAD4ADQAKACAAIAAgACAAPGcIXqYAPgAxADwAL2cIXqYAPgANAAoAIAAgACAAIAA8kDEAPgAxADwAL5AxAD4ADQAKACAAIAA8AC9edGcIkDEAPgANAAoADQAKACAAIAA8bA9UDQA+AA0ACgAgACAAIAAgADxsDwA+XHF1MAA8AC9sDwA+AA0ACgAgACAAIAAgADxUDQA+WSqQzgA8AC9UDQA+AA0ACgAgACAAPAAvbA9UDQA+AA0ACgANAAoAIAAgADxpbVLZWDFUSjDqMLkwyAA+AA0ACgAgACAAIAAgADxpbVLZWDFUSgA+AA0ACgAgACAAIAAgACAAIAA8aW1S2VQNAD4AWABNAEwwqDDHMKMwvzD8MG5PXGIQADwAL2ltUtlUDQA+AA0ACgAgACAAIAAgACAAIAA8aW1S2TCzMPwwyQA+AFgAMwAzADUANQAtADIAMwA8AC9pbVLZMLMw/DDJAD4ADQAKACAAIAAgACAAIAAgADxd5WVwe6F0BgA+AA0ACgAgACAAIAAgACAAIAAgACAAPImLek0wgjCKXeVlcAA+ADEANgAwADAAPAAviYt6TTCCMIpd5WVwAD4ADQAKACAAIAAgACAAIAAgACAAIAA8W59+Pl3lZXAAPgAzADIAMAA8AC9bn34+XeVlcAA+AA0ACgAgACAAIAAgACAAIAAgACAAPF9TZwiJi3pNMIIwil3lZXAAPgAxADYAMAA8AC9fU2cIiYt6TTCCMIpd5WVwAD4ADQAKACAAIAAgACAAIAAgACAAIAA8X1NnCFuffj5d5WVwAD4AMgA0ADwAL19TZwhbn34+XeVlcAA+AA0ACgAgACAAIAAgACAAIAA8AC9d5WVwe6F0BgA+AA0ACgAgACAAIAAgACAAIAA8TohbmpgFdu4w6jC5MMgAPgANAAoAIAAgACAAIAAgACAAIAAgADxOiFuamAV27gA+AA0ACgAgACAAIAAgACAAIAAgACAAIAAgADwAUAA+AFgATQBMMKgwxzCjML8w/DBuV/pnLE7Vadgwbk9cYhAAPAAvAFAAPgANAAoAIAAgACAAIAAgACAAIAAgADwAL06IW5qYBXbuAD4ADQAKACAAIAAgACAAIAAgADwAL06IW5qYBXbuMOowuTDIAD4ADQAKACAAIAAgACAAIAAgADxbn2W9TouYBTDqMLkwyAA+AA0ACgAgACAAIAAgACAAIAAgACAAPFufZb1Oi5gFAD4ADQAKACAAIAAgACAAIAAgACAAIAAgACAAPABQAD4AWABNAEwwqDDHMKMwvzD8MG5X+mcsTtVp2DBuT1xiEAA8AC8AUAA+AA0ACgAgACAAIAAgACAAIAAgACAAPAAvW59lvU6LmAUAPgANAAoAIAAgACAAIAAgACAAIAAgADxbn2W9TouYBQA+AA0ACgAgACAAIAAgACAAIAAgACAAIAAgADwAUAA+evZUCE7WeT6I/VTBMG5qX4D9ir9n+wA8AC8AUAA+AA0ACgAgACAAIAAgACAAIAAgACAAPAAvW59lvU6LmAUAPgANAAoAIAAgACAAIAAgACAAPAAvW59lvU6LmAUw6jC5MMgAPgANAAoAIAAgACAAIAAgACAAPE4KlXcweDBuiYGKy06LmAUw6jC5MMgAPgANAAoAIAAgACAAIAAgACAAIAAgADxOCpV3MHgwbomBistOi5gFAD4ADQAKACAAIAAgACAAIAAgACAAIAAgACAAPABQAD5yeTBrMGowVwA8AC8AUAA+AA0ACgAgACAAIAAgACAAIAAgACAAPAAvTgqVdzB4MG6JgYrLTouYBQA+AA0ACgAgACAAIAAgACAAIAA8AC9OCpV3MHgwbomBistOi5gFMOowuTDIAD4ADQAKACAAIAAgACAAIAAgADxVT5hMcLlb/ntWAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AFAAPgBYAE0ATDBoMG9PVTBLMI8wSzCJMGowRDACADwALwBQAD4ADQAKACAAIAAgACAAIAAgADwAL1VPmExwuVv+e1YAPgANAAoAIAAgACAAIAA8AC9pbVLZWDFUSgA+AA0ACgANAAoAIAAgACAAIAA8aW1S2VgxVEoAPgANAAoAIAAgACAAIAAgACAAPGltUtlUDQA+aRx9IjCoMPMwuDDzMG6Vi3Z6ADwAL2ltUtlUDQA+AA0ACgAgACAAIAAgACAAIAA8aW1S2TCzMPwwyQA+AFMAOAA4ADIAMQAtADcANgA8AC9pbVLZMLMw/DDJAD4ADQAKACAAIAAgACAAIAAgADxd5WVwe6F0BgA+AA0ACgAgACAAIAAgACAAIAAgACAAPImLek0wgjCKXeVlcAA+ADEAMgAwADwAL4mLek0wgjCKXeVlcAA+AA0ACgAgACAAIAAgACAAIAAgACAAPFuffj5d5WVwAD4ANgA8AC9bn34+XeVlcAA+AA0ACgAgACAAIAAgACAAIAAgACAAPF9TZwiJi3pNMIIwil3lZXAAPgAzADIAPAAvX1NnCImLek0wgjCKXeVlcAA+AA0ACgAgACAAIAAgACAAIAAgACAAPF9TZwhbn34+XeVlcAA+ADIAPAAvX1NnCFuffj5d5WVwAD4ADQAKACAAIAAgACAAIAAgADwAL13lZXB7oXQGAD4ADQAKACAAIAAgACAAIAAgADxOiFuamAV27jDqMLkwyAA+AA0ACgAgACAAIAAgACAAIAAgACAAPE6IW5qYBXbuAD4ADQAKACAAIAAgACAAIAAgACAAIAAgACAAPABQAD4APABBACAAaAByAGUAZgA9ACIAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGcAbwBvAC4AbgBlAC4AagBwACIAPgBnAG8AbwA8AC8AQQA+MG5qX4D9MJKKvzB5MGYwfzCLADwALwBQAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AC9OiFuamAV27gA+AA0ACgAgACAAIAAgACAAIAA8AC9OiFuamAV27jDqMLkwyAA+AA0ACgAgACAAIAAgACAAIAA8W59lvU6LmAUw6jC5MMgAPgANAAoAIAAgACAAIAAgACAAIAAgADxbn2W9TouYBQA+AA0ACgAgACAAIAAgACAAIAAgACAAIAAgADwAUAA+ZvQwazABMGkwRjBEMEZpHH0iMKgw8zC4MPMwTDBCMIswS4q/Z/swWTCLADwALwBQAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AC9bn2W9TouYBQA+AA0ACgAgACAAIAAgACAAIAA8AC9bn2W9TouYBTDqMLkwyAA+AA0ACgAgACAAIAAgACAAIAA8TgqVdzB4MG6JgYrLTouYBTDqMLkwyAA+AA0ACgAgACAAIAAgACAAIAAgACAAPE4KlXcweDBuiYGKy06LmAUAPgANAAoAIAAgACAAIAAgACAAIAAgACAAIAA8AFAAPpWLdnowkjBZMIswbjBvMIEwkzBpMEYwajBuMGcwAQBZAGEAaABvAG8AITCSjLdTzjBXMGZOCzBVMEQwAgA8AC8AUAA+AA0ACgAgACAAIAAgACAAIAAgACAAPAAvTgqVdzB4MG6JgYrLTouYBQA+AA0ACgAgACAAIAAgACAAIAA8AC9OCpV3MHgwbomBistOi5gFMOowuTDIAD4ADQAKACAAIAAgACAAIAAgADxVT5hMcLlb/ntWAD4ADQAKACAAIAAgACAAIAAgACAAIAA8AFAAPmkcfSIwqDDzMLgw8zBnjsowko1wMIkwWzCLMFMwaDBMMGcwTTBqMEQwAv8IiYGKv2f7/wkAPAAvAFAAPgANAAoAIAAgACAAIAAgACAAPAAvVU+YTHC5W/57VgA+AA0ACgAgACAAIAAgADwAL2ltUtlYMVRKAD4ADQAKACAAIAA8AC9pbVLZWDFUSjDqMLkwyAA+AA0ACgA8AC+QMVgxAD4ADQAK",
+ "base64",
+ );
+ expectParses(input);
+ });
+
+ test("weekly-utf-8", () => {
+ // 4.3.3 [4,84] — Test support for UTF-8 encoding and XML names which contain Japanese characters.
+ // (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n<週報>\r\n <年月週>\r\n <年度>1997年度>\r\n <月度>1月度>\r\n <週>1週>\r\n 年月週>\r\n\r\n <氏名>\r\n <氏>山田氏>\r\n <名>太郎名>\r\n 氏名>\r\n\r\n <業務報告リスト>\r\n <業務報告>\r\n <業務名>XMLエディターの作成業務名>\r\n <業務コード>X3355-23業務コード>\r\n <工数管理>\r\n <見積もり工数>1600見積もり工数>\r\n <実績工数>320実績工数>\r\n <当月見積もり工数>160当月見積もり工数>\r\n <当月実績工数>24当月実績工数>\r\n 工数管理>\r\n <予定項目リスト>\r\n <予定項目>\r\n XMLエディターの基本仕様の作成
\r\n 予定項目>\r\n 予定項目リスト>\r\n <実施事項リスト>\r\n <実施事項>\r\n XMLエディターの基本仕様の作成
\r\n 実施事項>\r\n <実施事項>\r\n 競合他社製品の機能調査
\r\n 実施事項>\r\n 実施事項リスト>\r\n <上長への要請事項リスト>\r\n <上長への要請事項>\r\n 特になし
\r\n 上長への要請事項>\r\n 上長への要請事項リスト>\r\n <問題点対策>\r\n XMLとは何かわからない。
\r\n 問題点対策>\r\n 業務報告>\r\n\r\n <業務報告>\r\n <業務名>検索エンジンの開発業務名>\r\n <業務コード>S8821-76業務コード>\r\n <工数管理>\r\n <見積もり工数>120見積もり工数>\r\n <実績工数>6実績工数>\r\n <当月見積もり工数>32当月見積もり工数>\r\n <当月実績工数>2当月実績工数>\r\n 工数管理>\r\n <予定項目リスト>\r\n <予定項目>\r\n gooの機能を調べてみる
\r\n 予定項目>\r\n 予定項目リスト>\r\n <実施事項リスト>\r\n <実施事項>\r\n 更に、どういう検索エンジンがあるか調査する
\r\n 実施事項>\r\n 実施事項リスト>\r\n <上長への要請事項リスト>\r\n <上長への要請事項>\r\n 開発をするのはめんどうなので、Yahoo!を買収して下さい。
\r\n 上長への要請事項>\r\n 上長への要請事項リスト>\r\n <問題点対策>\r\n 検索エンジンで車を走らせることができない。(要調査)
\r\n 問題点対策>\r\n 業務報告>\r\n 業務報告リスト>\r\n週報>\r\n';
+ expectParses(input);
+ });
+});
+
+describe("sun", () => {
+ test("pe01", () => {
+ // 2.8 — Parameter entities references are NOT RECOGNIZED in default attribute values. (upstream:
+ // valid; external parameter entities are not read)
+ const input: string = '\n\n';
+ expectParses(input);
+ });
+
+ test("dtd00", () => {
+ // 3.2.2 [51] — Tests parsing of alternative forms of text-only mixed content declaration.
+ const input: string =
+ "\n \n \n]>\n\n\n";
+ const canonical = "";
+ const compact: unknown = { root: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("dtd01", () => {
+ // 2.5 [15] — Comments don't get parameter entity expansion
+ const input: string =
+ '\n \n \n]>\n\n';
+ const canonical = "";
+ const compact: unknown = { root: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("element", () => {
+ // 3 — Tests clauses 1, 3, and 4 of the Element Valid validity constraint.
+ const input: string =
+ "\n\n\n\n\n]>\n\n\n \n\n \n \n\n \n \n\n \n \n\n allowed\n ]]>\n\n also\n ]]>\n\n moreover\n\n allowed & stuff\n\n also\n\n moreover \n moreover \n \n too\n\n\n";
+ const canonical =
+ "
allowed
<allowed>
also
<% illegal otherwise %>
moreover
allowed & stuff
also
moreover
moreover
too
";
+ const compact: unknown = {
+ root: {
+ empty: "",
+ mixed1: ["", "", "allowed", "", "allowed & stuff"],
+ mixed2: ["", "", "also", "<% illegal otherwise %>", "also"],
+ mixed3: [
+ "",
+ "",
+ "moreover",
+ { empty: "", "#text": "moreover" },
+ { empty: "", "#text": "moreover" },
+ { empty: "" },
+ { empty: "", "#text": "too" },
+ ],
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ext01", () => {
+ // 4.3.1 4.3.2 [77] [78] — Tests use of external parsed entities with and without content. (upstream:
+ // valid; external general entities are not read; output depends on them)
+ const input: string =
+ '\n\n\n\n\n\n]>\n &root; &root; &null; &null; \n';
+ expectParses(input);
+ });
+
+ test("ext02", () => {
+ // 4.3.2 [78] — Tests use of external parsed entities with different encodings than the base document.
+ // (upstream: valid; external general entities are not read; output depends on them)
+ const input: string =
+ '\n\n\n\n]>\n\n &utf16b; &utf16l; \n';
+ expectParses(input);
+ });
+
+ test("not-sa01", () => {
+ // 2.9 — A non-standalone document is valid if declared as such. (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ "\n\n\n\n\n \n The whitespace before and after this element keeps\n this from being standalone.\n \n\n";
+ const canonical =
+ "
The whitespace before and after this element keeps
this from being standalone.
";
+ const compact: unknown = {
+ root: {
+ child: "The whitespace before and after this element keeps\n this from being standalone.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("not-sa02", () => {
+ // 2.9 — A non-standalone document is valid if declared as such. (upstream: valid; external parameter
+ // entities are not read; output depends on them)
+ const input: string =
+ '\n\n\n]>\n\n \n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("not-sa03", () => {
+ // 2.9 — A non-standalone document is valid if declared as such. (upstream: valid; external parameter
+ // entities are not read; output depends on them)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("not-sa04", () => {
+ // 2.9 — A non-standalone document is valid if declared as such. (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ '\n\n\n\n \n \n \n]>\n\n\n\n\n';
+ const canonical =
+ '';
+ const compact: unknown = {
+ attributes: {
+ "@cdata": "nothing happens to this one!",
+ "@entities": "unparsed-1 unparsed-2",
+ "@entity": "unparsed-1",
+ "@id": "internal42",
+ "@idref": "internal42",
+ "@idrefs": "internal42 internal42 internal42",
+ "@nmtoken": "this-gets-normalized",
+ "@nmtokens": "this also gets normalized",
+ "@notation": "nonce",
+ "@token": "a",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("notation01", () => {
+ // 4.7 [82] — NOTATION declarations don't need SYSTEM IDs; and externally declared notations may be
+ // used to declare unparsed entities in the internal DTD subset. The notation must be reported to the
+ // application. (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\n\n]>\ntest\n';
+ const canonical = "test";
+ const compact: unknown = { test: "test" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("optional", () => {
+ // 3 3.2.1 [47] — Tests declarations of "children" content models, and the validity constraints
+ // associated with them. (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n \n\n \n\n\n \n \n \n \n \n\n \n \n \n \n \n\n\n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n\n \n \n \n \n \n\n\n\n';
+ const canonical =
+ "
";
+ const compact: unknown = {
+ root: {
+ once: { e: "" },
+ twice: { e: ["", ""] },
+ "once-or-twice-a": [{ e: "" }, { e: ["", ""] }],
+ "once-or-twice-b": [{ e: "" }, { e: ["", ""] }],
+ "once-or-twice-c": [{ e: "" }, { e: ["", ""] }],
+ "once-or-twice-d": [{ e: "" }, { e: ["", ""] }],
+ "once-or-twice-e": [{ e: "" }, { e: ["", ""] }],
+ "once-or-more-a": [{ e: "" }, { e: ["", ""] }, { e: ["", "", ""] }, { e: ["", "", "", ""] }],
+ "once-or-more-b": [{ e: "" }, { e: ["", ""] }, { e: ["", "", ""] }, { e: ["", "", "", ""] }],
+ "once-or-more-c": [{ e: "" }, { e: ["", ""] }, { e: ["", "", ""] }, { e: ["", "", "", ""] }],
+ "once-or-more-d": [{ e: "" }, { e: ["", ""] }, { e: ["", "", ""] }, { e: ["", "", "", ""] }],
+ "once-or-more-e": [{ e: "" }, { e: ["", ""] }, { e: ["", "", ""] }, { e: ["", "", "", ""] }],
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("required00", () => {
+ // 3.3.2 [60] — Tests the #REQUIRED attribute declaration syntax, and the associated validity
+ // constraint.
+ const input: string =
+ '\n \n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@req": "foo" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("sa01", () => {
+ // 2.9 [32] — A document may be marked 'standalone' if any optional whitespace is defined within the
+ // internal DTD subset.
+ const input: string =
+ "\n\n\n \n]>\n\n\n \n The whitespace around this element would be\n invalid as standalone were the DTD external.\n \n\n";
+ const canonical =
+ "
The whitespace around this element would be
invalid as standalone were the DTD external.
";
+ const compact: unknown = {
+ root: {
+ child: "The whitespace around this element would be\n invalid as standalone were the DTD external.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("sa02", () => {
+ // 2.9 [32] — A document may be marked 'standalone' if any attributes that need normalization are
+ // defined within the internal DTD subset.
+ const input: string =
+ '\n\n\n\n \n\n \n \n \n \n\n \n \n \n\n \n \n]>\n\n\n';
+ const canonical =
+ '';
+ const compact: unknown = {
+ attributes: {
+ "@cdata": "nothing happens to this one!",
+ "@entities": "unparsed-1 unparsed-2",
+ "@entity": "unparsed-1",
+ "@id": "internal42",
+ "@idref": "internal42",
+ "@idrefs": "internal42 internal42 internal42",
+ "@nmtoken": "this-gets-normalized",
+ "@nmtokens": "this also gets normalized",
+ "@notation": "nonce",
+ "@token": "a",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("sa03", () => {
+ // 2.9 [32] — A document may be marked 'standalone' if any the defined entities need expanding are
+ // internal, and no attributes need defaulting or normalization. On output, requires notations to be
+ // correctly reported. (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n \n \n]>\n\n\n';
+ const canonical =
+ '';
+ const compact: unknown = {
+ attributes: {
+ "@cdata": "nothing happens to this one!",
+ "@entities": "unparsed-1 unparsed-2",
+ "@entity": "unparsed-1",
+ "@id": "internal42",
+ "@idref": "internal42",
+ "@idrefs": "internal42 internal42 internal42",
+ "@nmtoken": "this-gets-normalized",
+ "@nmtokens": "this also gets normalized",
+ "@notation": "foo",
+ "@token": "b",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("sa04", () => {
+ // 2.9 [32] — Like sa03 but relies on attribute defaulting defined in the internal subset. On output,
+ // requires notations to be correctly reported. (upstream: valid; external parameter entities are not
+ // read)
+ const input: string =
+ '\n\n\n\n \n \n \n]>\n\n\n\n\n';
+ const canonical =
+ '';
+ const compact: unknown = {
+ attributes: {
+ "@cdata": "nothing happens to this one!",
+ "@entities": "unparsed-1 unparsed-2",
+ "@entity": "unparsed-1",
+ "@id": "internal42",
+ "@idref": "internal42",
+ "@idrefs": "internal42 internal42 internal42",
+ "@nmtoken": "this-gets-normalized",
+ "@nmtokens": "this also gets normalized",
+ "@notation": "nonce",
+ "@token": "a",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("sa05", () => {
+ // 2.9 [32] — Like sa01 but this document is standalone since it has no optional whitespace. On output,
+ // requires notations to be correctly reported. (upstream: valid; external parameter entities are not
+ // read)
+ const input: string =
+ "\n\n\n\n\n No whitespace before or after this standalone element.\n\n";
+ const canonical =
+ "
No whitespace before or after this standalone element.
";
+ const compact: unknown = { root: { child: "No whitespace before or after this standalone element." } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-sgml01", () => {
+ // 3.3.1 [59] — XML permits token reuse, while SGML does not.
+ const input: string =
+ '\n \n \n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@position": "first", "@status": "initial-draft" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-lang01", () => {
+ // 2.12 [35] — Tests a lowercase ISO language code.
+ const input: string =
+ '\n\n]>\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@xml:lang": "en" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-lang02", () => {
+ // 2.12 [35] — Tests a ISO language code with a subcode.
+ const input: string =
+ '\n\n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@xml:lang": "en-IN" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-lang03", () => {
+ // 2.12 [36] — Tests a IANA language code with a subcode.
+ const input: string =
+ '\n\n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@xml:lang": "i-klingon-whorf" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-lang04", () => {
+ // 2.12 [37] — Tests a user language code with a subcode.
+ const input: string =
+ '\n\n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@xml:lang": "x-dialect-valleygirl" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-lang05", () => {
+ // 2.12 [35] — Tests an uppercase ISO language code.
+ const input: string =
+ '\n\n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@xml:lang": "DE" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-lang06", () => {
+ // 2.12 [37] — Tests a user language code.
+ const input: string =
+ '\n\n]>\n\n\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@xml:lang": "X-Java" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-pe00", () => {
+ // 4.5 — Tests construction of internal entity replacement text, using an example in the XML
+ // specification. (upstream: valid; external parameter entities are not read; output depends on them)
+ const input: string = '\n&book;\n';
+ expectParses(input);
+ });
+
+ test("v-pe03", () => {
+ // 4.5 — Tests construction of internal entity replacement text, using an example in the XML
+ // specification.
+ const input: string =
+ '\n\n\nAn ampersand (&) may be escaped\nnumerically (&#38) or with a general entity (&).
" >\n]>\n&example;\n';
+ const canonical =
+ "An ampersand (&) may be escaped
numerically (&) or with a general entity (&).
";
+ const compact: unknown = {
+ root: {
+ p: "An ampersand (&) may be escaped\nnumerically (&) or with a general entity (&).",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("v-pe02", () => {
+ // 4.5 — Tests construction of internal entity replacement text, using a complex example in the XML
+ // specification. (upstream: valid; external parameter entities are not read)
+ const input: string =
+ "\n\n\n' >\n%xx;\n]>\nThis sample shows a &tricky; method.\n\n";
+ const canonical = "This sample shows a error-prone method.";
+ const compact: unknown = { test: "This sample shows a error-prone method." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("inv-dtd01", () => {
+ // 3.2.2 — Tests the No Duplicate Types VC
+ const input: string =
+ "\n \n \n]>\n\n\n";
+ expectParses(input);
+ });
+
+ test("inv-dtd02", () => {
+ // 4.2.2 — Tests the "Notation Declared" VC by using an undeclared notation name.
+ const input: string =
+ '\n\n]>\n\n';
+ expectParses(input);
+ });
+
+ test("inv-dtd03", () => {
+ // 3 — Tests the "Element Valid" VC (clause 2) by omitting a required element.
+ const input: string =
+ '\n\n\n \n]>\n\n \n \n \n\n';
+ expectParses(input);
+ });
+
+ test("el01", () => {
+ // 3 — Tests the Element Valid VC (clause 4) by including an undeclared child element.
+ const input: string = "\n]>\n \n\n";
+ expectParses(input);
+ });
+
+ test("el02", () => {
+ // 3 — Tests the Element Valid VC (clause 1) by including elements in an EMPTY content model.
+ const input: string = "\n]>\n\n";
+ expectParses(input);
+ });
+
+ test("el03", () => {
+ // 3 — Tests the Element Valid VC (clause 3) by including a child element not permitted by a mixed
+ // content model.
+ const input: string =
+ "\n\n]>\nthis is ok this isn't \n";
+ expectParses(input);
+ });
+
+ test("el04", () => {
+ // 3.2 — Tests the Unique Element Type Declaration VC.
+ const input: string =
+ "\n\n\n]>\n\n";
+ expectParses(input);
+ });
+
+ test("el05", () => {
+ // 3.2.2 — Tests the No Duplicate Types VC.
+ const input: string =
+ "\n\n]>\n\n";
+ expectParses(input);
+ });
+
+ test("el06", () => {
+ // 3 — Tests the Element Valid VC (clause 1), using one of the predefined internal entities inside an
+ // EMPTY content model.
+ const input: string =
+ "\n \n]>\n&\n\n";
+ expectParses(input);
+ });
+
+ test("id01", () => {
+ // 3.3.1 — Tests the ID (is a Name) VC (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n\n\n \n\n';
+ expectParses(input);
+ });
+
+ test("id02", () => {
+ // 3.3.1 — Tests the ID (appears once) VC (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n\n\n \n \n\n\n';
+ expectParses(input);
+ });
+
+ test("id03", () => {
+ // 3.3.1 — Tests the One ID per Element Type VC (upstream: invalid; external parameter entities are not
+ // read)
+ const input: string =
+ '\n]>\n\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("id04", () => {
+ // 3.3.1 — Tests the ID Attribute Default VC
+ const input: string =
+ '\n]>\n\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("id05", () => {
+ // 3.3.1 — Tests the ID Attribute Default VC
+ const input: string =
+ '\n \n]>\n\n\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("id06", () => {
+ // 3.3.1 — Tests the IDREF (is a Name) VC
+ const input: string =
+ '\n \n]>\n\n\n\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("id07", () => {
+ // 3.3.1 — Tests the IDREFS (is a Names) VC
+ const input: string =
+ '\n \n]>\n\n\n\n\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("id08", () => {
+ // 3.3.1 — Tests the IDREF (matches an ID) VC
+ const input: string =
+ '\n \n]>\n\n\n\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("id09", () => {
+ // 3.3.1 — Tests the IDREF (IDREFS matches an ID) VC
+ const input: string =
+ '\n \n]>\n\n\n\n\n \n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa01", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that optional whitespace causes a
+ // validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ "\n\n\n \n\n \n The whitespace before and after this element keeps\n this from being standalone.\n \n\n";
+ expectParses(input);
+ });
+
+ test("inv-not-sa02", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that attributes needing normalization
+ // cause a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n \n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa04", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that attributes needing defaulting
+ // cause a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ "\n\n\n]>\n\n\n\n\n";
+ expectParses(input);
+ });
+
+ test("inv-not-sa05", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that a token attribute that needs
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ "\n\n\n]>\n\n\n";
+ expectParses(input);
+ });
+
+ test("inv-not-sa06", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that a NOTATION attribute that needs
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa07", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an NMTOKEN attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa08", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an NMTOKENS attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa09", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an ID attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa10", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an IDREF attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa11", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an IDREFS attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa12", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an ENTITY attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa13", () => {
+ // 2.9 — Tests the Standalone Document Declaration VC, ensuring that an ENTITIES attribute needing
+ // normalization causes a validity error. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-not-sa14", () => {
+ // 3 — CDATA sections containing only whitespace do not match the nonterminal S, and cannot appear in
+ // these positions. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ "\n\n\n \n\n The whitespace before and after this element keeps\n this from being standalone. (CDATA is just another\n way to represent text...)\n \n";
+ expectParses(input);
+ });
+
+ test("optional01", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one is required. (upstream: invalid; external parameter entities are not read)
+ const input: string = '\n\n \n\n';
+ expectParses(input);
+ });
+
+ test("optional02", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // two children where one is required. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional03", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where two are required. (upstream: invalid; external parameter entities are not read)
+ const input: string = '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional04", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // three children where two are required. (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional05", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or two are required (one construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional06", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or two are required (a second construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional07", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or two are required (a third construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional08", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or two are required (a fourth construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional09", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or two are required (a fifth construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional10", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // three children where one or two are required (a basic construction of that model). (upstream:
+ // invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional11", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // three children where one or two are required (a second construction of that model). (upstream:
+ // invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional12", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // three children where one or two are required (a third construction of that model). (upstream:
+ // invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional13", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // three children where one or two are required (a fourth construction of that model). (upstream:
+ // invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional14", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // three children where one or two are required (a fifth construction of that model). (upstream:
+ // invalid; external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("optional20", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or more are required (a sixth construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n';
+ expectParses(input);
+ });
+
+ test("optional21", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or more are required (a seventh construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional22", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or more are required (an eigth construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional23", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or more are required (a ninth construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional24", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing no
+ // children where one or more are required (a tenth construction of that model). (upstream: invalid;
+ // external parameter entities are not read)
+ const input: string =
+ '\n\n \n\n\n';
+ expectParses(input);
+ });
+
+ test("optional25", () => {
+ // 3 — Tests the Element Valid VC (clause 2) for one instance of "children" content model, providing
+ // text content where one or more elements are required. (upstream: invalid; external parameter
+ // entities are not read)
+ const input: string =
+ '\n\n No text allowed!\n\n\n';
+ expectParses(input);
+ });
+
+ test("inv-required00", () => {
+ // 3.3.2 — Tests the Required Attribute VC.
+ const input: string =
+ "\n \n]>\n\n\n\n\n";
+ expectParses(input);
+ });
+
+ test("inv-required01", () => {
+ // 3.1 2.10 — Tests the Attribute Value Type (declared) VC for the xml:space attribute
+ const input: string =
+ "\n]>\n\n\n\n \n";
+ expectParses(input);
+ });
+
+ test("inv-required02", () => {
+ // 3.1 2.12 — Tests the Attribute Value Type (declared) VC for the xml:lang attribute
+ const input: string =
+ "\n]>\n\n\n\n \n\n";
+ expectParses(input);
+ });
+
+ test("root", () => {
+ // 2.8 — Tests the Root Element Type VC (upstream: invalid; external parameter entities are not read)
+ const input: string =
+ "\n\n\n\n\n \n\n";
+ expectParses(input);
+ });
+
+ test("attr01", () => {
+ // 3.3.1 — Tests the "Entity Name" VC for the ENTITY attribute type.
+ const input: string =
+ '\n\n \n]>\n\n';
+ expectParses(input);
+ });
+
+ test("attr02", () => {
+ // 3.3.1 — Tests the "Entity Name" VC for the ENTITIES attribute type.
+ const input: string =
+ '\n\n \n\n\n]>\n\n';
+ expectParses(input);
+ });
+
+ test("attr03", () => {
+ // 3.3.1 — Tests the "Notation Attributes" VC for the NOTATION attribute type, first clause: value must
+ // be one of the ones that's declared.
+ const input: string =
+ '\n\n\n\n\n\n \n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("attr04", () => {
+ // 3.3.1 — Tests the "Notation Attributes" VC for the NOTATION attribute type, second clause: the names
+ // in the declaration must all be declared.
+ const input: string =
+ '\n\n\n\n \n]>\n\n';
+ expectParses(input);
+ });
+
+ test("attr05", () => {
+ // 3.3.1 — Tests the "Name Token" VC for the NMTOKEN attribute type.
+ const input: string =
+ '\n\n\n \n]>\n\n';
+ expectParses(input);
+ });
+
+ test("attr06", () => {
+ // 3.3.1 — Tests the "Name Token" VC for the NMTOKENS attribute type.
+ const input: string =
+ '\n\n\n \n]>\n\n';
+ expectParses(input);
+ });
+
+ test("attr07", () => {
+ // 3.3.1 — Tests the "Enumeration" VC by providing a value which wasn't one of the choices.
+ const input: string =
+ '\n\n \n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("attr08", () => {
+ // 3.3.2 — Tests the "Fixed Attribute Default" VC by providing the wrong value.
+ const input: string =
+ '\n\n \n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("attr09", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal IDREF value.
+ const input: string =
+ '\n\n\n\n \n\n\n\n]>\n\n\n \n \n\n';
+ expectParses(input);
+ });
+
+ test("attr10", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal IDREFS value.
+ const input: string =
+ '\n\n\n\n \n\n\n\n]>\n\n\n \n \n\n';
+ expectParses(input);
+ });
+
+ test("attr11", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal ENTITY value.
+ const input: string =
+ '\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("attr12", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal ENTITIES value.
+ const input: string =
+ '\r\n\r\n \r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("attr13", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal NMTOKEN value.
+ const input: string =
+ '\n\n \n]>\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("attr14", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal NMTOKENS value.
+ const input: string =
+ '\n\n \n]>\n\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("attr15", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal NOTATIONS value.
+ const input: string =
+ '\n\n \n\n\n\n\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("attr16", () => {
+ // 3.3.2 — Tests the "Attribute Default Legal" VC by providing an illegal enumeration value.
+ const input: string =
+ '\n\n \n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("utf16b", () => {
+ // 4.3.3 2.8 — Tests reading an invalid "big endian" UTF-16 document
+ const input = Buffer.from(
+ "/v8APAA/AHgAbQBsACAAdgBlAHIAcwBpAG8AbgA9ACcAMQAuADAAJwAgAGUAbgBjAG8AZABpAG4AZwA9ACcAVQBUAEYALQAxADYAJwA/AD4ACgA8AHIAbwBvAHQALwA+AAo=",
+ "base64",
+ );
+ expectParses(input);
+ });
+
+ test("utf16l", () => {
+ // 4.3.3 2.8 — Tests reading an invalid "little endian" UTF-16 document
+ const input = Buffer.from(
+ "//48AD8AeABtAGwAIAB2AGUAcgBzAGkAbwBuAD0AJwAxAC4AMAAnACAAZQBuAGMAbwBkAGkAbgBnAD0AJwBVAFQARgAtADEANgAnAD8APgAKADwAcgBvAG8AdAAvAD4ACgA=",
+ "base64",
+ );
+ expectParses(input);
+ });
+
+ test("empty", () => {
+ // 2.4 2.7 [18] 3 — CDATA section containing only white space does not match the nonterminal S, and
+ // cannot appear in these positions.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n∅\r\n\r\n&space;\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("not-wf-sa03", () => {
+ // 2.9 — Tests the Entity Declared WFC, ensuring that a reference to externally defined entity causes a
+ // well-formedness error. (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\n\n\n]>\n\n\n';
+ expectRejects(input, "XML Parse error: Entity 'number' is not declared");
+ });
+
+ test("attlist01", () => {
+ // 3.3.1 [56] — SGML's NUTOKEN is not allowed.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NUTOKEN'",
+ );
+ });
+
+ test("attlist02", () => {
+ // 3.3.1 [56] — SGML's NUTOKENS attribute type is not allowed.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NUTOKENS'",
+ );
+ });
+
+ test("attlist03", () => {
+ // 3.3.1 [59] — Comma doesn't separate enumerations, unlike in SGML.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found ','");
+ });
+
+ test("attlist04", () => {
+ // 3.3.1 [56] — SGML's NUMBER attribute type is not allowed.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NUMBER'",
+ );
+ });
+
+ test("attlist05", () => {
+ // 3.3.1 [56] — SGML's NUMBERS attribute type is not allowed.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NUMBERS'",
+ );
+ });
+
+ test("attlist06", () => {
+ // 3.3.1 [56] — SGML's NAME attribute type is not allowed.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NAME'",
+ );
+ });
+
+ test("attlist07", () => {
+ // 3.3.1 [56] — SGML's NAMES attribute type is not allowed.
+ const input: string =
+ '\n\n \n\n \n\n]>\n\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NAMES'",
+ );
+ });
+
+ test("attlist08", () => {
+ // 3.3.1 [56] — SGML's #CURRENT is not allowed.
+ const input: string =
+ "\n\n \n\n \n\n]>\n\n\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '#CURRENT'",
+ );
+ });
+
+ test("attlist09", () => {
+ // 3.3.1 [56] — SGML's #CONREF is not allowed.
+ const input: string =
+ '\n\n \n\n]>\n\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '#CONREF'",
+ );
+ });
+
+ test("attlist10", () => {
+ // 3.1 [40] — Whitespace required between attributes
+ const input: string =
+ '\n\n\n]>\n\n \n\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'att2'");
+ });
+
+ test("attlist11", () => {
+ // 3.1 [44] — Whitespace required between attributes
+ const input: string =
+ '\n\n\n]>\n\n \n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'att2'");
+ });
+
+ test("cond01", () => {
+ // 3.4 [61] — Only INCLUDE and IGNORE are conditional section keywords (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string = '\n]>\n\n\n';
+ expectParses(input);
+ });
+
+ test("cond02", () => {
+ // 3.4 [61] — Must have keyword in conditional sections (upstream: not-wf; external parameter entities
+ // are not read)
+ const input: string = '\n]>\n\n\n\n';
+ expectParses(input);
+ });
+
+ test("content01", () => {
+ // 3.2.1 [48] — No whitespace before "?" in content model
+ const input: string =
+ "\n \n]>\n\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("content02", () => {
+ // 3.2.1 [48] — No whitespace before "*" in content model
+ const input: string =
+ "\n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("content03", () => {
+ // 3.2.1 [48] — No whitespace before "+" in content model
+ const input: string =
+ "\n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("decl01", () => {
+ // 4.3.1 [77] — External entities may not have standalone decls. (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string =
+ '\n \n\n \n %ent01;\n]>\n\n';
+ expectParses(input);
+ });
+
+ test("nwf-dtd00", () => {
+ // 3.2.1 [55] — Comma mandatory in content model
+ const input: string =
+ "\n\t\n \n \n]>\n\n \n";
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found 'foo'");
+ });
+
+ test("nwf-dtd01", () => {
+ // 3.2.1 [55] — Can't mix comma and vertical bar in content models
+ const input: string =
+ "\n\t\n \n \n]>\n\n \n";
+ expectRejects(input, "XML Parse error: A content model group cannot mix ',' and '|'");
+ });
+
+ test("dtd02", () => {
+ // 4.1 [69] — PE name immediately after "%"
+ const input: string =
+ '\n \n ">\n % foo;\n]>\n\n\n';
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '%'");
+ });
+
+ test("dtd03", () => {
+ // 4.1 [69] — PE name immediately followed by ";"
+ const input: string =
+ '\n \n ">\n %foo\n ;\n]>\n\n\n';
+ expectRejects(input, "XML Parse error: Expected ';' to end the parameter entity reference 'foo'");
+ });
+
+ test("dtd04", () => {
+ // 4.2.2 [75] — PUBLIC literal must be quoted
+ const input: string =
+ '\n \n \n]>\n\n\n';
+ expectRejects(input, "XML Parse error: Expected a quoted public identifier after PUBLIC but found '-'");
+ });
+
+ test("dtd05", () => {
+ // 4.2.2 [75] — SYSTEM identifier must be quoted
+ const input: string =
+ "\n \n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: Expected a quoted system identifier after SYSTEM but found 'elvis.ent'");
+ });
+
+ test("dtd07", () => {
+ // 4.3.1 [77] — Text declarations (which optionally begin any external entity) are required to have
+ // "encoding=...". (upstream: not-wf; external parameter entities are not read)
+ const input: string = '\n]>\n\n';
+ expectParses(input);
+ });
+
+ test("element00", () => {
+ // 3.1 [42] — EOF in middle of incomplete ETAG
+ const input: string = "\n Incomplete end tag.\n but found ");
+ });
+
+ test("element01", () => {
+ // 3.1 [42] — EOF in middle of incomplete ETAG
+ const input: string = "\n Incomplete end tag.\n' to end the closing tag but found end of input");
+ });
+
+ test("element02", () => {
+ // 3.1 [43] — Illegal markup (<%@ ... %>)
+ const input: string = ' ]>\n\n <% @ LANGUAGE="VBSCRIPT" %>\n\n';
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '%'");
+ });
+
+ test("element03", () => {
+ // 3.1 [43] — Illegal markup (<% ... %>)
+ const input: string =
+ ' ]>\n\n <% document.println ("hello, world"); %>\n\n\n';
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '%'");
+ });
+
+ test("element04", () => {
+ // 3.1 [43] — Illegal markup ()
+ const input: string = " ]>\n\n \n\n";
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 4.3.3 [81] — Illegal character " " in encoding name
+ const input = Buffer.from('\n\n');
+ expectRejects(input, "XML Parse error: Invalid encoding name ' utf-8' in the XML declaration");
+ });
+
+ test("encoding02", () => {
+ // 4.3.3 [81] — Illegal character "/" in encoding name
+ const input = Buffer.from('\n\n\n');
+ expectRejects(input, "XML Parse error: Invalid encoding name 'a/b' in the XML declaration");
+ });
+
+ test("encoding03", () => {
+ // 4.3.3 [81] — Illegal character reference in encoding name
+ const input = Buffer.from('\n\n\n');
+ expectRejects(input, "XML Parse error: Invalid encoding name 'just)word' in the XML declaration");
+ });
+
+ test("encoding04", () => {
+ // 4.3.3 [81] — Illegal character ":" in encoding name
+ const input = Buffer.from('\n\n\n');
+ expectRejects(input, "XML Parse error: Invalid encoding name 'utf:8' in the XML declaration");
+ });
+
+ test("encoding05", () => {
+ // 4.3.3 [81] — Illegal character "@" in encoding name
+ const input = Buffer.from('\n\n\n');
+ expectRejects(input, "XML Parse error: Invalid encoding name '@import(sys-encoding)' in the XML declaration");
+ });
+
+ test("encoding06", () => {
+ // 4.3.3 [81] — Illegal character "+" in encoding name
+ const input = Buffer.from(
+ '\n\n \n\n\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name 'XYZ+999' in the XML declaration");
+ });
+
+ test("encoding07", () => {
+ // 4.3.1 [77] — Text declarations (which optionally begin any external entity) are required to have
+ // "encoding=...". (upstream: not-wf; external general entities are not read)
+ const input: string =
+ '\n\n \n \n]>\n∅\n';
+ expectParses(input);
+ });
+
+ test("pi", () => {
+ // 2.6 [16] — No space between PI target name and data
+ const input: string =
+ "\n\n\n]>\n\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found '+'",
+ );
+ });
+
+ test("pubid01", () => {
+ // 2.3 [12] — Illegal entity ref in public ID
+ const input: string =
+ '\n\n \n\n \n]>\n\n\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '&'");
+ });
+
+ test("pubid02", () => {
+ // 2.3 [12] — Illegal characters in public ID
+ const input: string =
+ '\n\n \n\n " "ignored">\n]>\n\n\n\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '<'");
+ });
+
+ test("pubid03", () => {
+ // 2.3 [12] — Illegal characters in public ID
+ const input: string =
+ '\n\n \n\n \n]>\n\n\n\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '['");
+ });
+
+ test("pubid04", () => {
+ // 2.3 [12] — Illegal characters in public ID
+ const input: string =
+ '\n\n \n\n \n]>\n\n\n\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '{'");
+ });
+
+ test("pubid05", () => {
+ // 2.3 [12] — SGML-ism: public ID without system ID
+ const input: string =
+ '\n\n \n]>\n\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a quoted system identifier after the public identifier but found '>'",
+ );
+ });
+
+ test("sgml01", () => {
+ // 3 [39] — SGML-ism: omitted end tag for EMPTY content
+ const input: string =
+ "\n\n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: Missing closing tag for element 'root'");
+ });
+
+ test("sgml02", () => {
+ // 2.8 — XML declaration must be at the very beginning of a document; it"s not a processing
+ // instruction
+ const input: string =
+ ' \n \n ]>\n\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.5 [15] — Comments may not contain "--"
+ const input: string =
+ " ]>\n\n \n\n";
+ expectRejects(input, "XML Parse error: '--' is not allowed inside a comment");
+ });
+
+ test("sgml04", () => {
+ // 3.3 [52] — ATTLIST declarations apply to only one element, unlike SGML
+ const input: string =
+ "\n\n \n \n\n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: Expected an element name after ' {
+ // 3.2 [45] — ELEMENT declarations apply to only one element, unlike SGML
+ const input: string =
+ "\n\n \n \n \n\n \n]>\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected an element name after ' {
+ // 3.3 [52] — ATTLIST declarations are never global, unlike in SGML
+ const input: string =
+ "\n\n \n\n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: Expected an element name after ' {
+ // 3.2 [45] — SGML Tag minimization specifications are not allowed
+ const input: string =
+ "\n \n]>\n\n\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '-'");
+ });
+
+ test("sgml08", () => {
+ // 3.2 [45] — SGML Tag minimization specifications are not allowed
+ const input: string =
+ "\n \n]>\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '-'");
+ });
+
+ test("sgml09", () => {
+ // 3.2 [45] — SGML Content model exception specifications are not allowed
+ const input: string =
+ "\n\n \n]>\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '-footnote'");
+ });
+
+ test("sgml10", () => {
+ // 3.2 [45] — SGML Content model exception specifications are not allowed
+ const input: string =
+ "\n \n]>\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '+'");
+ });
+
+ test("sgml11", () => {
+ // 3.2 [46] — CDATA is not a valid content model spec
+ const input: string =
+ "\n \n]>\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'CDATA'");
+ });
+
+ test("sgml12", () => {
+ // 3.2 [46] — RCDATA is not a valid content model spec
+ const input: string =
+ "\n \n]>\n\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'RCDATA'");
+ });
+
+ test("sgml13", () => {
+ // 3.2.1 [47] — SGML Unordered content models not allowed
+ const input: string =
+ "\n \n \n \n \n]>\n\n\n\n\n";
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found '&'");
+ });
+
+ test("uri01", () => {
+ // 4.2.2 [75] — SYSTEM ids may not have URI fragments (upstream: optional error)
+ const input: string =
+ '\n\n\n]>\n\n';
+ expectParses(input);
+ });
+});
+
+describe("oasis", () => {
+ test("o-p01pass2", () => {
+ // 2.2 [1] — various Misc items where they can occur
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p06pass1", () => {
+ // 2.3 [6] — various satisfactions of the Names production in a NAMES attribute
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p07pass1", () => {
+ // 2.3 [7] — various valid Nmtoken 's in an attribute list declaration.
+ const input: string =
+ "\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p08pass1", () => {
+ // 2.3 [8] — various satisfaction of an NMTOKENS attribute value.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p09pass1", () => {
+ // 2.3 [9] — valid EntityValue's. Except for entity references, markup is not recognized. (upstream:
+ // valid; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p12pass1", () => {
+ // 2.3 [12] — valid public IDs.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p22pass4", () => {
+ // 2.8 [22] — XML decl and doctypedecl
+ const input: string =
+ '\r\n \r\n\r\n]>\r\n\r\n \r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p22pass5", () => {
+ // 2.8 [22] — just doctypedecl
+ const input: string =
+ " \r\n\r\n]>\r\n\r\n \r\n\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p22pass6", () => {
+ // 2.8 [22] — S between decls is not required
+ const input: string = '\r\n]>\r\n';
+ expectParses(input);
+ });
+
+ test("o-p28pass1", () => {
+ // 3.1 [43] [44] — Empty-element tag must be used for element which are declared EMPTY.
+ const input: string = "\r\n]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p28pass3", () => {
+ // 2.8 4.1 [28] [69] — Valid doctypedecl with Parameter entity reference. The declaration of a
+ // parameter entity must precede any reference to it. (upstream: valid; external parameter entities are
+ // not read)
+ const input: string =
+ '">\r\n%eldecl;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p28pass4", () => {
+ // 2.8 4.2.2 [28] [75] — Valid doctypedecl with ExternalID as an External Entity declaration.
+ // (upstream: valid; external parameter entities are not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p28pass5", () => {
+ // 2.8 4.1 [28] [69] — Valid doctypedecl with ExternalID as an External Entity. A parameter entity
+ // reference is also used. (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\r\n">\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p29pass1", () => {
+ // 2.8 [29] — Valid types of markupdecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p30pass1", () => {
+ // 2.8 4.2.2 [30] [75] — Valid doctypedecl with ExternalID as an External Entity. The external entity
+ // has an element declaration. (upstream: valid; external parameter entities are not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p30pass2", () => {
+ // 2.8 4.2.2 4.3.1 [30] [75] [77] — Valid doctypedecl with ExternalID as an Enternal Entity. The
+ // external entity begins with a Text Declaration. (upstream: valid; external parameter entities are
+ // not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p31pass1", () => {
+ // 2.8 [31] — external subset can be empty (upstream: valid; external parameter entities are not read)
+ const input: string = ']>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p31pass2", () => {
+ // 2.8 3.4 4.2.2 [31] [62] [63] [75] — Valid doctypedecl with EXternalID as Enternal Entity. The
+ // external entity contains a parameter entity reference and condtional sections. (upstream: valid;
+ // external parameter entities are not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p43pass1", () => {
+ // 2.4 2.5 2.6 2.7 [15] [16] [18] — Valid use of character data, comments, processing instructions and
+ // CDATA sections within the start and end tag.
+ const input: string =
+ '\r\nCharData">\r\n]>\r\n\r\nCharData \r\n\r\n\r\nCharData \r\n\r\n&ent;"\r\nCharData\r\n\r\n]]>\r\n\r\nCharData \r\n\r\n&ent;"\r\nCharData\r\n\r\n]]>\r\n&ent;"\r\nCharData\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p45pass1", () => {
+ // 3.2 [45] — valid element declarations
+ const input: string =
+ "\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p46pass1", () => {
+ // 3.2 3.2.1 3.2.2 [45] [46] [47] [51] — Valid use of contentspec, element content models, and mixed
+ // content within an element type declaration.
+ const input: string =
+ "\r\n\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p47pass1", () => {
+ // 3.2 3.2.1 [45] [46] [47] — Valid use of contentspec, element content models, choices, sequences and
+ // content particles within an element type declaration. The optional character following a name or
+ // list governs the number of times the element or content particle may appear.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p48pass1", () => {
+ // 3.2 3.2.1 [45] [46] [47] — Valid use of contentspec, element content models, choices, sequences and
+ // content particles within an element type declaration. The optional character following a name or
+ // list governs the number of times the element or content particle may appear.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p49pass1", () => {
+ // 3.2 3.2.1 [45] [46] [47] — Valid use of contentspec, element content models, choices, and content
+ // particles within an element type declaration. The optional character following a name or list
+ // governs the number of times the element or content particle may appear. Whitespace is also valid
+ // between choices.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p50pass1", () => {
+ // 3.2 3.2.1 [45] [46] [47] — Valid use of contentspec, element content models, sequences and content
+ // particles within an element type declaration. The optional character following a name or list
+ // governs the number of times the element or content particle may appear. Whitespace is also valid
+ // between sequences.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p51pass1", () => {
+ // 3.2.2 [51] — valid Mixed contentspec's.
+ const input: string =
+ "\r\n\r\n\r\n\r\n]>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p52pass1", () => {
+ // 3.3 [52] — valid AttlistDecls: No AttDef's are required, and the terminating S is optional, multiple
+ // ATTLISTS per element are OK, and multiple declarations of the same attribute are OK.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n';
+ expectParses(input);
+ });
+
+ test("o-p53pass1", () => {
+ // 3.3 [53] — a valid AttDef
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p54pass1", () => {
+ // 3.3.1 [54] — the three kinds of attribute types
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p55pass1", () => {
+ // 3.3.1 [55] — StringType = "CDATA"
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p56pass1", () => {
+ // 3.3.1 [56] — the 7 tokenized attribute types
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p57pass1", () => {
+ // 3.3.1 [57] — enumerated types are NMTOKEN or NOTATION lists
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p58pass1", () => {
+ // 3.3.1 [58] — NOTATION enumeration has on or more items
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p59pass1", () => {
+ // 3.3.1 [59] — NMTOKEN enumerations haveon or more items
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p60pass1", () => {
+ // 3.3.2 [60] — the four types of default values
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p61pass1", () => {
+ // 3.4 [61] — valid conditional sections are INCLUDE and IGNORE (upstream: valid; external parameter
+ // entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p62pass1", () => {
+ // 3.4 [62] — valid INCLUDE sections -- options S before and after keyword, sections can nest
+ // (upstream: valid; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p63pass1", () => {
+ // 3.4 [63] — valid IGNORE sections (upstream: valid; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p64pass1", () => {
+ // 3.4 [64] — IGNOREd sections ignore everything except section delimiters (upstream: valid; external
+ // parameter entities are not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p68pass1", () => {
+ // 4.1 [68] — Valid entity references. Also ensures that a charref to '&' isn't interpreted as an
+ // entity reference open delimiter
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n&ent;aaa&ent;\r\n\r\n\r\n&en\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p69pass1", () => {
+ // 4.1 [69] — Valid PEReferences. (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\r\n">\r\n%pe;%pe;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p70pass1", () => {
+ // 4.2 [70] — An EntityDecl is either a GEDecl or a PEDecl
+ const input: string =
+ '\r\n\r\n">\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p71pass1", () => {
+ // 4.2 [71] — Valid GEDecls
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p72pass1", () => {
+ // 4.2 [72] — Valid PEDecls
+ const input: string =
+ '\r\n">\r\n"\r\n >\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p73pass1", () => {
+ // 4.2 [73] — EntityDef is either Entity value or an external id, with an optional NDataDecl
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p76pass1", () => {
+ // 4.2.2 [76] — valid NDataDecls
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p01pass1", () => {
+ // 2.1 [1] — no prolog
+ const input: string = "\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p01pass3", () => {
+ // 2.1 [1] — Misc items after the document
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p03pass1", () => {
+ // 2.3 [3] — all valid S characters
+ const input: string = "\t\r\n ";
+ expectParses(input);
+ });
+
+ test("o-p04pass1", () => {
+ // 2.3 [4] — names with all valid ASCII characters, and one from each other class in NameChar
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p05pass1", () => {
+ // 2.3 [5] — various valid Name constructions
+ const input: string = "\r\n\r\n<::._-0/>\r\n<_:._-0/>\r\n\r\n<_/>\r\n<:/>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p06fail1", () => {
+ // 2.3 [6] — Requires at least one name.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p08fail1", () => {
+ // 2.3 [8] — at least one Nmtoken is required.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p08fail2", () => {
+ // 2.3 [8] — an invalid Nmtoken character.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p10pass1", () => {
+ // 2.3 [10] — valid attribute values
+ const input: string = '\r\n\r\n'"\'/>\r\n';
+ expectParses(input);
+ });
+
+ test("o-p14pass1", () => {
+ // 2.4 [14] — valid CharData
+ const input: string = "a%b%</doc></doc>]]<&\r\n";
+ expectParses(input);
+ });
+
+ test("o-p15pass1", () => {
+ // 2.5 [15] — valid comments
+ const input: string = "\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p16pass1", () => {
+ // 2.6 [16] [17] — Valid form of Processing Instruction. Shows that whitespace character data is valid
+ // before end of processing instruction.
+ const input: string =
+ "\r\n &a%bc?>\r\n\r\n\r\n ?>\r\n";
+ expectParses(input);
+ });
+
+ test("o-p16pass2", () => {
+ // 2.6 [16] — Valid form of Processing Instruction. Shows that whitespace character data is valid
+ // before end of processing instruction.
+ const input: string = "\r\n";
+ expectParses(input);
+ });
+
+ test("o-p16pass3", () => {
+ // 2.6 [16] — Valid form of Processing Instruction. Shows that whitespace character data is valid
+ // before end of processing instruction.
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p18pass1", () => {
+ // 2.7 [18] — valid CDSect's. Note that a CDStart in a CDSect is not recognized as such
+ const input: string =
+ "] ]> ]]]>\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p22pass1", () => {
+ // 2.8 [22] — prolog can be empty
+ const input: string = "\r\n";
+ expectParses(input);
+ });
+
+ test("o-p22pass2", () => {
+ // 2.8 [22] — XML declaration only
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p22pass3", () => {
+ // 2.8 [22] — XML decl and Misc
+ const input: string = '\r\n \r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p23pass1", () => {
+ // 2.8 [23] — Test shows a valid XML declaration along with version info.
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p23pass2", () => {
+ // 2.8 [23] — Test shows a valid XML declaration along with encoding declaration.
+ const input = Buffer.from('\r\n\r\n');
+ expectParses(input);
+ });
+
+ test("o-p23pass3", () => {
+ // 2.8 [23] — Test shows a valid XML declaration along with Standalone Document Declaration.
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p23pass4", () => {
+ // 2.8 [23] — Test shows a valid XML declaration, encoding declarationand Standalone Document
+ // Declaration.
+ const input = Buffer.from('\r\n\r\n');
+ expectParses(input);
+ });
+
+ test("o-p24pass1", () => {
+ // 2.8 [24] — Test shows a prolog that has the VersionInfo delimited by double quotes.
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p24pass2", () => {
+ // 2.8 [24] — Test shows a prolog that has the VersionInfo delimited by single quotes.
+ const input: string = "\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p24pass3", () => {
+ // 2.8 [24] — Test shows whitespace is allowed in prolog before version info.
+ const input: string = "\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p24pass4", () => {
+ // 2.8 [24] — Test shows whitespace is allowed in prolog on both sides of equal sign.
+ const input: string = "\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p25pass1", () => {
+ // 2.8 [25] — Test shows whitespace is NOT necessary before or after equal sign of versioninfo.
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p25pass2", () => {
+ // 2.8 [25] — Test shows whitespace can be used on both sides of equal sign of versioninfo.
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p26pass1", () => {
+ // 2.8 [26] — The valid version number. We cannot test others because a 1.0 processor is allowed to
+ // fail them.
+ const input: string =
+ '\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p27pass1", () => {
+ // 2.8 [27] — Comments are valid as the Misc part of the prolog.
+ const input: string =
+ '\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p27pass2", () => {
+ // 2.8 [27] — Processing Instructions are valid as the Misc part of the prolog.
+ const input: string = '\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p27pass3", () => {
+ // 2.8 [27] — Whitespace is valid as the Misc part of the prolog.
+ const input: string = '\r\n\r\n \t\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p27pass4", () => {
+ // 2.8 [27] — A combination of comments, whitespaces and processing instructions are valid as the Misc
+ // part of the prolog.
+ const input: string =
+ '\r\n\r\n \t\r\n\r\n\r\n\r\n\r\n \t\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p32pass1", () => {
+ // 2.9 [32] — Double quotes can be used as delimeters for the value of a Standalone Document
+ // Declaration.
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p32pass2", () => {
+ // 2.9 [32] — Single quotes can be used as delimeters for the value of a Standalone Document
+ // Declaration.
+ const input: string = "\r\n\r\n";
+ expectParses(input);
+ });
+
+ test("o-p39pass1", () => {
+ // 3 3.1 [39] [44] — Empty element tag may be used for any element which has no content.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p39pass2", () => {
+ // 3 3.1 [39] [43] — Character data is valid element content.
+ const input: string = "content";
+ expectParses(input);
+ });
+
+ test("o-p40pass1", () => {
+ // 3.1 [40] — Elements content can be empty.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p40pass2", () => {
+ // 3.1 [40] — Whitespace is valid within a Start-tag.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p40pass3", () => {
+ // 3.1 [40] [41] — Attributes are valid within a Start-tag.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p40pass4", () => {
+ // 3.1 [40] — Whitespace and Multiple Attributes are valid within a Start-tag.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p41pass1", () => {
+ // 3.1 [41] — Attributes are valid within a Start-tag.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p41pass2", () => {
+ // 3.1 [41] — Whitespace is valid within a Start-tags Attribute.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p42pass1", () => {
+ // 3.1 [42] — Test shows proper syntax for an End-tag.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p42pass2", () => {
+ // 3.1 [42] — Whitespace is valid after name in End-tag.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p44pass1", () => {
+ // 3.1 [44] — Valid display of an Empty Element Tag.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p44pass2", () => {
+ // 3.1 [44] — Empty Element Tags can contain an Attribute.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p44pass3", () => {
+ // 3.1 [44] — Whitespace is valid in an Empty Element Tag following the end of the attribute value.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p44pass4", () => {
+ // 3.1 [44] — Whitespace is valid after the name in an Empty Element Tag.
+ const input: string = "";
+ expectParses(input);
+ });
+
+ test("o-p44pass5", () => {
+ // 3.1 [44] — Whitespace and Multiple Attributes are valid in an Empty Element Tag.
+ const input: string = '';
+ expectParses(input);
+ });
+
+ test("o-p66pass1", () => {
+ // 4.1 [66] — valid character references
+ const input: string = "\r\nA AOO \r\n
\r\n";
+ expectParses(input);
+ });
+
+ test("o-p74pass1", () => {
+ // 4.2 [74] — PEDef is either an entity value or an external id
+ const input: string =
+ '">\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p75pass1", () => {
+ // 4.2.2 [75] — valid external identifiers
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-e2", () => {
+ // 3.3.1 [58] [59] Errata [E2] — Validity Constraint: No duplicate tokens
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p01fail1", () => {
+ // 2.1 [1] — S cannot occur before the prolog
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.1 [1] — comments cannot occur before the prolog
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.1 [1] — only one document element
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Only one root element is allowed");
+ });
+
+ test("o-p01fail4", () => {
+ // 2.1 [1] — document element must be complete.
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Missing closing tag for element 'doc'");
+ });
+
+ test("o-p02fail1", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AAAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x00");
+ });
+
+ test("o-p02fail10", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ACwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0B");
+ });
+
+ test("o-p02fail11", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ADAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0C");
+ });
+
+ test("o-p02fail12", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ADgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0E");
+ });
+
+ test("o-p02fail13", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ADwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0F");
+ });
+
+ test("o-p02fail14", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AEAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x10");
+ });
+
+ test("o-p02fail15", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AEQA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x11");
+ });
+
+ test("o-p02fail16", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AEgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x12");
+ });
+
+ test("o-p02fail17", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AEwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x13");
+ });
+
+ test("o-p02fail18", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AFAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x14");
+ });
+
+ test("o-p02fail19", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AFQA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x15");
+ });
+
+ test("o-p02fail2", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AAQA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x01");
+ });
+
+ test("o-p02fail20", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AFgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x16");
+ });
+
+ test("o-p02fail21", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AFwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x17");
+ });
+
+ test("o-p02fail22", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AGAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x18");
+ });
+
+ test("o-p02fail23", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AGQA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x19");
+ });
+
+ test("o-p02fail24", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AGgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1A");
+ });
+
+ test("o-p02fail25", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AGwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1B");
+ });
+
+ test("o-p02fail26", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AHAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1C");
+ });
+
+ test("o-p02fail27", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AHQA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1D");
+ });
+
+ test("o-p02fail28", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AHgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1E");
+ });
+
+ test("o-p02fail29", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AHwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1F");
+ });
+
+ test("o-p02fail3", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AAgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x02");
+ });
+
+ test("o-p02fail30", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4A/v88AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: '\ufffe' (U+FFFE)");
+ });
+
+ test("o-p02fail31", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4A//88AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: '\uffff' (U+FFFF)");
+ });
+
+ test("o-p02fail4", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4AAwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x03");
+ });
+
+ test("o-p02fail5", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ABAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x04");
+ });
+
+ test("o-p02fail6", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ABQA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x05");
+ });
+
+ test("o-p02fail7", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ABgA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x06");
+ });
+
+ test("o-p02fail8", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ABwA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x07");
+ });
+
+ test("o-p02fail9", () => {
+ // 2.2 [2] — Use of illegal character within XML document.
+ const input = Buffer.from("//48AGQAbwBjAD4ACAA8AC8AZABvAGMAPgA=", "base64");
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x08");
+ });
+
+ test("o-p03fail1", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input = Buffer.from("ADxkb2MvPg==", "base64");
+ expectRejects(input, "XML Parse error: UTF-16 input has an odd number of bytes");
+ });
+
+ test("o-p03fail10", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u000b";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0B");
+ });
+
+ test("o-p03fail11", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\f";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0C");
+ });
+
+ test("o-p03fail12", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u000e";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0E");
+ });
+
+ test("o-p03fail13", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u000f";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0F");
+ });
+
+ test("o-p03fail14", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0010";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x10");
+ });
+
+ test("o-p03fail15", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0011";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x11");
+ });
+
+ test("o-p03fail16", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0012";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x12");
+ });
+
+ test("o-p03fail17", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0013";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x13");
+ });
+
+ test("o-p03fail18", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0014";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x14");
+ });
+
+ test("o-p03fail19", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0015";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x15");
+ });
+
+ test("o-p03fail2", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0001";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x01");
+ });
+
+ test("o-p03fail20", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0016";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x16");
+ });
+
+ test("o-p03fail21", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0017";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x17");
+ });
+
+ test("o-p03fail22", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0018";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x18");
+ });
+
+ test("o-p03fail23", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0019";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x19");
+ });
+
+ test("o-p03fail24", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u001a";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1A");
+ });
+
+ test("o-p03fail25", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u001b";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1B");
+ });
+
+ test("o-p03fail26", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u001c";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1C");
+ });
+
+ test("o-p03fail27", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u001d";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1D");
+ });
+
+ test("o-p03fail28", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u001e";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1E");
+ });
+
+ test("o-p03fail29", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u001f";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1F");
+ });
+
+ test("o-p03fail3", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0002";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x02");
+ });
+
+ test("o-p03fail4", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0003";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x03");
+ });
+
+ test("o-p03fail5", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0004";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x04");
+ });
+
+ test("o-p03fail7", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0006";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x06");
+ });
+
+ test("o-p03fail8", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\u0007";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x07");
+ });
+
+ test("o-p03fail9", () => {
+ // 2.3 [3] — Use of illegal character within XML document.
+ const input: string = "\b";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x08");
+ });
+
+ test("o-p04fail1", () => {
+ // 2.3 [4] — Name contains invalid character.
+ const input: string = "\r\n";
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '@'");
+ });
+
+ test("o-p04fail2", () => {
+ // 2.3 [4] — Name contains invalid character.
+ const input: string = "\r\n";
+ expectRejects(input, "XML Parse error: Expected a keyword after '#' but found '/'");
+ });
+
+ test("o-p04fail3", () => {
+ // 2.3 [4] — Name contains invalid character.
+ const input: string = "\r\n";
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '$'");
+ });
+
+ test("o-p05fail1", () => {
+ // 2.3 [5] — a Name cannot start with a digit
+ const input: string = "<0A/>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '0'");
+ });
+
+ test("o-p05fail2", () => {
+ // 2.3 [5] — a Name cannot start with a '.'
+ const input: string = "<.A/>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '.'");
+ });
+
+ test("o-p05fail3", () => {
+ // 2.3 [5] — a Name cannot start with a "-"
+ const input: string = "<-A/>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '-'");
+ });
+
+ test("o-p05fail4", () => {
+ // 2.3 [5] — a Name cannot start with a CombiningChar
+ const input: string = "<̀A/>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '̀' (U+0300)");
+ });
+
+ test("o-p05fail5", () => {
+ // 2.3 [5] — a Name cannot start with an Extender
+ const input: string = "<·A/>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '·' (U+00B7)");
+ });
+
+ test("o-p09fail1", () => {
+ // 2.3 [9] — EntityValue excludes '%' (upstream: not-wf; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p09fail2", () => {
+ // 2.3 [9] — EntityValue excludes '&' (upstream: not-wf; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p09fail3", () => {
+ // 2.3 [9] — incomplete character reference
+ const input: string = '\r\n\r\n]>\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '\"'",
+ );
+ });
+
+ test("o-p09fail4", () => {
+ // 2.3 [9] — quote types must match
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Unterminated entity value");
+ });
+
+ test("o-p09fail5", () => {
+ // 2.3 [9] — quote types must match
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Unterminated entity value");
+ });
+
+ test("o-p10fail1", () => {
+ // 2.3 [10] — attribute values exclude '<'
+ const input: string = '\r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("o-p10fail2", () => {
+ // 2.3 [10] — attribute values exclude '&'
+ const input: string = '\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name after '&' but found '\"'");
+ });
+
+ test("o-p10fail3", () => {
+ // 2.3 [10] — quote types must match
+ const input: string = "\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Unterminated quoted string");
+ });
+
+ test("o-p11fail2", () => {
+ // 2.3 [11] — cannot contain delimiting quotes
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the notation declaration but found '\"'");
+ });
+
+ test("o-p12fail1", () => {
+ // 2.3 [12] — '"' excluded
+ const input: string =
+ "\r\n\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '\"'");
+ });
+
+ test("o-p12fail2", () => {
+ // 2.3 [12] — '\' excluded
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '\\'");
+ });
+
+ test("o-p12fail3", () => {
+ // 2.3 [12] — entity references excluded
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '&'");
+ });
+
+ test("o-p12fail4", () => {
+ // 2.3 [12] — '>' excluded
+ const input: string =
+ '\r\n\r\n">\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '>'");
+ });
+
+ test("o-p12fail5", () => {
+ // 2.3 [12] — '<' excluded
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '<'");
+ });
+
+ test("o-p12fail6", () => {
+ // 2.3 [12] — built-in entity refs excluded
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '&'");
+ });
+
+ test("o-p12fail7", () => {
+ // 2.3 [13] — The public ID has a tab character, which is disallowed
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: tab");
+ });
+
+ test("o-p14fail1", () => {
+ // 2.4 [14] — '<' excluded
+ const input: string = "< \r\n";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found space");
+ });
+
+ test("o-p14fail2", () => {
+ // 2.4 [14] — '&' excluded
+ const input: string = "& \r\n";
+ expectRejects(input, "XML Parse error: Expected an entity name after '&' but found space");
+ });
+
+ test("o-p14fail3", () => {
+ // 2.4 [14] — "]]>" excluded
+ const input: string = "a]]>b\r\n";
+ expectRejects(input, "XML Parse error: ']]>' is only allowed as the end of a CDATA section");
+ });
+
+ test("o-p15fail1", () => {
+ // 2.5 [15] — comments can't end in '-'
+ const input: string = "\r\n";
+ expectRejects(input, "XML Parse error: '--' is not allowed inside a comment");
+ });
+
+ test("o-p15fail2", () => {
+ // 2.5 [15] — one comment per comment (contrasted with SGML)
+ const input: string = "\r\n";
+ expectRejects(input, "XML Parse error: '--' is not allowed inside a comment");
+ });
+
+ test("o-p15fail3", () => {
+ // 2.5 [15] — can't include 2 or more adjacent '-'s
+ const input: string = "\r\n";
+ expectRejects(input, "XML Parse error: '--' is not allowed inside a comment");
+ });
+
+ test("o-p16fail1", () => {
+ // 2.6 [16] — "xml" is an invalid PITarget
+ const input: string = "\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.6 [16] — a PITarget must be present
+ const input: string = "?>\r\n";
+ expectRejects(input, "XML Parse error: Expected a processing instruction target after '' but found '?'");
+ });
+
+ test("o-p16fail3", () => {
+ // 2.6 [16] — S after PITarget is required
+ const input: string = "\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found '+'",
+ );
+ });
+
+ test("o-p18fail1", () => {
+ // 2.7 [18] — no space before "CDATA"
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 2.7 [18] — no space after "CDATA"
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 2.7 [18] — CDSect's can't nest
+ const input: string = "\r\n\r\n]]>\r\n";
+ expectRejects(input, "XML Parse error: ']]>' is only allowed as the end of a CDATA section");
+ });
+
+ test("o-p22fail1", () => {
+ // 2.8 [22] — prolog must start with XML decl
+ const input: string = '\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 [22] — prolog must start with XML decl
+ const input: string = '\r\n]>\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 [23] — "xml" must be lower-case
+ const input: string = '\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 [23] — VersionInfo must be supplied
+ const input = Buffer.from('\r\n\r\n');
+ expectRejects(input, 'XML Parse error: The XML declaration must start with version="1.0"');
+ });
+
+ test("o-p23fail3", () => {
+ // 2.8 [23] — VersionInfo must come first
+ const input = Buffer.from('\r\n\r\n');
+ expectRejects(input, 'XML Parse error: The XML declaration must start with version="1.0"');
+ });
+
+ test("o-p23fail4", () => {
+ // 2.8 [23] — SDDecl must come last
+ const input = Buffer.from('\r\n\r\n');
+ expectRejects(
+ input,
+ "XML Parse error: Misplaced 'encoding' in the XML declaration (the order is version, encoding, standalone)",
+ );
+ });
+
+ test("o-p23fail5", () => {
+ // 2.8 [23] — no SGML-type PIs
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '?>' to end the XML declaration but found '>'");
+ });
+
+ test("o-p24fail1", () => {
+ // 2.8 [24] — quote types must match
+ const input: string = "\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in a quoted string: '>'");
+ });
+
+ test("o-p24fail2", () => {
+ // 2.8 [24] — quote types must match
+ const input: string = "\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in a quoted string: '>'");
+ });
+
+ test("o-p25fail1", () => {
+ // 2.8 [25] — Comment is illegal in VersionInfo.
+ const input: string = ' ="1.0"?>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found a comment");
+ });
+
+ test("o-p26fail1", () => {
+ // 2.8 [26] — Illegal character in VersionNum.
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Unsupported XML version '1.0?' (this is an XML 1.0 parser)");
+ });
+
+ test("o-p26fail2", () => {
+ // 2.8 [26] — Illegal character in VersionNum.
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Unsupported XML version '1.0^' (this is an XML 1.0 parser)");
+ });
+
+ test("o-p27fail1", () => {
+ // 2.8 [27] — References aren't allowed in Misc, even if they would resolve to valid Misc.
+ const input: string = '\r\n \r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the root element but found '&'");
+ });
+
+ test("o-p28fail1", () => {
+ // 2.8 [28] — only declarations in DTD.
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected a markup declaration or ']' in the internal subset but found ' {
+ // 2.8 [29] — A processor must not pass unknown declaration types.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 [30] — An XML declaration is not the same as a TextDecl (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p31fail1", () => {
+ // 2.8 [31] — external subset excludes doctypedecl (upstream: not-wf; external parameter entities are
+ // not read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p32fail1", () => {
+ // 2.9 [32] — quote types must match
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a quoted string: '>'");
+ });
+
+ test("o-p32fail2", () => {
+ // 2.9 [32] — quote types must match
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a quoted string: '>'");
+ });
+
+ test("o-p32fail3", () => {
+ // 2.9 [32] — initial S is required
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'standalone'");
+ });
+
+ test("o-p32fail4", () => {
+ // 2.9 [32] — quotes are required
+ const input: string = '\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted value in the XML declaration but found 'yes'");
+ });
+
+ test("o-p32fail5", () => {
+ // 2.9 [32] — yes or no must be lower case
+ const input: string = '\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid value 'YES' for standalone in the XML declaration (expected yes or no)",
+ );
+ });
+
+ test("o-p39fail1", () => {
+ // 3 [39] — start-tag requires end-tag
+ const input: string = "content";
+ expectRejects(input, "XML Parse error: Missing closing tag for element 'doc'");
+ });
+
+ test("o-p39fail2", () => {
+ // 3 [39] — end-tag requires start-tag
+ const input: string = "content";
+ expectRejects(input, "XML Parse error: Expected closing tag but found ");
+ });
+
+ test("o-p39fail3", () => {
+ // 3 [39] — XML documents contain one or more elements
+ const input: string = "";
+ expectRejects(input, "XML Parse error: XML document must have a root element");
+ });
+
+ test("o-p39fail4", () => {
+ // 2.8 [23] — XML declarations must be correctly terminated
+ const input: string = '\r\n';
+ expectRejects(input, "XML Parse error: Expected '?>' to end the XML declaration but found '>'");
+ });
+
+ test("o-p39fail5", () => {
+ // 2.8 [23] — XML declarations must be correctly terminated
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '?>' to end the XML declaration but found '>'");
+ });
+
+ test("o-p40fail1", () => {
+ // 3.1 [40] — S is required between attributes
+ const input: string = '';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'att2'");
+ });
+
+ test("o-p40fail2", () => {
+ // 3.1 [40] — tags start with names, not nmtokens
+ const input: string = "<3notname>3notname>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '3'");
+ });
+
+ test("o-p40fail3", () => {
+ // 3.1 [40] — tags start with names, not nmtokens
+ const input: string = "<3notname>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '3'");
+ });
+
+ test("o-p40fail4", () => {
+ // 3.1 [40] — no space before name
+ const input: string = "< doc>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found space");
+ });
+
+ test("o-p41fail1", () => {
+ // 3.1 [41] — quotes are required (contrast with SGML)
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'att'");
+ });
+
+ test("o-p41fail2", () => {
+ // 3.1 [41] — attribute name is required (contrast with SGML)
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'att'");
+ });
+
+ test("o-p41fail3", () => {
+ // 3.1 [41] — Eq required
+ const input: string = '';
+ expectRejects(input, "XML Parse error: Expected '=' after the attribute name but found '\"'");
+ });
+
+ test("o-p42fail1", () => {
+ // 3.1 [42] — no space before name
+ const input: string = " doc>";
+ expectRejects(input, "XML Parse error: Expected an element name after '' but found space");
+ });
+
+ test("o-p42fail2", () => {
+ // 3.1 [42] — cannot end with "/>"
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Expected '>' to end the closing tag but found '/>'");
+ });
+
+ test("o-p42fail3", () => {
+ // 3.1 [42] — no NET (contrast with SGML)
+ const input: string = "' after '/' but found 'd'");
+ });
+
+ test("o-p43fail1", () => {
+ // 3.1 [43] — no non-comment declarations
+ const input: string =
+ '\r\nCharData">\r\n]>\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 [43] — no conditional sections
+ const input: string =
+ '\r\nCharData">\r\n]>\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 [43] — no conditional sections
+ const input: string =
+ '\r\nCharData">\r\n]>\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 [44] — Illegal space before Empty element tag.
+ const input: string = "< doc/>";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found space");
+ });
+
+ test("o-p44fail2", () => {
+ // 3.1 [44] — Illegal space after Empty element tag.
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Expected '>' after '/' but found space");
+ });
+
+ test("o-p44fail3", () => {
+ // 3.1 [44] — Illegal comment in Empty element tag.
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '--bad'");
+ });
+
+ test("o-p44fail4", () => {
+ // 3.1 [44] — Whitespace required between attributes.
+ const input: string = '';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'att2'");
+ });
+
+ test("o-p44fail5", () => {
+ // 3.1 [44] — Duplicate attribute name is illegal.
+ const input: string = '';
+ expectRejects(input, "XML Parse error: Duplicate attribute 'att'");
+ });
+
+ test("o-p45fail1", () => {
+ // 3.2 [45] — ELEMENT must be upper case.
+ const input: string = "\r\n]>\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 3.2 [45] — S before contentspec is required.
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Whitespace is required before '('");
+ });
+
+ test("o-p45fail3", () => {
+ // 3.2 [45] — only one content spec
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected an element name after ' {
+ // 3.2 [45] — no comments in declarations (contrast with SGML)
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '--bad'");
+ });
+
+ test("o-p46fail1", () => {
+ // 3.2 [46] — no parens on declared content
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '#EMPTY'");
+ });
+
+ test("o-p46fail2", () => {
+ // 3.2 [46] — no inclusions (contrast with SGML)
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '+'");
+ });
+
+ test("o-p46fail3", () => {
+ // 3.2 [46] — no exclusions (contrast with SGML)
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '-'");
+ });
+
+ test("o-p46fail4", () => {
+ // 3.2 [46] — no space before occurrence
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("o-p46fail5", () => {
+ // 3.2 [46] — single group
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '('");
+ });
+
+ test("o-p46fail6", () => {
+ // 3.2 [46] — can't be both declared and modeled
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '('");
+ });
+
+ test("o-p47fail1", () => {
+ // 3.2.1 [47] — Invalid operator '|' must match previous operator ','
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: A content model group cannot mix ',' and '|'");
+ });
+
+ test("o-p47fail2", () => {
+ // 3.2.1 [47] — Illegal character '-' in Element-content model
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '-'");
+ });
+
+ test("o-p47fail3", () => {
+ // 3.2.1 [47] — Optional character must follow a name or list
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '*'");
+ });
+
+ test("o-p47fail4", () => {
+ // 3.2.1 [47] — Illegal space before optional character
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("o-p48fail1", () => {
+ // 3.2.1 [48] — Illegal space before optional character
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("o-p48fail2", () => {
+ // 3.2.1 [48] — Illegal space before optional character
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("o-p49fail1", () => {
+ // 3.2.1 [49] — connectors must match
+ const input: string = "\r\n\r\n";
+ expectRejects(input, "XML Parse error: A content model group cannot mix ',' and '|'");
+ });
+
+ test("o-p50fail1", () => {
+ // 3.2.1 [50] — connectors must match
+ const input: string = "\r\n\r\n";
+ expectRejects(input, "XML Parse error: A content model group cannot mix ',' and '|'");
+ });
+
+ test("o-p51fail1", () => {
+ // 3.2.2 [51] — occurrence on #PCDATA group must be *
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: A mixed content model may only be followed by '*'");
+ });
+
+ test("o-p51fail2", () => {
+ // 3.2.2 [51] — occurrence on #PCDATA group must be *
+ const input: string = "\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: A mixed content model may only be followed by '*'");
+ });
+
+ test("o-p51fail3", () => {
+ // 3.2.2 [51] — #PCDATA must come first
+ const input: string =
+ "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: #PCDATA must come first in a content model, as (#PCDATA|a|b)*");
+ });
+
+ test("o-p51fail4", () => {
+ // 3.2.2 [51] — occurrence on #PCDATA group must be *
+ const input: string =
+ "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: A mixed content model may only be followed by '*'");
+ });
+
+ test("o-p51fail5", () => {
+ // 3.2.2 [51] — only '|' connectors
+ const input: string =
+ "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: A mixed content model is separated by '|', not ','");
+ });
+
+ test("o-p51fail6", () => {
+ // 3.2.2 [51] — Only '|' connectors and occurrence on #PCDATA group must be *
+ const input: string =
+ "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: A mixed content model is separated by '|', not ','");
+ });
+
+ test("o-p51fail7", () => {
+ // 3.2.2 [51] — no nested groups
+ const input: string =
+ "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Only element names may follow #PCDATA in a mixed content model");
+ });
+
+ test("o-p52fail1", () => {
+ // 3.3 [52] — A name is required
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected an element name after ''");
+ });
+
+ test("o-p52fail2", () => {
+ // 3.3 [52] — A name is required
+ const input: string = "\r\n\r\n]>\r\n";
+ expectRejects(input, "XML Parse error: Expected an element name after ''");
+ });
+
+ test("o-p53fail1", () => {
+ // 3.3 [53] — S is required before default
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Whitespace is required before '#IMPLIED'");
+ });
+
+ test("o-p53fail2", () => {
+ // 3.3 [53] — S is required before type
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Whitespace is required before '('");
+ });
+
+ test("o-p53fail3", () => {
+ // 3.3 [53] — type is required
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found '#IMPLIED'",
+ );
+ });
+
+ test("o-p53fail4", () => {
+ // 3.3 [53] — default is required
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '>'",
+ );
+ });
+
+ test("o-p53fail5", () => {
+ // 3.3 [53] — name is requried
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '('");
+ });
+
+ test("o-p54fail1", () => {
+ // 3.3.1 [54] — don't pass unknown attribute types
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'DUNNO'",
+ );
+ });
+
+ test("o-p55fail1", () => {
+ // 3.3.1 [55] — must be upper case
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'cdata'",
+ );
+ });
+
+ test("o-p56fail1", () => {
+ // 3.3.1 [56] — no IDS type
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'IDS'",
+ );
+ });
+
+ test("o-p56fail2", () => {
+ // 3.3.1 [56] — no NUMBER type
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NUMBER'",
+ );
+ });
+
+ test("o-p56fail3", () => {
+ // 3.3.1 [56] — no NAME type
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NAME'",
+ );
+ });
+
+ test("o-p56fail4", () => {
+ // 3.3.1 [56] — no ENTITYS type - types must be upper case
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'ENTITYS'",
+ );
+ });
+
+ test("o-p56fail5", () => {
+ // 3.3.1 [56] — types must be upper case
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'id'",
+ );
+ });
+
+ test("o-p57fail1", () => {
+ // 3.3.1 [57] — no keyword for NMTOKEN enumeration
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '('",
+ );
+ });
+
+ test("o-p58fail1", () => {
+ // 3.3.1 [58] — at least one value required
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name but found ')'");
+ });
+
+ test("o-p58fail2", () => {
+ // 3.3.1 [58] — separator must be '|'
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found ','");
+ });
+
+ test("o-p58fail3", () => {
+ // 3.3.1 [58] — notations are NAMEs, not NMTOKENs -- note: Leaving the invalid notation undeclared
+ // would cause a validating parser to fail without checking the name syntax, so the notation is
+ // declared with an invalid name. A parser that reports error positions should report an error at the
+ // AttlistDecl on line 6, before reaching the notation declaration.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name but found '0b'");
+ });
+
+ test("o-p58fail4", () => {
+ // 3.3.1 [58] — NOTATION must be upper case
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'notation'",
+ );
+ });
+
+ test("o-p58fail5", () => {
+ // 3.3.1 [58] — S after keyword is required
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '('");
+ });
+
+ test("o-p58fail6", () => {
+ // 3.3.1 [58] — parentheses are require
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '(' after NOTATION but found 'a'");
+ });
+
+ test("o-p58fail7", () => {
+ // 3.3.1 [58] — values are unquoted
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '(' after NOTATION but found '\"'");
+ });
+
+ test("o-p58fail8", () => {
+ // 3.3.1 [58] — values are unquoted
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name but found '\"'");
+ });
+
+ test("o-p59fail1", () => {
+ // 3.3.1 [59] — at least one required
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a name token in the enumeration but found ')'");
+ });
+
+ test("o-p59fail2", () => {
+ // 3.3.1 [59] — separator must be ","
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found ','");
+ });
+
+ test("o-p59fail3", () => {
+ // 3.3.1 [59] — values are unquoted
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a name token in the enumeration but found '\"'");
+ });
+
+ test("o-p60fail1", () => {
+ // 3.3.2 [60] — keywords must be upper case
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '#implied'",
+ );
+ });
+
+ test("o-p60fail2", () => {
+ // 3.3.2 [60] — S is required after #FIXED
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("o-p60fail3", () => {
+ // 3.3.2 [60] — only #FIXED has both keyword and value
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '\"'",
+ );
+ });
+
+ test("o-p60fail4", () => {
+ // 3.3.2 [60] — #FIXED required value
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a quoted default value after #FIXED but found '>'");
+ });
+
+ test("o-p60fail5", () => {
+ // 3.3.2 [60] — only one default type
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '#REQUIRED'",
+ );
+ });
+
+ test("o-p61fail1", () => {
+ // 3.4 [61] — no other types, including TEMP, which is valid in SGML (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p62fail1", () => {
+ // 3.4 [62] — INCLUDE must be upper case (upstream: not-wf; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p62fail2", () => {
+ // 3.4 [62] — no spaces in terminating delimiter (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p63fail1", () => {
+ // 3.4 [63] — IGNORE must be upper case (upstream: not-wf; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p63fail2", () => {
+ // 3.4 [63] — delimiters must be balanced (upstream: not-wf; external parameter entities are not read)
+ const input: string = '\r\n';
+ expectParses(input);
+ });
+
+ test("o-p64fail1", () => {
+ // 3.4 [64] — section delimiters must balance (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p64fail2", () => {
+ // 3.4 [64] — section delimiters must balance (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string = '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("o-p66fail1", () => {
+ // 4.1 [66] — terminating ';' is required
+ const input: string = "A";
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '<'",
+ );
+ });
+
+ test("o-p66fail2", () => {
+ // 4.1 [66] — no S after ''
+ const input: string = " 65;";
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found space",
+ );
+ });
+
+ test("o-p66fail3", () => {
+ // 4.1 [66] — no hex digits in numeric reference
+ const input: string = "A;";
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found 'A'",
+ );
+ });
+
+ test("o-p66fail4", () => {
+ // 4.1 [66] — only hex digits in hex references
+ const input: string = "G;";
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found 'G'",
+ );
+ });
+
+ test("o-p66fail5", () => {
+ // 4.1 [66] — no references to non-characters
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Character reference '' is not a valid XML character");
+ });
+
+ test("o-p66fail6", () => {
+ // 4.1 [66] — no references to non-characters
+ const input: string = "";
+ expectRejects(input, "XML Parse error: Character reference '' is not a valid XML character");
+ });
+
+ test("o-p68fail1", () => {
+ // 4.1 [68] — terminating ';' is required
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n&ent\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found newline");
+ });
+
+ test("o-p68fail2", () => {
+ // 4.1 [68] — no S after '&'
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n& ent;\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name after '&' but found space");
+ });
+
+ test("o-p68fail3", () => {
+ // 4.1 [68] — no S before ';'
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n&ent ;\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found space");
+ });
+
+ test("o-p69fail1", () => {
+ // 4.1 [69] — terminating ';' is required
+ const input: string =
+ '\r\n">\r\n%pe\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' to end the parameter entity reference 'pe'");
+ });
+
+ test("o-p69fail2", () => {
+ // 4.1 [69] — no S after '%'
+ const input: string =
+ '\r\n">\r\n% pe;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '%'");
+ });
+
+ test("o-p69fail3", () => {
+ // 4.1 [69] — no S before ';'
+ const input: string =
+ '\r\n">\r\n%pe ;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' to end the parameter entity reference 'pe'");
+ });
+
+ test("o-p70fail1", () => {
+ // 4.2 [70] — This is neither
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name or '%' after ' {
+ // 4.2 [71] — S is required before EntityDef
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("o-p71fail2", () => {
+ // 4.2 [71] — Entity name is a Name, not an NMToken
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name or '%' after ' {
+ // 4.2 [71] — no S after "\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 4.2 [71] — S is required after "\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'ge'");
+ });
+
+ test("o-p72fail1", () => {
+ // 4.2 [72] — S is required after "\r\n">\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '%'");
+ });
+
+ test("o-p72fail2", () => {
+ // 4.2 [72] — S is required after '%'
+ const input: string =
+ '\r\n">\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Whitespace is required between '%' and the name in a parameter entity declaration",
+ );
+ });
+
+ test("o-p72fail3", () => {
+ // 4.2 [72] — S is required after name
+ const input: string =
+ '\r\n">\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("o-p72fail4", () => {
+ // 4.2 [72] — Entity name is a name, not an NMToken
+ const input: string =
+ '\r\n">\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the parameter entity name after '%' but found '.pe'");
+ });
+
+ test("o-p73fail1", () => {
+ // 4.2 [73] — No typed replacement text
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found 'CDATA'");
+ });
+
+ test("o-p73fail2", () => {
+ // 4.2 [73] — Only one replacement value
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found '\"'");
+ });
+
+ test("o-p73fail3", () => {
+ // 4.2 [73] — No NDataDecl on replacement text
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'NDATA'");
+ });
+
+ test("o-p73fail4", () => {
+ // 4.2 [73] — Value is required
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found '>'");
+ });
+
+ test("o-p73fail5", () => {
+ // 4.2 [73] — No NDataDecl without value
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found 'NDATA'");
+ });
+
+ test("o-p74fail1", () => {
+ // 4.2 [74] — no NDataDecls on parameter entities
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Parameter entities cannot have NDATA");
+ });
+
+ test("o-p74fail2", () => {
+ // 4.2 [74] — value is required
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found '>'");
+ });
+
+ test("o-p74fail3", () => {
+ // 4.2 [74] — only one value
+ const input: string = '" SYSTEM "nop.ent">\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'SYSTEM'");
+ });
+
+ test("o-p75fail1", () => {
+ // 4.2.2 [75] — S required after "PUBLIC"
+ const input: string = '\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("o-p75fail2", () => {
+ // 4.2.2 [75] — S required after "SYSTEM"
+ const input: string = '\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("o-p75fail3", () => {
+ // 4.2.2 [75] — S required between literals
+ const input: string = '\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("o-p75fail4", () => {
+ // 4.2.2 [75] — "SYSTEM" implies only one literal
+ const input: string = '\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found '\"'");
+ });
+
+ test("o-p75fail5", () => {
+ // 4.2.2 [75] — only one keyword
+ const input: string = '\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a quoted system identifier after the public identifier but found 'SYSTEM'",
+ );
+ });
+
+ test("o-p75fail6", () => {
+ // 4.2.2 [75] — "PUBLIC" requires two literals (contrast with SGML)
+ const input: string = '\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a quoted system identifier after the public identifier but found '>'",
+ );
+ });
+
+ test("o-p76fail1", () => {
+ // 4.2.2 [76] — S is required before "NDATA"
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'NDATA'");
+ });
+
+ test("o-p76fail2", () => {
+ // 4.2.2 [76] — "NDATA" is upper-case
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'ndata'");
+ });
+
+ test("o-p76fail3", () => {
+ // 4.2.2 [76] — notation name is required
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name after NDATA but found '>'");
+ });
+
+ test("o-p76fail4", () => {
+ // 4.2.2 [76] — notation names are Names
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name after NDATA but found '-unknot'");
+ });
+
+ test("o-p11pass1", () => {
+ // 2.3, 4.2.2 [11] — system literals may not contain URI fragments (upstream: optional error)
+ const input: string =
+ '\r\n\r\n?>/\\\'\'">\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+});
+
+describe("ibm", () => {
+ test("ibm-invalid-P28-ibm28i01.xml", () => {
+ // 2.8 — The test violates VC:Root Element Type in P28. The Name in the document type declaration does
+ // not match the element type of the root element.
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n \r\n",
+ );
+ const canonical = "";
+ const compact: unknown = { animal: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P32-ibm32i01.xml", () => {
+ // 2.9 — This test violates VC: Standalone Document Declaration in P32. The standalone document
+ // declaration has the value yes, BUT there is an external markup declaration of attributes with
+ // default values, and the associated element appears in the document with specified values for those
+ // attributes. (upstream: invalid; external parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-invalid-P32-ibm32i03.xml", () => {
+ // 2.9 — This test violates VC: Standalone Document Declaration in P32. The standalone document
+ // declaration has the value yes, BUT there is an external markup declaration of attributes with values
+ // that will change if normalized. (upstream: invalid; external parameter entities are not read; output
+ // depends on them)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-invalid-P32-ibm32i04.xml", () => {
+ // 2.9 — This test violates VC: Standalone Document Declaration in P32. The standalone document
+ // declaration has the value yes, BUT there is an external markup declaration of element with element
+ // content, and white space occurs directly within the mixed content. (upstream: invalid; external
+ // parameter entities are not read)
+ const input: string =
+ "\r\n\r\n]>\r\n\r\nThis is a \r\n\r\nyellow tiger \r\n\r\n\r\n\r\n";
+ const canonical =
+ 'This is a
yellow tiger
';
+ const compact: unknown = {
+ animal: { "@xml:space": "preserve", a: "This is a \n\nyellow tiger", b: "", c: "" },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P39-ibm39i01.xml", () => {
+ // 3 — This test violates VC: Element Valid in P39. Element a is declared empty in DTD, but has content
+ // in the document.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n\r\n]>\r\n\r\nshould not have content here\r\n \r\n content of b element\r\n\r\n\r\n';
+ const canonical =
+ "should not have content here
content of b element
";
+ const compact: unknown = {
+ root: {
+ a: "should not have content here",
+ b: { c: "", "#text": "content of b element" },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P39-ibm39i02.xml", () => {
+ // 3 — This test violates VC: Element Valid in P39. root is declared only having element children in
+ // DTD, but have text content in the document.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n\r\n]>\r\n\r\n\r\n root can\'t have text content\r\n\r\n \r\n content of b element\r\n\r\n\r\n';
+ const canonical =
+ "
root can't have text content
content of b element
";
+ const compact: unknown = {
+ root: {
+ a: "",
+ b: { c: "", "#text": "content of b element" },
+ "#text": "root can't have text content",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P39-ibm39i03.xml", () => {
+ // 3 — This test violates VC: Element Valid in P39. Illegal elements are inserted in b's content of
+ // Mixed type.
+ const input: string =
+ "\r\n\r\n \r\n \r\n \r\n]>\r\n\r\n\r\n \r\n content of b element\r\n \r\n could not have 'a' as 'b's content\r\n\r\n\r\n";
+ const canonical =
+ "
content of b element
could not have 'a' as 'b's content
";
+ const compact: unknown = {
+ root: {
+ a: "",
+ b: {
+ c: "",
+ a: "",
+ "#text": "content of b element\n \n could not have 'a' as 'b's content",
+ },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P39-ibm39i04.xml", () => {
+ // 3 — This test violates VC: Element Valid in P39. Element c has undeclared element as its content of
+ // ANY type
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n\r\n \r\n content of b element\r\n \r\n not declared in dtd\r\n \r\n\r\n\r\n';
+ const canonical =
+ "
content of b element
not declared in dtd
";
+ const compact: unknown = {
+ root: {
+ a: "",
+ b: {
+ c: [{ f: "" }, { d: "not declared in dtd" }],
+ "#text": "content of b element",
+ },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P41-ibm41i01.xml", () => {
+ // 3.1 — This test violates VC: Attribute Value Type in P41. attr1 for Element b is not declared.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n]>\r\n\r\n attr1 not declared\r\n\r\n\r\n';
+ const canonical = '
attr1 not declared
';
+ const compact: unknown = {
+ root: {
+ b: {
+ "@attr1": "value1",
+ "@attr2": "def",
+ "@attr3": "fixed",
+ "#text": "attr1 not declared",
+ },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P41-ibm41i02.xml", () => {
+ // 3.1 — This test violates VC: Attribute Value Type in P41. attr3 for Element b is given a value that
+ // does not match the declaration in the DTD.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n attr3 value not fixed\r\n\r\n\r\n';
+ const canonical =
+ '
attr3 value not fixed
';
+ const compact: unknown = {
+ root: {
+ b: {
+ "@attr1": "value1",
+ "@attr2": "abc",
+ "@attr3": "shoudbefixed",
+ "#text": "attr3 value not fixed",
+ },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P45-ibm45i01.xml", () => {
+ // 3.2 — This test violates VC: Unique Element Type Declaration. Element not_unique has been declared 3
+ // time in the DTD.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n without white space\r\n with a white space\r\n \r\n \r\n\r\n\r\n';
+ const canonical =
+ '
without white space
with a white space
';
+ const compact: unknown = {
+ root: {
+ b: ["", "", { "@attr1": "value1" }, { "@attr1": "value1", "@attr2": "value2", "@attr3": "value3" }],
+ "#text": "without white space\n with a white space",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P49-ibm49i01.xml", () => {
+ // 3.2.1 — Violates VC:Proper Group/PE Nesting in P49. Open and close parenthesis for a choice content
+ // model are in different PE replace Texts. (upstream: invalid; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n \r\n content of b element\r\n\r\n\r\n';
+ const canonical = "
content of b element
";
+ const compact: unknown = { root: { a: "", b: { c: "", "#text": "content of b element" } } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P50-ibm50i01.xml", () => {
+ // 3.2.1 — Violates VC:Proper Group/PE Nesting in P50. Open and close parenthesis for a seq content
+ // model are in different PE replace Texts. (upstream: invalid; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n \r\n content of b element\r\n\r\n\r\n';
+ const canonical = "
content of b element
";
+ const compact: unknown = { root: { a: "", b: { c: "", "#text": "content of b element" } } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P51-ibm51i01.xml", () => {
+ // 3.2.2 — Violates VC:Proper Group/PE Nesting in P51. Open and close parenthesis for a Mixed content
+ // model are in different PE replace Texts. (upstream: invalid; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n Element type a \r\n Element type b \r\n\r\n';
+ const canonical = "
Element type a
Element type b
";
+ const compact: unknown = { root: { a: "Element type a", b: "Element type b" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P51-ibm51i03.xml", () => {
+ // 3.2.2 — Violates VC:No Duplicate Types in P51. Element a appears twice in the Mixed content model of
+ // Element e.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n Element type a \r\n Element type b \r\n\r\n\r\n';
+ const canonical = "
Element type a
Element type b
";
+ const compact: unknown = { root: { a: "Element type a", b: "Element type b" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i01.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: ID. The value of the ID attribute
+ // "UniqueName" is "@999" which does not meet the Name production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n ]>\r\n\r\nThis is a negative test for validity constraints\r\nthe value of the attribute with a type ID does not match the Name production\r\n';
+ const canonical =
+ '
This is a negative test for validity constraints
the value of the attribute with a type ID does not match the Name production
';
+ const compact: unknown = {
+ tokenizer: {
+ "@UniqueName": "@c999",
+ "#text":
+ "This is a negative test for validity constraints\nthe value of the attribute with a type ID does not match the Name production",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i02.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: ID. The two ID attributes "attr" and
+ // "UniqueName" have the same value "Ac999" for the element "b" and the element "tokenizer".
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n\r\n\r\nThis is a negative test for validity constraints\r\nthe value of the attribute with a type ID appears more than once in the XML document\r\n\r\n';
+ const canonical =
+ '
This is a negative test for validity constraints
the value of the attribute with a type ID appears more than once in the XML document
';
+ const compact: unknown = {
+ tokenizer: {
+ "@UniqueName": "Ac999",
+ b: { "@attr": "Ac999" },
+ "#text":
+ "This is a negative test for validity constraints\nthe value of the attribute with a type ID appears more than once in the XML document",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i03.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: ID Attribute Default. The "#FIXED"
+ // occurs in the DefaultDecl for the ID attribute "UniqueName".
+ const input: string =
+ '\r\n\r\n\r\n \r\n ]>\r\n\r\nThis is a Negative validity test for ID Attribute Default.\r\nGiving the attribute default as #FIXED\r\n\r\n';
+ const canonical =
+ '
This is a Negative validity test for ID Attribute Default.
Giving the attribute default as #FIXED
';
+ const compact: unknown = {
+ tokenizer: {
+ "@UniqueName": "AC1999",
+ "#text": "This is a Negative validity test for ID Attribute Default.\nGiving the attribute default as #FIXED",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i05.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: ID Attribute Default. The constant
+ // string "BOGUS" occurs in the DefaultDecl for the ID attribute "UniqueName".
+ const input: string =
+ '\r\n\r\n\r\n \r\n ]>\r\n\r\nThis is a Negative validity test for ID Attribute Default.\r\nGiving the attibute default as a const string\r\n\r\n';
+ const canonical =
+ '
This is a Negative validity test for ID Attribute Default.
Giving the attibute default as a const string
';
+ const compact: unknown = {
+ tokenizer: {
+ "@UniqueName": "AC1999",
+ "#text":
+ "This is a Negative validity test for ID Attribute Default.\nGiving the attibute default as a const string",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i06.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: One ID per Element Type. The element
+ // "a" has two ID attributes "first" and "second".
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n\r\n\r\nThis is a Negative validity test for ID.\r\nThere is more than attribute of type ID for the element a\r\n\r\n\r\n';
+ const canonical =
+ '
This is a Negative validity test for ID.
There is more than attribute of type ID for the element a
';
+ const compact: unknown = {
+ tokenizer: {
+ a: { "@first": "AC1999", "@second": "BC1999" },
+ "#text": "This is a Negative validity test for ID.\nThere is more than attribute of type ID for the element a",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i07.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: IDREF. The value of the IDREF attribute
+ // "reference" is "@456" which does not meet the Name production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n\r\n\r\n\r\nNegative test for validity constraint of IDREF.\r\nIn an attribute decl, values of type IDREF does not match the name production\r\n';
+ const canonical =
+ '
Negative test for validity constraint of IDREF.
In an attribute decl, values of type IDREF does not match the name production
';
+ const compact: unknown = {
+ test: {
+ id: { "@UniqueName": "AC456" },
+ idref: { "@reference": "@456" },
+ "#text":
+ "Negative test for validity constraint of IDREF.\nIn an attribute decl, values of type IDREF does not match the name production",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i08.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: IDREF. The value of the IDREF attribute
+ // "reference" is "BC456" which does not match the value assigned to any ID attributes.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n\r\n\r\n\r\nNegative test for validity constraint of IDREF.\r\nIn an attribute decl, values of type IDREF match the name production and\r\nIDREF value does not match the value assigned to any ID attribute somewhere\r\nin the XML document.\r\n';
+ const canonical =
+ '
Negative test for validity constraint of IDREF.
In an attribute decl, values of type IDREF match the name production and
IDREF value does not match the value assigned to any ID attribute somewhere
in the XML document.
';
+ const compact: unknown = {
+ test: {
+ id: { "@UniqueName": "AC456" },
+ idref: { "@reference": "BC456" },
+ "#text":
+ "Negative test for validity constraint of IDREF.\nIn an attribute decl, values of type IDREF match the name production and\nIDREF value does not match the value assigned to any ID attribute somewhere\nin the XML document.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i09.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: IDREFS. The value of the IDREFS
+ // attribute "reference" is "AC456 #567" which does not meet the Names production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n ]>\r\n\r\n\r\n\r\n\r\nNegative test for validity constraint of IDREFS.\r\nIn an attribute decl, values of type IDREFS does not match the name production\r\n';
+ const canonical =
+ '
Negative test for validity constraint of IDREFS.
In an attribute decl, values of type IDREFS does not match the name production
';
+ const compact: unknown = {
+ test: {
+ id1: { "@UniqueName": "AC456" },
+ id2: { "@UName": "BC567" },
+ idrefs: { "@reference": "AC456 #567" },
+ "#text":
+ "Negative test for validity constraint of IDREFS.\nIn an attribute decl, values of type IDREFS does not match the name production",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i10.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: IDREFS. The value of the IDREFS
+ // attribute "reference" is "EF456 DE355" which does not match the values assigned to two ID
+ // attributes.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n ]>\r\n\r\n\r\n\r\n\r\nNegative test for validity constraint of IDREFS.\r\nIn an attribute decl, values of type IDREFS match the name production\r\nbut IDREFS value do not match the values assigned to one or more ID attributes\r\nsomewhere in the XML document\r\n';
+ const canonical =
+ '
Negative test for validity constraint of IDREFS.
In an attribute decl, values of type IDREFS match the name production
but IDREFS value do not match the values assigned to one or more ID attributes
somewhere in the XML document
';
+ const compact: unknown = {
+ test: {
+ id1: { "@UniqueName": "BC456" },
+ id2: { "@UName": "AC567" },
+ idrefs: { "@reference": "EF456 DE355" },
+ "#text":
+ "Negative test for validity constraint of IDREFS.\nIn an attribute decl, values of type IDREFS match the name production\nbut IDREFS value do not match the values assigned to one or more ID attributes\nsomewhere in the XML document",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i11.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: Entity Name. The value of the ENTITY
+ // attribute "sun" is "ima ge" which does not meet the Name production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n]>\r\n\r\n\r\nIn the attribute decl, values of type ENTITY do not match the Name production\r\n';
+ const canonical =
+ '
In the attribute decl, values of type ENTITY do not match the Name production
';
+ const compact: unknown = {
+ test: {
+ landscape: { "@sun": "ima ge" },
+ "#text": "In the attribute decl, values of type ENTITY do not match the Name production",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i12.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: Entity Name. The value of the ENTITY
+ // attribute "sun" is "notimage" which does not match the name of any unparsed entity declared.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n]>\r\n\r\n\r\nIn the attribute decl, values of type ENTITY match the Name production\r\nbut does not match the name of any entity declared in the DTD\r\n';
+ const canonical =
+ '
In the attribute decl, values of type ENTITY match the Name production
but does not match the name of any entity declared in the DTD
';
+ const compact: unknown = {
+ test: {
+ landscape: { "@sun": "notimage" },
+ "#text":
+ "In the attribute decl, values of type ENTITY match the Name production\nbut does not match the name of any entity declared in the DTD",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i13.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: Entity Name. The value of the ENTITY
+ // attribute "sun" is "parsedentity" which matches the name of a parsed entity instead of an unparsed
+ // entity declared.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n]>\r\n\r\n\r\nIn an attribute declaration, values of type ENTITY match the Name production and the ENTITY value\r\nmatches the name of a parsed entity declared in the DTD. \r\n';
+ const canonical =
+ '
In an attribute declaration, values of type ENTITY match the Name production and the ENTITY value
matches the name of a parsed entity declared in the DTD.
';
+ const compact: unknown = {
+ test: {
+ landscape: { "@sun": "parsedentity" },
+ "#text":
+ "In an attribute declaration, values of type ENTITY match the Name production and the ENTITY value\nmatches the name of a parsed entity declared in the DTD.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i14.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: Entity Name. The value of the ENTITIES
+ // attribute "sun" is "#image1 @image" which does not meet the Names production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n\r\nIn an attribute declaration, values of type ENTITIES do not match the Name production.\r\n';
+ const canonical =
+ '
In an attribute declaration, values of type ENTITIES do not match the Name production.
';
+ const compact: unknown = {
+ test: {
+ landscape: { "@sun": "#image1 @image" },
+ "#text": "In an attribute declaration, values of type ENTITIES do not match the Name production.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i15.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: ENTITIES. The value of the ENTITIES
+ // attribute "sun" is "image3 image4" which does not match the names of two unparsed entities declared.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n\r\nIn an attribute declaration, values of type ENTITIES match the Name production and the ENTITIES value\r\ndoes not match one or more names of entities declared in the DTD. \r\n';
+ const canonical =
+ '
In an attribute declaration, values of type ENTITIES match the Name production and the ENTITIES value
does not match one or more names of entities declared in the DTD.
';
+ const compact: unknown = {
+ test: {
+ landscape: { "@sun": "image3 image4" },
+ "#text":
+ "In an attribute declaration, values of type ENTITIES match the Name production and the ENTITIES value\ndoes not match one or more names of entities declared in the DTD.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i16.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: ENTITIES. The value of the ENTITIES
+ // attribute "sun" is "parsedentity1 parsedentity2" which matches the names of two parsed entities
+ // instead of two unparsed entities declared.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n\r\nIn an attribute declaration, values of type ENTITIES match the Name production and the ENTITIES value\r\nmatches one or more names of parsed entities declared in the DTD. .\r\n';
+ const canonical =
+ '
In an attribute declaration, values of type ENTITIES match the Name production and the ENTITIES value
matches one or more names of parsed entities declared in the DTD. .
';
+ const compact: unknown = {
+ test: {
+ landscape: { "@sun": "parsedentity1 parsedentity2" },
+ "#text":
+ "In an attribute declaration, values of type ENTITIES match the Name production and the ENTITIES value\nmatches one or more names of parsed entities declared in the DTD. .",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i17.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: Name Token. The value of the NMTOKEN
+ // attribute "thistoken" is "x : image" which does not meet the Nmtoken production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n]>\r\n\r\n\r\nIn an attribute declaration, values of type NMTOKEN does not match the Nmtoken production\r\n';
+ const canonical =
+ '
In an attribute declaration, values of type NMTOKEN does not match the Nmtoken production
';
+ const compact: unknown = {
+ test: {
+ nametoken: { "@thistoken": "x : image" },
+ "#text": "In an attribute declaration, values of type NMTOKEN does not match the Nmtoken production",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P56-ibm56i18.xml", () => {
+ // 3.3.1 — Tests invalid TokenizedType which is against P56 VC: Name Token. The value of the NMTOKENS
+ // attribute "thistoken" is "@lang y: #country" which does not meet the Nmtokens production.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n]>\r\n\r\n\r\nIn an attribute declaration, values of type NMTOKENS does not match the Nmtokens production\r\n';
+ const canonical =
+ '
In an attribute declaration, values of type NMTOKENS does not match the Nmtokens production
';
+ const compact: unknown = {
+ test: {
+ nametokens: { "@thistoken": "@lang y: #country" },
+ "#text": "In an attribute declaration, values of type NMTOKENS does not match the Nmtokens production",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P58-ibm58i01.xml", () => {
+ // 3.3.1 — Tests invalid NotationType which is against P58 VC: Notation Attributes. The attribute
+ // "content-encoding" with value "raw" is not a value from the list "(base64|uuencode)".
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n ]>\r\n \r\n\r\nThe attribute values of type NOTATION does not match any of the notation names included in the\r\ndeclaration.All notation names in the declaration have been declared.\r\n';
+ const canonical =
+ '
The attribute values of type NOTATION does not match any of the notation names included in the
declaration.All notation names in the declaration have been declared.
';
+ const compact: unknown = {
+ test: {
+ blob: { "@content-encoding": "raw" },
+ "#text":
+ "The attribute values of type NOTATION does not match any of the notation names included in the\ndeclaration.All notation names in the declaration have been declared.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P58-ibm58i02.xml", () => {
+ // 3.3.1 — Tests invalid NotationType which is against P58 VC: Notation Attributes. The attribute
+ // "content-encoding" with value "raw" is a value from the list "(base64|uuencode|raw|ascii)", but
+ // "raw" is not a declared notation.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n \r\n\r\nThe attribute values of type NOTATION does match any of the notation names included in the\r\ndeclaration, but some of notation names in the declaration have not been declared\r\n';
+ const canonical =
+ '
The attribute values of type NOTATION does match any of the notation names included in the
declaration, but some of notation names in the declaration have not been declared
';
+ const compact: unknown = {
+ test: {
+ blob: { "@content-encoding": "raw" },
+ "#text":
+ "The attribute values of type NOTATION does match any of the notation names included in the\ndeclaration, but some of notation names in the declaration have not been declared",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P59-ibm59i01.xml", () => {
+ // 3.3.1 — Tests invalid Enumeration which is against P59 VC: Enumeration. The value of the attribute
+ // is "ONE" which matches neither "one" nor "two" as declared in the Enumeration in the AttDef in the
+ // AttlistDecl.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n \r\n\r\nThis is a Negative test\r\nThe attribute values of type Enumeration does not match any of the Nmtoken tokens in the declaration.\r\n';
+ const canonical =
+ '
This is a Negative test
The attribute values of type Enumeration does not match any of the Nmtoken tokens in the declaration.
';
+ const compact: unknown = {
+ test: {
+ num: { "@value": "ONE" },
+ "#text":
+ "This is a Negative test\nThe attribute values of type Enumeration does not match any of the Nmtoken tokens in the declaration.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P60-ibm60i01.xml", () => {
+ // 3.3.2 — Tests invalid DefaultDecl which is against P60 VC: Required Attribute. The attribute
+ // "chapter" for the element "two" is declared as #REQUIRED in the DefaultDecl in the AttlistDecl, but
+ // the value of this attribute is not given.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n\r\n\r\n\r\nNegative test for Required Attribute. Some occurrence of an element with \r\nan attribute of #REQUIRED default declaration does not give the value of \r\nthose attribute\r\n';
+ const canonical =
+ '
Negative test for Required Attribute. Some occurrence of an element with
an attribute of #REQUIRED default declaration does not give the value of
those attribute
';
+ const compact: unknown = {
+ Java: {
+ one: { "@chapter": "Introduction" },
+ two: "",
+ "#text":
+ "Negative test for Required Attribute. Some occurrence of an element with \nan attribute of #REQUIRED default declaration does not give the value of \nthose attribute",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P60-ibm60i02.xml", () => {
+ // 3.3.2 — Tests invalid DefaultDecl which is against P60 VC: Fixed Attribute Default.. The attribute
+ // "chapter" for the element "one" is declared as #FIXED with the given value "Introduction" in the
+ // DefaultDecl in the AttlistDecl, but the value of a instance of this attribute is assigned to
+ // "JavaBeans".
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative Test\r\nAn attribute has a default value declared with the #FIXED keyword, \r\nand an instances of that attribute is given a value which is not \r\nthe same as the default value in the declaration. \r\n\r\n';
+ const canonical =
+ '
Negative Test
An attribute has a default value declared with the #FIXED keyword,
and an instances of that attribute is given a value which is not
the same as the default value in the declaration.
';
+ const compact: unknown = {
+ Java: {
+ one: { "@chapter": "JavaBeans" },
+ "#text":
+ "Negative Test\nAn attribute has a default value declared with the #FIXED keyword, \nand an instances of that attribute is given a value which is not \nthe same as the default value in the declaration.",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P60-ibm60i03.xml", () => {
+ // 3.3.2 — Tests invalid DefaultDecl which is against P60 VC: Attribute Default Legal. The declared
+ // default value "c" is not legal for the type (a|b) in the AttDef in the AttlistDecl.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n\r\nThe default value specified for an attribute does not meet the \r\nlexical constraints of the declared attribute type.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ const canonical =
+ "
The default value specified for an attribute does not meet the
lexical constraints of the declared attribute type.
";
+ const compact: unknown = {
+ test: "The default value specified for an attribute does not meet the \nlexical constraints of the declared attribute type.",
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P60-ibm60i04.xml", () => {
+ // 3.3.2 — Tests invalid DefaultDecl which is against P60 VC: Attribute Default Legal. The declared
+ // default value "@#$" is not legal for the type NMTOKEN the AttDef in the AttlistDecl.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n\r\nThe default value specified for an attribute does not meet the \r\nlexical constraints of the declared attribute type.\r\n\r\n';
+ const canonical =
+ "
The default value specified for an attribute does not meet the
lexical constraints of the declared attribute type.
";
+ const compact: unknown = {
+ test: "The default value specified for an attribute does not meet the \nlexical constraints of the declared attribute type.",
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P68-ibm68i01.xml", () => {
+ // 4.1 — Tests invalid EntityRef which is against P68 VC: Entity Declared. The GE with the name "ge2"
+ // is referred in the file ibm68i01.dtd", but not declared. (upstream: optional error)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n pcdata content\r\n \r\n\r\n\r\n\r\n';
+ const canonical = '
pcdata content
';
+ const compact: unknown = { root: { a: { "@attr1": "xyz" }, "#text": "pcdata content" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P68-ibm68i02.xml", () => {
+ // 4.1 — Tests invalid EntityRef which is against P68 VC: Entity Declared. The GE with the name "ge1"
+ // is referred before declared in the file ibm68i01.dtd". (upstream: optional error)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n pcdata content\r\n \r\n\r\n\r\n\r\n';
+ const canonical = '
pcdata content
';
+ const compact: unknown = { root: { a: { "@attr1": "xyz" }, "#text": "pcdata content" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P68-ibm68i03.xml", () => {
+ // 4.1 — Tests invalid EntityRef which is against P68 VC: Entity Declared. The GE with the name "ge2"
+ // is referred in the file ibm68i03.ent", but not declared. (upstream: optional error)
+ const input: string =
+ '\r\n\r\n \r\n %pe1;\r\n]>\r\n\r\n pcdata content\r\n\r\n\r\n';
+ const canonical = "
pcdata content
";
+ const compact: unknown = { root: "pcdata content" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P68-ibm68i04.xml", () => {
+ // 4.1 — Tests invalid EntityRef which is against P68 VC: Entity Declared. The GE with the name "ge1"
+ // is referred before declared in the file ibm68i04.ent". (upstream: optional error)
+ const input: string =
+ '\r\n\r\n \r\n %pe1;\r\n]>\r\n\r\n pcdata content\r\n\r\n\r\n';
+ const canonical = "
pcdata content
";
+ const compact: unknown = { root: "pcdata content" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P69-ibm69i01.xml", () => {
+ // 4.1 — Tests invalid PEReference which is against P69 VC: Entity Declared. The Name "pe2" in the
+ // PEReference in the file ibm69i01.dtd does not match the Name of any declared PE. (upstream: optional
+ // error)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n pcdata content\r\n \r\n\r\n\r\n\r\n';
+ const canonical = '
pcdata content
';
+ const compact: unknown = { root: { a: { "@attr1": "xyz" }, "#text": "pcdata content" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P69-ibm69i02.xml", () => {
+ // 4.1 — Tests invalid PEReference which is against P69 VC: Entity Declared. The PE with the name "pe1"
+ // is referred before declared in the file ibm69i02.dtd (upstream: optional error)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n pcdata content\r\n \r\n\r\n\r\n\r\n';
+ const canonical = '
pcdata content
';
+ const compact: unknown = { root: { a: { "@attr1": "xyz" }, "#text": "pcdata content" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P69-ibm69i03.xml", () => {
+ // 4.1 — Tests invalid PEReference which is against P69 VC: Entity Declared. The Name "pe3" in the
+ // PEReference in the file ibm69i03.ent does not match the Name of any declared PE. (upstream: optional
+ // error)
+ const input: string =
+ '\r\n\r\n \r\n %pe1;\r\n]>\r\n\r\n pcdata content\r\n\r\n\r\n';
+ const canonical = "
pcdata content
";
+ const compact: unknown = { root: "pcdata content" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P69-ibm69i04.xml", () => {
+ // 4.1 — Tests invalid PEReference which is against P69 VC: Entity Declared. The PE with the name "pe2"
+ // is referred before declared in the file ibm69i04.ent. (upstream: optional error)
+ const input: string =
+ '\r\n\r\n \r\n %pe1;\r\n]>\r\n\r\n pcdata content\r\n\r\n\r\n';
+ const canonical = "
pcdata content
";
+ const compact: unknown = { root: "pcdata content" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-invalid-P76-ibm76i01.xml", () => {
+ // 4.2.2 — Tests invalid NDataDecl which is against P76 VC: Notation declared. The Name "JPGformat" in
+ // the NDataDecl in the EntityDecl for "ge2" does not match the Name of any declared notation.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\'>\r\n\r\n%pe1;\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { root: { "@att2": "any" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-not-wf-P01-ibm01n01.xml", () => {
+ // 2.1 — Tests a document with no element. A well-formed document should have at lease one elements.
+ const input: string =
+ '\r\n\r\n]>\r\n';
+ expectRejects(input, "XML Parse error: XML document must have a root element");
+ });
+
+ test("ibm-not-wf-P01-ibm01n02.xml", () => {
+ // 2.1 — Tests a document with wrong ordering of its prolog and element. The element occurs before the
+ // xml declaration and the DTD.
+ const input: string =
+ 'Wrong ordering between prolog and element!\r\n\r\n\r\n]>';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.1 — Tests a document with wrong combination of misc and element. One PI occurs between two
+ // elements.
+ const input: string =
+ '\r\n\r\n \r\n]>\r\nWrong combination!\r\n\r\nWrong combination!\r\n\r\n';
+ expectRejects(input, "XML Parse error: Only one root element is allowed");
+ });
+
+ test("ibm-not-wf-P02-ibm02n01.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x00
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x00");
+ });
+
+ test("ibm-not-wf-P02-ibm02n02.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x01
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x01");
+ });
+
+ test("ibm-not-wf-P02-ibm02n03.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x02
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x02");
+ });
+
+ test("ibm-not-wf-P02-ibm02n04.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x03
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x03");
+ });
+
+ test("ibm-not-wf-P02-ibm02n05.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x04
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x04");
+ });
+
+ test("ibm-not-wf-P02-ibm02n06.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x05
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x05");
+ });
+
+ test("ibm-not-wf-P02-ibm02n07.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x06
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x06");
+ });
+
+ test("ibm-not-wf-P02-ibm02n08.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x07
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x07");
+ });
+
+ test("ibm-not-wf-P02-ibm02n09.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x08
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x08");
+ });
+
+ test("ibm-not-wf-P02-ibm02n10.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x0B
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0B");
+ });
+
+ test("ibm-not-wf-P02-ibm02n11.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x0C
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0C");
+ });
+
+ test("ibm-not-wf-P02-ibm02n12.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x0E
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0E");
+ });
+
+ test("ibm-not-wf-P02-ibm02n13.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x0F
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x0F");
+ });
+
+ test("ibm-not-wf-P02-ibm02n14.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x10
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x10");
+ });
+
+ test("ibm-not-wf-P02-ibm02n15.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x11
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x11");
+ });
+
+ test("ibm-not-wf-P02-ibm02n16.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x12
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x12");
+ });
+
+ test("ibm-not-wf-P02-ibm02n17.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x13
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x13");
+ });
+
+ test("ibm-not-wf-P02-ibm02n18.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x14
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x14");
+ });
+
+ test("ibm-not-wf-P02-ibm02n19.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x15
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x15");
+ });
+
+ test("ibm-not-wf-P02-ibm02n20.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x16
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x16");
+ });
+
+ test("ibm-not-wf-P02-ibm02n21.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x17
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x17");
+ });
+
+ test("ibm-not-wf-P02-ibm02n22.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x18
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x18");
+ });
+
+ test("ibm-not-wf-P02-ibm02n23.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x19
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x19");
+ });
+
+ test("ibm-not-wf-P02-ibm02n24.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x1A
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1A");
+ });
+
+ test("ibm-not-wf-P02-ibm02n25.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x1B
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1B");
+ });
+
+ test("ibm-not-wf-P02-ibm02n26.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x1C
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1C");
+ });
+
+ test("ibm-not-wf-P02-ibm02n27.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x1D
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1D");
+ });
+
+ test("ibm-not-wf-P02-ibm02n28.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x1E
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1E");
+ });
+
+ test("ibm-not-wf-P02-ibm02n29.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #x1F
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: control character 0x1F");
+ });
+
+ test("ibm-not-wf-P02-ibm02n30.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #xD800
+ const input = Buffer.from(
+ "PCFET0NUWVBFIGJvb2sgWw0KPCFFTEVNRU5UIGJvb2sgQU5ZPg0KXT4NCjwhLS0gSWxsZWdhbENoYXIgI3hkODAwDQogaW4gcDAyOiDtoIAgLS0+DQo8Ym9vay8+DQo=",
+ "base64",
+ );
+ expectRejects(input, "XML Parse error: Invalid UTF-8");
+ });
+
+ test("ibm-not-wf-P02-ibm02n31.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #xDFFF
+ const input = Buffer.from(
+ "PCFET0NUWVBFIGJvb2sgWw0KPCFFTEVNRU5UIGJvb2sgQU5ZPg0KXT4NCjwhLS0gSWxsZWdhbENoYXIgI3hkZmZmDQogaW4gcDAyOiDtv78gLS0+DQo8Ym9vay8+DQo=",
+ "base64",
+ );
+ expectRejects(input, "XML Parse error: Invalid UTF-8");
+ });
+
+ test("ibm-not-wf-P02-ibm02n32.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #xFFFE
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: '\ufffe' (U+FFFE)");
+ });
+
+ test("ibm-not-wf-P02-ibm02n33.xml", () => {
+ // 2.2 — Tests a comment which contains an illegal Char: #xFFFF
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in XML: '\uffff' (U+FFFF)");
+ });
+
+ test("ibm-not-wf-P03-ibm03n01.xml", () => {
+ // 2.3 — Tests an end tag which contains an illegal space character #x3000 which follows the element
+ // name "book".
+ const input: string =
+ "\r\n]>\r\n\r\nIllegal space 3000 in the end tag\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' to end the closing tag but found ' ' (U+3000)");
+ });
+
+ test("ibm-not-wf-P04-ibm04n01.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x21
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '!'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n02.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x28
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '('",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n03.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x29
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found ')'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n04.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x2B
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '+'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n05.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x2C
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found ','",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n06.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x2F
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected '>' after '/' but found space");
+ });
+
+ test("ibm-not-wf-P04-ibm04n07.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x3B
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found ';'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n08.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x3C
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found space");
+ });
+
+ test("ibm-not-wf-P04-ibm04n09.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x3D
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '='",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n10.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x3F
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '?'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n11.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x5B
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '['");
+ });
+
+ test("ibm-not-wf-P04-ibm04n12.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x5C
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '\\'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n13.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x5D
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found ']'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n14.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x5E
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '^'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n15.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x60
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '`'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n16.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x7B
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '{'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n17.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x7C
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '|'",
+ );
+ });
+
+ test("ibm-not-wf-P04-ibm04n18.xml", () => {
+ // 2.3 — Tests an element name which contains an illegal ASCII NameChar. "IllegalNameChar" is followed
+ // by #x7D
+ const input: string =
+ "\r\n]>\r\n\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '}'",
+ );
+ });
+
+ test("ibm-not-wf-P05-ibm05n01.xml", () => {
+ // 2.3 — Tests an element name which has an illegal first character. An illegal first character "." is
+ // followed by "A_name-starts_with.".
+ const input: string =
+ "\r\n]>\r\n<.A_name_starts_with./> \r\n";
+ expectRejects(input, "XML Parse error: Expected the document type name but found '.A_name_starts_with.'");
+ });
+
+ test("ibm-not-wf-P05-ibm05n02.xml", () => {
+ // 2.3 — Tests an element name which has an illegal first character. An illegal first character "-" is
+ // followed by "A_name-starts_with-".
+ const input: string =
+ "\r\n]>\r\n<-A_name_starts_With-/> \r\n";
+ expectRejects(input, "XML Parse error: Expected the document type name but found '-A_name_starts_With-'");
+ });
+
+ test("ibm-not-wf-P05-ibm05n03.xml", () => {
+ // 2.3 — Tests an element name which has an illegal first character. An illegal first character "5" is
+ // followed by "A_name-starts_with_digit".
+ const input: string =
+ "\r\n]>\r\n<5A_name_starts_with_digit/> \r\n";
+ expectRejects(input, "XML Parse error: Expected the document type name but found '5A_name_starts_with_digit'");
+ });
+
+ test("ibm-not-wf-P09-ibm09n01.xml", () => {
+ // 2.3 — Tests an internal general entity with an invalid value. The entity "Fullname" contains "%".
+ const input: string =
+ '\r\n \r\n \t\r\n]>\r\n\r\n\r\nMy Name is &FullName;. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found '\"'");
+ });
+
+ test("ibm-not-wf-P09-ibm09n02.xml", () => {
+ // 2.3 — Tests an internal general entity with an invalid value. The entity "Fullname" contains the
+ // ampersand character.
+ const input: string =
+ '\r\n \r\n \t\r\n]>\r\n\r\n\r\nMy Name is &FullName;. ';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found '\"'");
+ });
+
+ test("ibm-not-wf-P09-ibm09n03.xml", () => {
+ // 2.3 — Tests an internal general entity with an invalid value. The entity "Fullname" contains the
+ // double quote character in the middle.
+ const input: string =
+ ' \r\n\r\n\t \r\n]>\r\n\r\n\r\nMy Name is &FullName;. ';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'Man'");
+ });
+
+ test("ibm-not-wf-P09-ibm09n04.xml", () => {
+ // 2.3 — Tests an internal general entity with an invalid value. The closing bracket (double quote) is
+ // missing with the value of the entity "FullName".
+ const input: string =
+ ' \r\n\r\n\t \r\n]>\r\n\r\n\r\nMy Name is &FullName;. \r\n';
+ expectRejects(input, "XML Parse error: Unterminated entity value");
+ });
+
+ test("ibm-not-wf-P10-ibm10n01.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The value of the attribute "first" contains the
+ // character "less than".
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("ibm-not-wf-P10-ibm10n02.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The value of the attribute "first" contains the
+ // character ampersand.
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found '\"'");
+ });
+
+ test("ibm-not-wf-P10-ibm10n03.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The value of the attribute "first" contains the
+ // double quote character in the middle.
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'Man'");
+ });
+
+ test("ibm-not-wf-P10-ibm10n04.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The closing bracket (double quote) is missing with
+ // The value of the attribute "first".
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\n {
+ // 2.3 — Tests an attribute with an invalid value. The value of the attribute "first" contains the
+ // character "less than".
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("ibm-not-wf-P10-ibm10n06.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The value of the attribute "first" contains the
+ // character ampersand.
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found '''");
+ });
+
+ test("ibm-not-wf-P10-ibm10n07.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The value of the attribute "first" contains the
+ // double quote character in the middle.
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'Man'");
+ });
+
+ test("ibm-not-wf-P10-ibm10n08.xml", () => {
+ // 2.3 — Tests an attribute with an invalid value. The closing bracket (single quote) is missing with
+ // the value of the attribute "first".
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("ibm-not-wf-P11-ibm11n01.xml", () => {
+ // 2.3 — Tests SystemLiteral. The systemLiteral for the element "student" has a double quote character
+ // in the middle.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '.dtd'",
+ );
+ });
+
+ test("ibm-not-wf-P11-ibm11n02.xml", () => {
+ // 2.3 — Tests SystemLiteral. The systemLiteral for the element "student" has a single quote character
+ // in the middle.
+ const input: string =
+ "\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '.dtd'",
+ );
+ });
+
+ test("ibm-not-wf-P11-ibm11n03.xml", () => {
+ // 2.3 — Tests SystemLiteral. The closing bracket (double quote) is missing with the systemLiteral for
+ // the element "student".
+ const input: string =
+ '\r\n {
+ // 2.3 — Tests SystemLiteral. The closing bracket (single quote) is missing with the systemLiteral for
+ // the element "student".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ expectRejects(input, "XML Parse error: Unterminated quoted string");
+ });
+
+ test("ibm-not-wf-P12-ibm12n01.xml", () => {
+ // 2.3 — Tests PubidLiteral. The closing bracket (double quote) is missing with the value of the
+ // PubidLiteral for the entity "info".
+ const input: string =
+ '\r\n \r\n\t\r\n]>\r\n\r\n\r\nMy Name is &info;. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '\\'");
+ });
+
+ test("ibm-not-wf-P12-ibm12n02.xml", () => {
+ // 2.3 — Tests PubidLiteral. The value of the PubidLiteral for the entity "info" has a single quote
+ // character in the middle..
+ const input: string =
+ "\r\n \r\n\t\r\n]>\r\n\r\n\r\nMy Name is &info;. \r\n";
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '\\'");
+ });
+
+ test("ibm-not-wf-P12-ibm12n03.xml", () => {
+ // 2.3 — Tests PubidLiteral. The closing bracket (single quote) is missing with the value of the
+ // PubidLiteral for the entity "info".
+ const input: string =
+ '\r\n \r\n\t\r\n]>\r\n\r\n\r\nMy Name is &info;. ';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '\\'");
+ });
+
+ test("ibm-not-wf-P13-ibm13n01.xml", () => {
+ // 2.3 — Tests PubidChar. The pubidChar of the PubidLiteral for the entity "info" contains the
+ // character "{".
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\nMy Name is &info;. \r\n\r\n\r\n\r\n\r\n ';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '{'");
+ });
+
+ test("ibm-not-wf-P13-ibm13n02.xml", () => {
+ // 2.3 — Tests PubidChar. The pubidChar of the PubidLiteral for the entity "info" contains the
+ // character "~".
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\nMy Name is &info;. ';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '~'");
+ });
+
+ test("ibm-not-wf-P13-ibm13n03.xml", () => {
+ // 2.3 — Tests PubidChar. The pubidChar of the PubidLiteral for the entity "info" contains the
+ // character double quote in the middle.
+ const input = Buffer.from(
+ '\n\n]>\n\n\nMy Name is &info;. \n\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: 'á' (U+00E1)");
+ });
+
+ test("ibm-not-wf-P14-ibm14n01.xml", () => {
+ // 2.4 — Tests CharData. The content of the element "student" contains the sequence close-bracket
+ // close-bracket greater-than.
+ const input: string =
+ '\r\n\r\n\t\r\n]>\r\n\r\n\r\nMy name is Snow ]]> Man\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: ']]>' is only allowed as the end of a CDATA section");
+ });
+
+ test("ibm-not-wf-P14-ibm14n02.xml", () => {
+ // 2.4 — Tests CharData. The content of the element "student" contains the character "less than".
+ const input: string =
+ '\r\n\r\n\t\r\n]>\r\n\r\n\r\nMy name is Snow ';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found ' {
+ // 2.4 — Tests CharData. The content of the element "student" contains the character ampersand.
+ const input: string =
+ '\r\n\r\n\t\r\n]>\r\n\r\n\r\nMy name is Snow&Man \r\n';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found space");
+ });
+
+ test("ibm-not-wf-P15-ibm15n01.xml", () => {
+ // 2.5 — Tests comment. The text of the second comment contains the character "-".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ expectRejects(input, "XML Parse error: '--' is not allowed inside a comment");
+ });
+
+ test("ibm-not-wf-P15-ibm15n02.xml", () => {
+ // 2.5 — Tests comment. The second comment has a wrong closing sequence "-(greater than)".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.5 — Tests comment. The closing sequence is missing with the second comment.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\n a test ?>\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the root element but found 'a'");
+ });
+
+ test("ibm-not-wf-P16-ibm16n02.xml", () => {
+ // 2.6 — Tests PI. The PITarget is missing in the PI.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\n?>\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: Expected a processing instruction target after '' but found '?'");
+ });
+
+ test("ibm-not-wf-P16-ibm16n03.xml", () => {
+ // 2.6 — Tests PI. The PI has a wrong closing sequence ">".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: Unterminated processing instruction");
+ });
+
+ test("ibm-not-wf-P16-ibm16n04.xml", () => {
+ // 2.6 — Tests PI. The closing sequence is missing in the PI.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: Unterminated processing instruction");
+ });
+
+ test("ibm-not-wf-P17-ibm17n01.xml", () => {
+ // 2.6 — Tests PITarget. The PITarget contains the string "XML".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.6 — Tests PITarget. The PITarget contains the string "xML".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.6 — Tests PITarget. The PITarget contains the string "xml".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.6 — Tests PITarget. The PITarget contains the string "xmL".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.7 — Tests CDSect. The CDStart is missing in the CDSect in the content of element "student".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. This is text]]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: ']]>' is only allowed as the end of a CDATA section");
+ });
+
+ test("ibm-not-wf-P18-ibm18n02.xml", () => {
+ // 2.7 — Tests CDSect. The CDEnd is missing in the CDSect in the content of element "student".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. text ';
+ expectRejects(input, "XML Parse error: Unterminated CDATA section");
+ });
+
+ test("ibm-not-wf-P19-ibm19n01.xml", () => {
+ // 2.7 — Tests CDStart. The CDStart contains a lower case string "cdata".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: Conditional sections are only allowed in the external DTD subset");
+ });
+
+ test("ibm-not-wf-P19-ibm19n02.xml", () => {
+ // 2.7 — Tests CDStart. The CDStart contains an extra character "[".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Conditional sections are only allowed in the external DTD subset");
+ });
+
+ test("ibm-not-wf-P19-ibm19n03.xml", () => {
+ // 2.7 — Tests CDStart. The CDStart contains a wrong character "?".
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n[CDATA[This is a test]]>\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: Expected a processing instruction target after '' but found '['");
+ });
+
+ test("ibm-not-wf-P20-ibm20n01.xml", () => {
+ // 2.7 — Tests CDATA with an illegal sequence. The CDATA contains the sequence close-bracket
+ // close-bracket greater-than.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nThis is ]]> a test]]>\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: CDATA sections are only allowed inside elements");
+ });
+
+ test("ibm-not-wf-P21-ibm21n01.xml", () => {
+ // 2.7 — Tests CDEnd. One "]" is missing in the CDEnd.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Conditional sections are only allowed in the external DTD subset");
+ });
+
+ test("ibm-not-wf-P21-ibm21n02.xml", () => {
+ // 2.7 — Tests CDEnd. An extra "]" is placed in the CDEnd.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: Conditional sections are only allowed in the external DTD subset");
+ });
+
+ test("ibm-not-wf-P21-ibm21n03.xml", () => {
+ // 2.7 — Tests CDEnd. A wrong character ")" is placed in the CDEnd.
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. ';
+ expectRejects(input, "XML Parse error: CDATA sections are only allowed inside elements");
+ });
+
+ test("ibm-not-wf-P22-ibm22n01.xml", () => {
+ // 2.8 — Tests prolog with wrong field ordering. The XMLDecl occurs after the DTD.
+ const input: string =
+ '\r\n]>\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests prolog with wrong field ordering. The Misc (comment) occurs before the XMLDecl.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests prolog with wrong field ordering. The XMLDecl occurs after the DTD and a comment. The
+ // other comment occurs before the DTD.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests XMLDecl with a required field missing. The Versioninfo is missing in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, 'XML Parse error: The XML declaration must start with version="1.0"');
+ });
+
+ test("ibm-not-wf-P23-ibm23n02.xml", () => {
+ // 2.8 — Tests XMLDecl with wrong field ordering. The VersionInfo occurs after the EncodingDecl.
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n\r\n",
+ );
+ expectRejects(input, 'XML Parse error: The XML declaration must start with version="1.0"');
+ });
+
+ test("ibm-not-wf-P23-ibm23n03.xml", () => {
+ // 2.8 — Tests XMLDecl with wrong field ordering. The VersionInfo occurs after the SDDecl and the
+ // SDDecl occurs after the VersionInfo.
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n\r\n",
+ );
+ expectRejects(input, 'XML Parse error: The XML declaration must start with version="1.0"');
+ });
+
+ test("ibm-not-wf-P23-ibm23n04.xml", () => {
+ // 2.8 — Tests XMLDecl with wrong key word. An upper case string "XML" is used as the key word in the
+ // XMLDecl.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests XMLDecl with a wrong closing sequence ">".
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n\r\n",
+ );
+ expectRejects(input, "XML Parse error: Expected '?>' to end the XML declaration but found '>'");
+ });
+
+ test("ibm-not-wf-P23-ibm23n06.xml", () => {
+ // 2.8 — Tests XMLDecl with a wrong opening sequence "(less than)!".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests VersionInfo with a required field missing. The VersionNum is missing in the VersionInfo
+ // in the XMLDecl.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a quoted value in the XML declaration but found '?'");
+ });
+
+ test("ibm-not-wf-P24-ibm24n02.xml", () => {
+ // 2.8 — Tests VersionInfo with a required field missing. The white space is missing between the key
+ // word "xml" and the VersionInfo in the XMLDecl.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found '='",
+ );
+ });
+
+ test("ibm-not-wf-P24-ibm24n03.xml", () => {
+ // 2.8 — Tests VersionInfo with a required field missing. The "=" (equal sign) is missing between the
+ // key word "version" and the VersionNum.
+ const input: string =
+ "\r\n\r\n]> \r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found '''");
+ });
+
+ test("ibm-not-wf-P24-ibm24n04.xml", () => {
+ // 2.8 — Tests VersionInfo with wrong field ordering. The VersionNum occurs before "=" and "version".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected version=\"1.0\" in the XML declaration but found '''");
+ });
+
+ test("ibm-not-wf-P24-ibm24n05.xml", () => {
+ // 2.8 — Tests VersionInfo with wrong field ordering. The "=" occurs after "version" and the
+ // VersionNum.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found '''");
+ });
+
+ test("ibm-not-wf-P24-ibm24n06.xml", () => {
+ // 2.8 — Tests VersionInfo with the wrong key word "Version".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected version=\"1.0\" in the XML declaration but found 'Version'");
+ });
+
+ test("ibm-not-wf-P24-ibm24n07.xml", () => {
+ // 2.8 — Tests VersionInfo with the wrong key word "versioN".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected version=\"1.0\" in the XML declaration but found 'versioN'");
+ });
+
+ test("ibm-not-wf-P24-ibm24n08.xml", () => {
+ // 2.8 — Tests VersionInfo with mismatched quotes around the VersionNum. version = '1.0" is used as the
+ // VersionInfo.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in a quoted string: '>'");
+ });
+
+ test("ibm-not-wf-P24-ibm24n09.xml", () => {
+ // 2.8 — Tests VersionInfo with mismatched quotes around the VersionNum. The closing bracket for the
+ // VersionNum is missing.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Invalid character in a quoted string: '>'");
+ });
+
+ test("ibm-not-wf-P25-ibm25n01.xml", () => {
+ // 2.8 — Tests eq with a wrong key word "==".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a quoted value in the XML declaration but found '='");
+ });
+
+ test("ibm-not-wf-P25-ibm25n02.xml", () => {
+ // 2.8 — Tests eq with a wrong key word "eq".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found 'eq'");
+ });
+
+ test("ibm-not-wf-P26-ibm26n01.xml", () => {
+ // 2.8 — Tests VersionNum with an illegal character "#".
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Unsupported XML version '_#1.0' (this is an XML 1.0 parser)");
+ });
+
+ test("ibm-not-wf-P27-ibm27n01.xml", () => {
+ // 2.8 — Tests type of Misc. An element declaration is used as a type of Misc After the element
+ // "animal".
+ const input: string =
+ '\r\n\r\n]>\r\nWrong type of Misc following this element!\r\n';
+ expectRejects(input, "XML Parse error: Unexpected ' {
+ // 2.8 — Tests doctypedecl with a required field missing. The Name "animal" is missing in the
+ // doctypedecl.
+ const input = Buffer.from(
+ '\r\n\r\n \r\n\r\n',
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P28-ibm28n02.xml", () => {
+ // 2.8 — Tests doctypedecl with wrong field ordering. The Name "animal" occurs after the markup
+ // declarations inside the "[]".
+ const input = Buffer.from(
+ "\r\n\r\n] animal>\r\n \r\n\r\n",
+ );
+ expectRejects(input, "XML Parse error: Expected the document type name but found '['");
+ });
+
+ test("ibm-not-wf-P28-ibm28n03.xml", () => {
+ // 2.8 — Tests doctypedecl with wrong field ordering. The Name "animal" occurs after the markup
+ // declarations inside the "[]".
+ const input = Buffer.from(
+ '\r\n\r\n]>\r\n \r\n\r\n',
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P28-ibm28n04.xml", () => {
+ // 2.8 — Tests doctypedecl with general entity reference.The "(ampersand)generalE" occurs in the DTD.
+ const input = Buffer.from(
+ '\r\n\r\n \r\n &generalE;\r\n ">\r\n %parameterE;\r\n] animal>\r\n\r\n \r\n&generalE\r\n',
+ );
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '&'");
+ });
+
+ test("ibm-not-wf-P28-ibm28n05.xml", () => {
+ // 2.8 — Tests doctypedecl with wrong key word. A wrong key word "DOCtYPE" occurs on line 2.
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n \r\n\r\n",
+ );
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests doctypedecl with mismatched brackets. The closing bracket "]" of the DTD is missing.
+ const input = Buffer.from(
+ "\r\n\r\n>\r\n \r\n\r\n",
+ );
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '>'");
+ });
+
+ test("ibm-not-wf-P28-ibm28n07.xml", () => {
+ // 2.8 — Tests doctypedecl with wrong bracket. The opening bracket "{" occurs in the DTD.
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n \r\n\r\n",
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '{'",
+ );
+ });
+
+ test("ibm-not-wf-P28-ibm28n08.xml", () => {
+ // 2.8 — Tests doctypedecl with wrong opening sequence. The opening sequence "(less than)?DOCTYPE"
+ // occurs in the DTD.
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n \r\n\r\n",
+ );
+ expectRejects(input, "XML Parse error: Unterminated processing instruction");
+ });
+
+ test("ibm-not-wf-p28a-ibm28an01.xml", () => {
+ // 2.8 — This test violates WFC:PE Between Declarations in Production 28a. The last character of a
+ // markup declaration is not contained in the same parameter-entity text replacement. (upstream:
+ // not-wf; external parameter entities are not read)
+ const input = Buffer.from(
+ '\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n &forcat;\r\n This is a white tiger in Mirage!!\r\n \r\n \r\n \r\n \r\n \r\n\r\n',
+ );
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P29-ibm29n01.xml", () => {
+ // 2.8 — Tests markupdecl with an illegal markup declaration. A XMLDecl occurs inside the DTD.
+ const input: string =
+ '\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n \r\n This is a white tiger in Mirage!!\r\n \r\n \r\n \r\n \r\n \r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 2.8 — Tests WFC "PEs in Internal Subset". A PE reference occurs inside an elementdecl in the DTD.
+ const input = Buffer.from(
+ '\r\n\r\n ">\r\n \r\n\r\nAny content\r\n',
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P29-ibm29n03.xml", () => {
+ // 2.8 — Tests WFC "PEs in Internal Subset". A PE reference occurs inside an ATTlistDecl in the DTD.
+ const input = Buffer.from(
+ '\r\n\r\n \r\n \r\n]>\r\n\r\nAny content\r\n',
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P29-ibm29n04.xml", () => {
+ // 2.8 — Tests WFC "PEs in Internal Subset". A PE reference occurs inside an EntityDecl in the DTD.
+ const input = Buffer.from(
+ '\r\n\r\n \r\n \r\n]>\r\n\r\n&content;\r\n',
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P29-ibm29n05.xml", () => {
+ // 2.8 — Tests WFC "PEs in Internal Subset". A PE reference occurs inside a PI in the DTD.
+ const input = Buffer.from(
+ '\r\n\r\n ">\r\n \r\n\r\nAny content\r\n',
+ );
+ expectRejects(input, "XML Parse error: Unterminated processing instruction");
+ });
+
+ test("ibm-not-wf-P29-ibm29n06.xml", () => {
+ // 2.8 — Tests WFC "PEs in Internal Subset". A PE reference occurs inside a comment in the DTD.
+ const input = Buffer.from(
+ '\r\n\r\n ">\r\n\r\n \r\nAny content\r\n',
+ );
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P30-ibm30n01.xml", () => {
+ // 2.8 — Tests extSubset with wrong field ordering. In the file "ibm30n01.dtd", the TextDecl occurs
+ // after the extSubsetDecl (the element declaration). (upstream: not-wf; external parameter entities
+ // are not read)
+ const input: string =
+ '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P31-ibm31n01.xml", () => {
+ // 2.8 — Tests extSubsetDecl with an illegal field. A general entity reference occurs in file
+ // "ibm31n01.dtd". (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P32-ibm32n01.xml", () => {
+ // 2.9 — Tests SDDecl with a required field missing. The leading white space is missing with the SDDecl
+ // in the XMLDecl.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'standalone'");
+ });
+
+ test("ibm-not-wf-P32-ibm32n02.xml", () => {
+ // 2.9 — Tests SDDecl with a required field missing. The "=" sign is missing in the SDDecl in the
+ // XMLDecl.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P32-ibm32n03.xml", () => {
+ // 2.9 — Tests SDDecl with wrong key word. The word "Standalone" occurs in the SDDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Unexpected 'Standalone' in the XML declaration (expected version, encoding or standalone)",
+ );
+ });
+
+ test("ibm-not-wf-P32-ibm32n04.xml", () => {
+ // 2.9 — Tests SDDecl with wrong key word. The word "Yes" occurs in the SDDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid value 'Yes' for standalone in the XML declaration (expected yes or no)",
+ );
+ });
+
+ test("ibm-not-wf-P32-ibm32n05.xml", () => {
+ // 2.9 — Tests SDDecl with wrong key word. The word "YES" occurs in the SDDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid value 'YES' for standalone in the XML declaration (expected yes or no)",
+ );
+ });
+
+ test("ibm-not-wf-P32-ibm32n06.xml", () => {
+ // 2.9 — Tests SDDecl with wrong key word. The word "No" occurs in the SDDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid value 'No' for standalone in the XML declaration (expected yes or no)",
+ );
+ });
+
+ test("ibm-not-wf-P32-ibm32n07.xml", () => {
+ // 2.9 — Tests SDDecl with wrong key word. The word "NO" occurs in the SDDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid value 'NO' for standalone in the XML declaration (expected yes or no)",
+ );
+ });
+
+ test("ibm-not-wf-P32-ibm32n08.xml", () => {
+ // 2.9 — Tests SDDecl with wrong field ordering. The "=" sign occurs after the key word "yes" in the
+ // SDDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P32-ibm32n09.xml", () => {
+ // 2.9 — This is test violates WFC: Entity Declared in P68. The standalone document declaration has the
+ // value yes, BUT there is an external markup declaration of an entity (other than amp, lt, gt, apos,
+ // quot), and references to this entity appear in the document. (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n&animal_content;\r\n';
+ expectRejects(input, "XML Parse error: Entity 'animal_content' is not declared");
+ });
+
+ test("ibm-not-wf-P39-ibm39n01.xml", () => {
+ // 3 — Tests element with a required field missing. The ETag is missing for the element "root".
+ const input: string =
+ '\r\n\r\n]>\r\nmissing end tag\r\n\r\n';
+ expectRejects(input, "XML Parse error: Missing closing tag for element 'root'");
+ });
+
+ test("ibm-not-wf-P39-ibm39n02.xml", () => {
+ // 3 — Tests element with a required field missing. The STag is missing for the element "root".
+ const input: string =
+ '\r\n\r\n]>\r\nmissing start tag\r\n';
+ expectRejects(input, "XML Parse error: Expected the root element but found 'missing'");
+ });
+
+ test("ibm-not-wf-P39-ibm39n03.xml", () => {
+ // 3 — Tests element with required fields missing. Both the content and the ETag are missing in the
+ // element "root".
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Missing closing tag for element 'root'");
+ });
+
+ test("ibm-not-wf-P39-ibm39n04.xml", () => {
+ // 3 — Tests element with required fields missing. Both the content and the STag are missing in the
+ // element "root".
+ const input: string =
+ '\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the root element but found ' {
+ // 3 — Tests element with wrong field ordering. The STag and the ETag are swapped in the element
+ // "root".
+ const input: string =
+ '\r\n\r\n]>\r\nswitched start and end tags\r\n';
+ expectRejects(input, "XML Parse error: Expected the root element but found ' {
+ // 3 — Tests element with wrong field ordering. The content occurs after the ETag of the element
+ // "root".
+ const input: string =
+ '\r\n\r\n]>\r\ncontent after end tag\r\n';
+ expectRejects(input, "XML Parse error: Unexpected 'content' after the root element");
+ });
+
+ test("ibm-not-wf-P40-ibm40n01.xml", () => {
+ // 3.1 — Tests STag with a required field missing. The Name "root" is in the STag of the element
+ // "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing name in start tag\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P40-ibm40n02.xml", () => {
+ // 3.1 — Tests STag with a required field missing. The white space between the Name "root" and the
+ // attribute "attr1" is missing in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing white space in start tag\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P40-ibm40n03.xml", () => {
+ // 3.1 — Tests STag with wrong field ordering. The Name "root" occurs after the attribute "attr1" in
+ // the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nWrong ordering in start tag\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P40-ibm40n04.xml", () => {
+ // 3.1 — Tests STag with a wrong opening sequence. The string "(less than)!" is used as the opening
+ // sequence for the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nwrong begining sequence in start tag\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 3.1 — Tests STag with duplicate attribute names. The attribute name "attr1" occurs twice in the STag
+ // of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nduplicate attr names in start tag\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Duplicate attribute 'attr1'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n01.xml", () => {
+ // 3.1 — Tests Attribute with a required field missing. The attribute name is missing in the Attribute
+ // in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing name in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P41-ibm41n02.xml", () => {
+ // 3.1 — Tests Attribute with a required field missing. The "=" is missing between the attribute name
+ // and the attribute value in the Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing Eq in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected '=' after the attribute name but found '\"'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n03.xml", () => {
+ // 3.1 — Tests Attribute with a required field missing. The AttValue is missing in the Attribute in the
+ // STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing AttValue in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted attribute value but found '>'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n04.xml", () => {
+ // 3.1 — Tests Attribute with a required field missing. The Name and the "=" are missing in the
+ // Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing name and Eq in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '\"'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n05.xml", () => {
+ // 3.1 — Tests Attribute with a required field missing. The "=" and the AttValue are missing in the
+ // Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing Eq and AttValue in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected '=' after the attribute name but found '>'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n06.xml", () => {
+ // 3.1 — Tests Attribute with a required field missing. The Name and the AttValue are missing in the
+ // Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nmissing Name and AttValue in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P41-ibm41n07.xml", () => {
+ // 3.1 — Tests Attribute with wrong field ordering. The "=" occurs after the Name and the AttValue in
+ // the Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nwrong ordering in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected '=' after the attribute name but found '\"'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n08.xml", () => {
+ // 3.1 — Tests Attribute with wrong field ordering. The Name and the AttValue are swapped in the
+ // Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nwrong ordering in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '\"'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n09.xml", () => {
+ // 3.1 — Tests Attribute with wrong field ordering. The "=" occurs before the Name and the AttValue in
+ // the Attribute in the STag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nwrong ordering in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P41-ibm41n10.xml", () => {
+ // 3.1 — Tests Attribute against WFC "no external entity references". A direct reference to the
+ // external entity "aExternal" is contained in the value of the attribute "attr1".
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\ndirect reference to external entinity in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Attribute values cannot reference external entity 'aExternal'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n11.xml", () => {
+ // 3.1 — Tests Attribute against WFC "no external entity references". A indirect reference to the
+ // external entity "aExternal" is contained in the value of the attribute "attr1".
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nindirect reference to external entinity in Attribute\r\n';
+ expectRejects(input, "XML Parse error: Attribute values cannot reference external entity 'aExternal'");
+ });
+
+ test("ibm-not-wf-P41-ibm41n12.xml", () => {
+ // 3.1 — Tests Attribute against WFC "no external entity references". A direct reference to the
+ // external unparsed entity "aImage" is contained in the value of the attribute "attr1".
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\ndirect reference to external unparsed entinity in Attribute\r\n\r\n';
+ expectRejects(input, "XML Parse error: Unparsed entity 'aImage' cannot be referenced");
+ });
+
+ test("ibm-not-wf-P41-ibm41n13.xml", () => {
+ // 3.1 — Tests Attribute against WFC "No (less than) character in Attribute Values". The character
+ // "less than" is contained in the value of the attribute "attr1".
+ const input: string =
+ '\r\n\r\n\r\n\r\n inside">\r\n]>\r\nDirect reference to an entity with < as part of its replacement text in Attribute\r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("ibm-not-wf-P41-ibm41n14.xml", () => {
+ // 3.1 — Tests Attribute against WFC "No (less than) in Attribute Values". The character "less than" is
+ // contained in the value of the attribute "attr1" through indirect internal entity reference.
+ const input: string =
+ '\r\n\r\n\r\n\r\n inside">\r\n\r\n]>\r\nindirect reference to an entity with < as part of its replacement text in Attribute\r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("ibm-not-wf-P42-ibm42n01.xml", () => {
+ // 3.1 — Tests ETag with a required field missing. The Name is missing in the ETag of the element
+ // "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nmissing Name in ETag>\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after '' but found '>'");
+ });
+
+ test("ibm-not-wf-P42-ibm42n02.xml", () => {
+ // 3.1 — Tests ETag with a wrong beginning sequence. The string "(less than)\" is used as a beginning
+ // sequence of the ETag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nWrong begining sequence in ETag <\\root>\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found '\\'");
+ });
+
+ test("ibm-not-wf-P42-ibm42n03.xml", () => {
+ // 3.1 — Tests ETag with a wrong beginning sequence. The string "less than" is used as a beginning
+ // sequence of the ETag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nWrong begining sequence in ETag \r\n';
+ expectRejects(input, "XML Parse error: Missing closing tag for element 'root'");
+ });
+
+ test("ibm-not-wf-P42-ibm42n04.xml", () => {
+ // 3.1 — Tests ETag with a wrong structure. An white space occurs between The beginning sequence and
+ // the Name of the ETag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nExtra white space before Name in ETag root>\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after '' but found space");
+ });
+
+ test("ibm-not-wf-P42-ibm42n05.xml", () => {
+ // 3.1 — Tests ETag with a wrong structure. The ETag of the element "root" contains an Attribute
+ // (attr1="any").
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n Attribute in ETag \r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the closing tag but found 'attr1'");
+ });
+
+ test("ibm-not-wf-P43-ibm43n01.xml", () => {
+ // 3.1 — Tests element content with a wrong option. A NotationDecl is used as the content of the
+ // element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 — Tests element content with a wrong option. An elementdecl is used as the content of the
+ // element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 — Tests element content with a wrong option. An entitydecl is used as the content of the element
+ // "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 — Tests element content with a wrong option. An AttlistDecl is used as the content of the
+ // element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a comment or CDATA section after ' {
+ // 3.1 — Tests EmptyElemTag with a required field missing. The Name "root" is missing in the
+ // EmptyElemTag.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n< />\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after '<' but found space");
+ });
+
+ test("ibm-not-wf-P44-ibm44n02.xml", () => {
+ // 3.1 — Tests EmptyElemTag with wrong field ordering. The Attribute (attri1 = "any") occurs before the
+ // name of the element "root" in the EmptyElemTag.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '='");
+ });
+
+ test("ibm-not-wf-P44-ibm44n03.xml", () => {
+ // 3.1 — Tests EmptyElemTag with wrong closing sequence. The string "\>" is used as the closing
+ // sequence in the EmptyElemtag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name, '>' or '/>' in the start tag but found '\\'");
+ });
+
+ test("ibm-not-wf-P44-ibm44n04.xml", () => {
+ // 3.1 — Tests EmptyElemTag which against the WFC "Unique Att Spec". The attribute name "attr1" occurs
+ // twice in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Duplicate attribute 'attr1'");
+ });
+
+ test("ibm-not-wf-P45-ibm45n01.xml", () => {
+ // 3.2 — Tests elementdecl with a required field missing. The Name is missing in the second elementdecl
+ // in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after ' {
+ // 3.2 — Tests elementdecl with a required field missing. The white space is missing between "aEle" and
+ // "(#PCDATA)" in the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '('");
+ });
+
+ test("ibm-not-wf-P45-ibm45n03.xml", () => {
+ // 3.2 — Tests elementdecl with a required field missing. The contentspec is missing in the second
+ // elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '>'");
+ });
+
+ test("ibm-not-wf-P45-ibm45n04.xml", () => {
+ // 3.2 — Tests elementdecl with a required field missing. The contentspec and the white space is
+ // missing in the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '>'");
+ });
+
+ test("ibm-not-wf-P45-ibm45n05.xml", () => {
+ // 3.2 — Tests elementdecl with a required field missing. The Name, the white space, and the
+ // contentspec are missing in the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after ''");
+ });
+
+ test("ibm-not-wf-P45-ibm45n06.xml", () => {
+ // 3.2 — Tests elementdecl with wrong field ordering. The Name occurs after the contentspec in the
+ // second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name after ' {
+ // 3.2 — Tests elementdecl with wrong beginning sequence. The string "(less than)ELEMENT" is used as
+ // the beginning sequence in the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a markup declaration or ']' in the internal subset but found ' {
+ // 3.2 — Tests elementdecl with wrong key word. The string "Element" is used as the key word in the
+ // second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 3.2 — Tests elementdecl with wrong key word. The string "element" is used as the key word in the
+ // second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 3.2 — Tests contentspec with wrong key word. the string "empty" is used as the key word in the
+ // contentspec of the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'empty'");
+ });
+
+ test("ibm-not-wf-P46-ibm46n02.xml", () => {
+ // 3.2 — Tests contentspec with wrong key word. the string "Empty" is used as the key word in the
+ // contentspec of the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'Empty'");
+ });
+
+ test("ibm-not-wf-P46-ibm46n03.xml", () => {
+ // 3.2 — Tests contentspec with wrong key word. the string "Any" is used as the key word in the
+ // contentspec of the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'Any'");
+ });
+
+ test("ibm-not-wf-P46-ibm46n04.xml", () => {
+ // 3.2 — Tests contentspec with wrong key word. the string "any" is used as the key word in the
+ // contentspec of the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found 'any'");
+ });
+
+ test("ibm-not-wf-P46-ibm46n05.xml", () => {
+ // 3.2 — Tests contentspec with a wrong option. The string "#CDATA" is used as the contentspec in the
+ // second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '#CDATA'");
+ });
+
+ test("ibm-not-wf-P47-ibm47n01.xml", () => {
+ // 3.2.1 — Tests children with a required field missing. The "+" is used as the choice or seq field in
+ // the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '+'");
+ });
+
+ test("ibm-not-wf-P47-ibm47n02.xml", () => {
+ // 3.2.1 — Tests children with a required field missing. The "*" is used as the choice or seq field in
+ // the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '*'");
+ });
+
+ test("ibm-not-wf-P47-ibm47n03.xml", () => {
+ // 3.2.1 — Tests children with a required field missing. The "?" is used as the choice or seq field in
+ // the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '?'");
+ });
+
+ test("ibm-not-wf-P47-ibm47n04.xml", () => {
+ // 3.2.1 — Tests children with wrong field ordering. The "*" occurs before the seq field (a,a) in the
+ // second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '*'");
+ });
+
+ test("ibm-not-wf-P47-ibm47n05.xml", () => {
+ // 3.2.1 — Tests children with wrong field ordering. The "+" occurs before the choice field (a|a) in
+ // the second elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected EMPTY, ANY or '(' in the element declaration but found '+'");
+ });
+
+ test("ibm-not-wf-P47-ibm47n06.xml", () => {
+ // 3.2.1 — Tests children with wrong key word. The "^" occurs after the seq field in the second
+ // elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the element declaration but found '^'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n01.xml", () => {
+ // 3.2.1 — Tests cp with a required fields missing. The field Name|choice|seq is missing in the second
+ // cp in the choice field in the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '+'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n02.xml", () => {
+ // 3.2.1 — Tests cp with a required fields missing. The field Name|choice|seq is missing in the cp in
+ // the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '*'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n03.xml", () => {
+ // 3.2.1 — Tests cp with a required fields missing. The field Name|choice|seq is missing in the first
+ // cp in the choice field in the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '?'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n04.xml", () => {
+ // 3.2.1 — Tests cp with wrong field ordering. The "+" occurs before the seq (a,a) in the first cp in
+ // the choice field in the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '+'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n05.xml", () => {
+ // 3.2.1 — Tests cp with wrong field ordering. The "*" occurs before the choice (a|b) in the first cp
+ // in the seq field in the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '*'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n06.xml", () => {
+ // 3.2.1 — Tests cp with wrong field ordering. The "?" occurs before the Name "a" in the second cp in
+ // the seq field in the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '?'");
+ });
+
+ test("ibm-not-wf-P48-ibm48n07.xml", () => {
+ // 3.2.1 — Tests cp with wrong key word. The "^" occurs after the Name "a" in the first cp in the
+ // choice field in the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found '^'");
+ });
+
+ test("ibm-not-wf-P49-ibm49n01.xml", () => {
+ // 3.2.1 — Tests choice with a required field missing. The two cps are missing in the choice field in
+ // the third elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '|'");
+ });
+
+ test("ibm-not-wf-P49-ibm49n02.xml", () => {
+ // 3.2.1 — Tests choice with a required field missing. The third cp is missing in the choice field in
+ // the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found ')'");
+ });
+
+ test("ibm-not-wf-P49-ibm49n03.xml", () => {
+ // 3.2.1 — Tests choice with a wrong separator. The "!" is used as the separator in the choice field in
+ // the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found '!'");
+ });
+
+ test("ibm-not-wf-P49-ibm49n04.xml", () => {
+ // 3.2.1 — Tests choice with a required field missing. The separator "|" is missing in the choice field
+ // (a b)+ in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found 'b'");
+ });
+
+ test("ibm-not-wf-P49-ibm49n05.xml", () => {
+ // 3.2.1 — Tests choice with an extra separator. An extra "|" occurs between a and b in the choice
+ // field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '|'");
+ });
+
+ test("ibm-not-wf-P49-ibm49n06.xml", () => {
+ // 3.2.1 — Tests choice with a required field missing. The closing bracket ")" is missing in the choice
+ // field (a |b * in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n';
+ expectRejects(input, "XML Parse error: An occurrence indicator must directly follow the name or ')' it applies to");
+ });
+
+ test("ibm-not-wf-P50-ibm50n01.xml", () => {
+ // 3.2.1 — Tests seq with a required field missing. The two cps are missing in the seq field in the
+ // fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found ','");
+ });
+
+ test("ibm-not-wf-P50-ibm50n02.xml", () => {
+ // 3.2.1 — Tests seq with a required field missing. The third cp is missing in the seq field in the
+ // fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found ')'");
+ });
+
+ test("ibm-not-wf-P50-ibm50n03.xml", () => {
+ // 3.2.1 — Tests seq with a wrong separator. The "|" is used as the separator between a and b in the
+ // seq field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: A content model group cannot mix ',' and '|'");
+ });
+
+ test("ibm-not-wf-P50-ibm50n04.xml", () => {
+ // 3.2.1 — Tests seq with a wrong separator. The "." is used as the separator between a and b in the
+ // seq field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found '.'");
+ });
+
+ test("ibm-not-wf-P50-ibm50n05.xml", () => {
+ // 3.2.1 — Tests seq with an extra separator. An extra "," occurs between (a|b) and a in the seq field
+ // in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found ','");
+ });
+
+ test("ibm-not-wf-P50-ibm50n06.xml", () => {
+ // 3.2.1 — Tests seq with a required field missing. The separator between (a|b) and (b|a) is missing in
+ // the seq field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found '('");
+ });
+
+ test("ibm-not-wf-P50-ibm50n07.xml", () => {
+ // 3.2.1 — Tests seq with wrong closing bracket. The "]" is used as the closing bracket in the seq
+ // field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected ')', '|' or ',' in the content model but found ']'");
+ });
+
+ test("ibm-not-wf-P51-ibm51n01.xml", () => {
+ // 3.2.2 — Tests Mixed with a wrong key word. The string "#pcdata" is used as the key word in the Mixed
+ // field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '#pcdata'");
+ });
+
+ test("ibm-not-wf-P51-ibm51n02.xml", () => {
+ // 3.2.2 — Tests Mixed with wrong field ordering. The field #PCDATA does not occur as the first
+ // component in the Mixed field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: #PCDATA must come first in a content model, as (#PCDATA|a|b)*");
+ });
+
+ test("ibm-not-wf-P51-ibm51n03.xml", () => {
+ // 3.2.2 — Tests Mixed with a separator missing. The separator "|" is missing in between #PCDATA and a
+ // in the Mixed field in the fourth elementdecl in the DTD.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n";
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the mixed content model but found 'a'");
+ });
+
+ test("ibm-not-wf-P51-ibm51n04.xml", () => {
+ // 3.2.2 — Tests Mixed with a wrong key word. The string "#CDATA" is used as the key word in the Mixed
+ // field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an element name or '(' in the content model but found '#CDATA'");
+ });
+
+ test("ibm-not-wf-P51-ibm51n05.xml", () => {
+ // 3.2.2 — Tests Mixed with a required field missing. The "*" is missing after the ")" in the Mixed
+ // field in the fourth elementdecl in the DTD.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content";
+ expectRejects(input, "XML Parse error: A mixed content model with element names must end with ')*'");
+ });
+
+ test("ibm-not-wf-P51-ibm51n06.xml", () => {
+ // 3.2.2 — Tests Mixed with wrong closing bracket. The "]" is used as the closing bracket in the Mixed
+ // field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the mixed content model but found ']'");
+ });
+
+ test("ibm-not-wf-P51-ibm51n07.xml", () => {
+ // 3.2.2 — Tests Mixed with a required field missing. The closing bracket ")" is missing after (#PCDATA
+ // in the Mixed field in the fourth elementdecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the mixed content model but found '*'");
+ });
+
+ test("ibm-not-wf-P52-ibm52n01.xml", () => {
+ // 3.3 — Tests AttlistDecl with a required field missing. The Name is missing in the AttlistDecl in the
+ // DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found '#IMPLIED'",
+ );
+ });
+
+ test("ibm-not-wf-P52-ibm52n02.xml", () => {
+ // 3.3 — Tests AttlistDecl with a required field missing. The white space is missing between the
+ // beginning sequence and the name in the AttlistDecl in the DTD.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n";
+ expectRejects(input, "XML Parse error: Whitespace is required before 'a'");
+ });
+
+ test("ibm-not-wf-P52-ibm52n03.xml", () => {
+ // 3.3 — Tests AttlistDecl with wrong field ordering. The Name "a" occurs after the first AttDef in the
+ // AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P52-ibm52n04.xml", () => {
+ // 3.3 — Tests AttlistDecl with wrong key word. The string "Attlist" is used as the key word in the
+ // beginning sequence in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 3.3 — Tests AttlistDecl with a required field missing. The closing bracket "greater than" is missing
+ // in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found a comment",
+ );
+ });
+
+ test("ibm-not-wf-P52-ibm52n06.xml", () => {
+ // 3.3 — Tests AttlistDecl with wrong beginning sequence. The string "(less than)ATTLIST" is used as
+ // the beginning sequence in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a markup declaration or ']' in the internal subset but found ' {
+ // 3.3 — Tests AttDef with a required field missing. The DefaultDecl is missing in the AttDef for the
+ // name "attr1" in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '>'",
+ );
+ });
+
+ test("ibm-not-wf-P53-ibm53n02.xml", () => {
+ // 3.3 — Tests AttDef with a required field missing. The white space is missing between (abc|def) and
+ // "def" in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P53-ibm53n03.xml", () => {
+ // 3.3 — Tests AttDef with a required field missing. The AttType is missing for "attr1" in the AttDef
+ // in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found '#IMPLIED'",
+ );
+ });
+
+ test("ibm-not-wf-P53-ibm53n04.xml", () => {
+ // 3.3 — Tests AttDef with a required field missing. The white space is missing between "attr1" and
+ // (abc|def) in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '('");
+ });
+
+ test("ibm-not-wf-P53-ibm53n05.xml", () => {
+ // 3.3 — Tests AttDef with a required field missing. The Name is missing in the AttDef in the
+ // AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '('");
+ });
+
+ test("ibm-not-wf-P53-ibm53n06.xml", () => {
+ // 3.3 — Tests AttDef with a required field missing. The white space before the name "attr2" is missing
+ // in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'attr2'");
+ });
+
+ test("ibm-not-wf-P53-ibm53n07.xml", () => {
+ // 3.3 — Tests AttDef with wrong field ordering. The Name "attr1" occurs after the AttType in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(input, "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '('");
+ });
+
+ test("ibm-not-wf-P53-ibm53n08.xml", () => {
+ // 3.3 — Tests AttDef with wrong field ordering. The Name "attr1" occurs after the AttType and
+ // "default" occurs before the AttType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nAny content\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P54-ibm54n01.xml", () => {
+ // 3.3.1 — Tests AttType with a wrong option. The string "BOGUSATTR" is used as the AttType in the
+ // AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nGiving a Bogus attribute. \r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'BOGUSATTR'",
+ );
+ });
+
+ test("ibm-not-wf-P54-ibm54n02.xml", () => {
+ // 3.3.1 — Tests AttType with a wrong option. The string "PCDATA" is used as the AttType in the
+ // AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nGiving a wrong AttType for the attribute. \r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'PCDATA'",
+ );
+ });
+
+ test("ibm-not-wf-P55-ibm55n01.xml", () => {
+ // 3.3.1 — Tests StringType with a wrong key word. The lower case string "cdata" is used as the
+ // StringType in the AttType in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nGiving a lowercase for CDATA attribute.\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'cdata'",
+ );
+ });
+
+ test("ibm-not-wf-P55-ibm55n02.xml", () => {
+ // 3.3.1 — Tests StringType with a wrong key word. The string "#CDATA" is used as the StringType in the
+ // AttType in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nGiving a wrong character. \r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found '#CDATA'",
+ );
+ });
+
+ test("ibm-not-wf-P55-ibm55n03.xml", () => {
+ // 3.3.1 — Tests StringType with a wrong key word. The string "CData" is used as the StringType in the
+ // AttType in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\n Giving a wrong key word of the StringType.\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'CData'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n01.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type "id" is used in the TokenizedType in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType id(lowercase)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'id'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n02.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type "Idref" is used in the TokenizedType in
+ // the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType Idref(case sensitive)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'Idref'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n03.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type"Idrefs" is used in the TokenizedType in
+ // the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType IdRefs(case sensitive)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'IdRefs'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n04.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type "EntitY" is used in the TokenizedType in
+ // the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType EntitY(case sensitive)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'EntitY'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n05.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type "nmTOKEN" is used in the TokenizedType in
+ // the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType nmTOKEN(case sensitive)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'nmTOKEN'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n06.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type "NMtokens" is used in the TokenizedType in
+ // the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType NMtokens(case sensitive)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'NMtokens'",
+ );
+ });
+
+ test("ibm-not-wf-P56-ibm56n07.xml", () => {
+ // 3.3.1 — Tests TokenizedType with wrong key word. The type "#ID" is used in the TokenizedType in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\nInvalid TokenizedType #ID(Wrong Character)\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found '#ID'",
+ );
+ });
+
+ test("ibm-not-wf-P57-ibm57n01.xml", () => {
+ // 3.3.1 — Tests EnumeratedType with an illegal option. The string "NMTOKEN (a|b)" is used in the
+ // EnumeratedType in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n ]>\r\n \r\nThis test case tests the illegal enumerated types\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '('",
+ );
+ });
+
+ test("ibm-not-wf-P58-ibm58n01.xml", () => {
+ // 3.3.1 — Tests NotationType with wrong key word. The lower case "notation" is used as the key word in
+ // the NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test with notation (name) \r\nIt is case sensitive.\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'notation'",
+ );
+ });
+
+ test("ibm-not-wf-P58-ibm58n02.xml", () => {
+ // 3.3.1 — Tests NotationType with a required field missing. The beginning bracket "(" is missing in
+ // the NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test with (name) \r\nMissing the open parenthesis\r\n';
+ expectRejects(input, "XML Parse error: Expected '(' after NOTATION but found 'this'");
+ });
+
+ test("ibm-not-wf-P58-ibm58n03.xml", () => {
+ // 3.3.1 — Tests NotationType with a required field missing. The Name is missing in the "()" in the
+ // NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test with NOTATION () \r\nMissing the required field\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name but found ')'");
+ });
+
+ test("ibm-not-wf-P58-ibm58n04.xml", () => {
+ // 3.3.1 — Tests NotationType with a required field missing. The closing bracket is missing in the
+ // NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test with NOTATION (Name \r\nMissing the closing brackets\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found '#IMPLIED'");
+ });
+
+ test("ibm-not-wf-P58-ibm58n05.xml", () => {
+ // 3.3.1 — Tests NotationType with wrong field ordering. The key word "NOTATION" occurs after "(this)"
+ // in the NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test with (Name) NOTATION \r\nWrong Ordering\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found 'NOTATION'",
+ );
+ });
+
+ test("ibm-not-wf-P58-ibm58n06.xml", () => {
+ // 3.3.1 — Tests NotationType with wrong separator. The "," is used as a separator between "this" and
+ // "that" in the NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n ]>\r\n\r\nNegative Test.\r\nThis test tests the presence of a correct seperator. There is a wrong seperator(,)\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found ','");
+ });
+
+ test("ibm-not-wf-P58-ibm58n07.xml", () => {
+ // 3.3.1 — Tests NotationType with a required field missing. The white space is missing between
+ // "NOTATION" and "(this)" in the NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n\r\nNegative Test.\r\nMissing space after NOTATION\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '('");
+ });
+
+ test("ibm-not-wf-P58-ibm58n08.xml", () => {
+ // 3.3.1 — Tests NotationType with extra wrong characters. The double quote character occurs after "("
+ // and before ")" in the NotationType in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n\r\nNegative Test.\r\nPresence of quotes around the value\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name but found '\"'");
+ });
+
+ test("ibm-not-wf-P59-ibm59n01.xml", () => {
+ // 3.3.1 — Tests Enumeration with required fields missing. The Nmtokens and "|"s are missing in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test\r\nMissing the required field\r\n';
+ expectRejects(input, "XML Parse error: Expected a name token in the enumeration but found ')'");
+ });
+
+ test("ibm-not-wf-P59-ibm59n02.xml", () => {
+ // 3.3.1 — Tests Enumeration with a required field missing. The closing bracket ")" is missing in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test\r\nMissing the closing brackets\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found '#IMPLIED'");
+ });
+
+ test("ibm-not-wf-P59-ibm59n03.xml", () => {
+ // 3.3.1 — Tests Enumeration with wrong separator. The "," is used as the separator in the AttDef in
+ // the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test\r\nWrong Separator(, instead of |)\r\n';
+ expectRejects(input, "XML Parse error: Expected '|' or ')' in the enumeration but found ','");
+ });
+
+ test("ibm-not-wf-P59-ibm59n04.xml", () => {
+ // 3.3.1 — Tests Enumeration with illegal presence. The double quotes occur around the Enumeration
+ // value in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test\r\nIllegal presence of quotes around the value\r\n';
+ expectRejects(input, "XML Parse error: Expected a name token in the enumeration but found '\"'");
+ });
+
+ test("ibm-not-wf-P59-ibm59n05.xml", () => {
+ // 3.3.1 — Tests Enumeration with a required field missing. The white space is missing between in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test\r\nMissing the begining bracket \r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'enum'",
+ );
+ });
+
+ test("ibm-not-wf-P59-ibm59n06.xml", () => {
+ // 3.3.1 — Tests Enumeration with a required field missing. The beginning bracket "(" is missing in the
+ // AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n \r\nThis is a Negative test\r\nMissing the Opening brackets\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute type (CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS, NOTATION or an enumeration) but found 'enum'",
+ );
+ });
+
+ test("ibm-not-wf-P60-ibm60n01.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with wrong key word. The string "#required" is used as the key word in the
+ // DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative Test. Case sensitive.\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '#required'",
+ );
+ });
+
+ test("ibm-not-wf-P60-ibm60n02.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with wrong key word. The string "Implied" is used as the key word in the
+ // DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative test. Case Sensitive\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '#Implied'",
+ );
+ });
+
+ test("ibm-not-wf-P60-ibm60n03.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with wrong key word. The string "!IMPLIED" is used as the key word in the
+ // DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative Test. Wrong Character.\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected #REQUIRED, #IMPLIED, #FIXED or a quoted default value but found '!'",
+ );
+ });
+
+ test("ibm-not-wf-P60-ibm60n04.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with a required field missing. There is no attribute value specified after
+ // the key word "#FIXED" in the DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative test. Missing required field(#FIXED should have a value)\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted default value after #FIXED but found '>'");
+ });
+
+ test("ibm-not-wf-P60-ibm60n05.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with a required field missing. The white space is missing between the key
+ // word "#FIXED" and the attribute value in the DefaultDecl in the AttDef in the AttlistDecl in the
+ // DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative test. Missing required field(#FIXED should have a space before value)\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P60-ibm60n06.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with wrong field ordering. The key word "#FIXED" occurs after the
+ // attribute value "introduction" in the DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative test. Wrong Ordering\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '#FIXED'",
+ );
+ });
+
+ test("ibm-not-wf-P60-ibm60n07.xml", () => {
+ // 3.3.2 — Tests DefaultDecl against WFC of P60. The text replacement of the entity "avalue" contains
+ // the "less than" character in the DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n \r\n ]>\r\n\r\n\r\nNegative test. \r\nThe replacement text of any entity referred to directly or indirectly \r\nin an attribute value contains a less than character\r\n';
+ expectRejects(input, "XML Parse error: '<' is not allowed in attribute values");
+ });
+
+ test("ibm-not-wf-P60-ibm60n08.xml", () => {
+ // 3.3.2 — Tests DefaultDecl with more than one key word. The "#REQUIRED" and the "#IMPLIED" are used
+ // as the key words in the DefaultDecl in the AttDef in the AttlistDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n \r\n \r\n ]>\r\n\r\n\r\nNegative Test. More than one Default type declarations.\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected an attribute name or '>' in the ATTLIST declaration but found '#IMPLIED'",
+ );
+ });
+
+ test("ibm-not-wf-P61-ibm61n01.xml", () => {
+ // 3.4 — Tests conditionalSect with a wrong option. The word "NOTINCLUDE" is used as part of an option
+ // which is wrong in the coditionalSect. (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n01.xml", () => {
+ // 3.4 — Tests includeSect with wrong key word. The string "include" is used as a key word in the
+ // beginning sequence in the includeSect in the file ibm62n01.dtd. (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Test includeSect with include(Case sensitive)\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n02.xml", () => {
+ // 3.4 — Tests includeSect with wrong beginning sequence. An extra "[" occurs in the beginning sequence
+ // in the includeSect in the file ibm62n02.dtd. (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. An extra \'[\' is used.\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n03.xml", () => {
+ // 3.4 — Tests includeSect with wrong beginning sequence. A wrong character "?" occurs in the beginning
+ // sequence in the includeSect in the file ibm62n03.dtd. (upstream: not-wf; external parameter entities
+ // are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Wrong character is used is used.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n04.xml", () => {
+ // 3.4 — Tests includeSect with a required field missing. The key word "INCLUDE" is missing in the
+ // includeSect in the file ibm62n04.dtd. (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Missing the required field INCLUDE.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n05.xml", () => {
+ // 3.4 — Tests includeSect with a required field missing. The "[" is missing after the key word
+ // "INCLUDE" in the includeSect in the file ibm62n05.dtd. (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Missing the required field \'[\' after INCLUDE.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n06.xml", () => {
+ // 3.4 — Tests includeSect with wrong field ordering. The two external subset declarations occur before
+ // the key word "INCLUDE" in the includeSect in the file ibm62n06.dtd. (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Wrong Ordering. External subset declaration prior to the keyword INCLUDE\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n07.xml", () => {
+ // 3.4 — Tests includeSect with a required field missing. The closing sequence "]](greater than)" is
+ // missing in the includeSect in the file ibm62n07.dtd. (upstream: not-wf; external parameter entities
+ // are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Missing closing sequence.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P62-ibm62n08.xml", () => {
+ // 3.4 — Tests includeSect with a required field missing. One "]" is missing in the closing sequence in
+ // the includeSect in the file ibm62n08.dtd. (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\nNegative test. Missing external subset declaration.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n01.xml", () => {
+ // 3.4 — Tests ignoreSect with wrong key word. The string "ignore" is used as a key word in the
+ // beginning sequence in the ignoreSect in the file ibm63n01.dtd. (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nNegative test. Case sensitive(ignore is used instead of IGNORE).\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n02.xml", () => {
+ // 3.4 — Tests ignoreSect with wrong beginning sequence. An extra "[" occurs in the beginning sequence
+ // in the ignoreSect in the file ibm63n02.dtd. (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n \r\n]>\r\n\r\nNegative test. Extra \'[\' is used before IGNORE.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n03.xml", () => {
+ // 3.4 — Tests ignoreSect with wrong beginning sequence. A wrong character "?" occurs in the beginning
+ // sequence in the ignoreSect in the file ibm63n03.dtd. (upstream: not-wf; external parameter entities
+ // are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nNegative test. Wrong character.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n04.xml", () => {
+ // 3.4 — Tests ignoreSect with a required field missing. The key word "IGNORE" is missing in the
+ // ignoreSect in the file ibm63n04.dtd. (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nNegative test. Missing required field(The keyword IGNORE is missing).\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n05.xml", () => {
+ // 3.4 — Tests ignoreSect with a required field missing. The "[" is missing after the key word "IGNORE"
+ // in the ignoreSect in the file ibm63n05.dtd. (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nNegative test. Missing required field( \'[\' is missing after IGNORE ).\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n06.xml", () => {
+ // 3.4 — Tests includeSect with wrong field ordering. The two external subset declarations occur before
+ // the key word "IGNORE" in the ignoreSect in the file ibm63n06.dtd. (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n \r\n]>\r\n\r\nNegative test. Wrong Ordering. Ignore sect contents preceding IGNORE.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P63-ibm63n07.xml", () => {
+ // 3.4 — Tests ignoreSect with a required field missing. The closing sequence "]](greater than)" is
+ // missing in the ignoreSect in the file ibm63n07.dtd. (upstream: not-wf; external parameter entities
+ // are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n \r\n]>\r\n\r\nNegative test. Missing closing sequence.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P64-ibm64n01.xml", () => {
+ // 3.4 — Tests ignoreSectContents with wrong beginning sequence. The "?" occurs in beginning sequence
+ // the ignoreSectContents in the file ibm64n01.dtd. (upstream: not-wf; external parameter entities are
+ // not read)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\nNegative Test. Pattern2. Wrong character.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P64-ibm64n02.xml", () => {
+ // 3.4 — Tests ignoreSectContents with a required field missing.The closing sequence is missing in the
+ // ignoreSectContents in the file ibm64n02.dtd. (upstream: not-wf; external parameter entities are not
+ // read)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\nNegative Test. Pattern3. Missing closing sequence.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P64-ibm64n03.xml", () => {
+ // 3.4 — Tests ignoreSectContents with a required field missing.The beginning sequence is missing in
+ // the ignoreSectContents in the file ibm64n03.dtd. (upstream: not-wf; external parameter entities are
+ // not read)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\nNegative Test. Pattern4. Missing opening sequence.\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P65-ibm65n01.xml", () => {
+ // 3.4 — Tests Ignore with illegal string included. The string "]](greater than)" is contained before
+ // "this" in the Ignore in the ignoreSectContents in the file ibm65n01.dtd (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\nNegative Test. Pattern1.Illegal sequence of \']]\'\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P65-ibm65n02.xml", () => {
+ // 3.4 — Tests Ignore with illegal string included. The string "(less than)![" is contained before
+ // "this" in the Ignore in the ignoreSectContents in the file ibm65n02.dtd (upstream: not-wf; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\nNegative Test. Pattern2. \r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P66-ibm66n01.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#002f" is used as the referred
+ // character in the CharRef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found 'f'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n02.xml", () => {
+ // 4.1 — Tests CharRef with the semicolon character missing. The semicolon character is missing at the
+ // end of the CharRef in the attribute value in the STag of element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n03.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "49" is used as the referred
+ // character in the CharRef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name after '&' but found '4'");
+ });
+
+ test("ibm-not-wf-P66-ibm66n04.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#5~0" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '~'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n05.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#x002g" is used as the referred
+ // character in the CharRef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found 'g'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n06.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#x006G" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found 'G'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n07.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#0=2f" is used as the referred
+ // character in the CharRef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '='",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n08.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#56.0" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '.'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n09.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#x00/2f" is used as the referred
+ // character in the CharRef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found '/'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n10.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#51)" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found ')'",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n11.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#00 2f" is used as the referred
+ // character in the CharRef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Invalid character reference: expected a number followed by ';' but found space",
+ );
+ });
+
+ test("ibm-not-wf-P66-ibm66n12.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#x0000" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Character reference '' is not a valid XML character");
+ });
+
+ test("ibm-not-wf-P66-ibm66n13.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#x001f" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Character reference '' is not a valid XML character");
+ });
+
+ test("ibm-not-wf-P66-ibm66n14.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#xfffe" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Character reference '' is not a valid XML character");
+ });
+
+ test("ibm-not-wf-P66-ibm66n15.xml", () => {
+ // 4.1 — Tests CharRef with an illegal character referred to. The "#xffff" is used as the referred
+ // character in the attribute value in the EmptyElemTag of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Character reference '' is not a valid XML character");
+ });
+
+ test("ibm-not-wf-P68-ibm68n01.xml", () => {
+ // 4.1 — Tests EntityRef with a required field missing. The Name is missing in the EntityRef in the
+ // content of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nmissing entity name &;\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name after '&' but found ';'");
+ });
+
+ test("ibm-not-wf-P68-ibm68n02.xml", () => {
+ // 4.1 — Tests EntityRef with a required field missing. The semicolon is missing in the EntityRef in
+ // the attribute value in the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nmissing semi-colon\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' after the entity name but found '\"'");
+ });
+
+ test("ibm-not-wf-P68-ibm68n03.xml", () => {
+ // 4.1 — Tests EntityRef with an extra white space. A white space occurs after the ampersand in the
+ // EntityRef in the content of the element "root".
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nextra space after ampsand & aaa;\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name after '&' but found space");
+ });
+
+ test("ibm-not-wf-P68-ibm68n04.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: Entity Declared. The name "aAa" in the EntityRef in
+ // the AttValue in the STage of the element "root" does not match the Name of any declared entity in
+ // the DTD.
+ const input: string =
+ '\r\n\r\n\r\n]>\r\nreference doesn\'t match delaration\r\n';
+ expectRejects(input, "XML Parse error: Entity 'aAa' is not declared");
+ });
+
+ test("ibm-not-wf-P68-ibm68n05.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: Entity Declared. The entity with the name "aaa" in
+ // the EntityRef in the AttValue in the STag of the element "root" is not declared.
+ const input: string =
+ "\r\n\r\n]>\r\nundefined entitiy &aaa; \r\n";
+ expectRejects(input, "XML Parse error: Entity 'aaa' is not declared");
+ });
+
+ test("ibm-not-wf-P68-ibm68n06.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: Entity Declared. The entity with the name "aaa" in
+ // the EntityRef in the AttValue in the STag of the element "root" is externally declared, but
+ // standalone is "yes". (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\nentity declared externally but standalone is yes\r\n';
+ expectRejects(input, "XML Parse error: Entity 'aaa' is not declared");
+ });
+
+ test("ibm-not-wf-P68-ibm68n07.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: Entity Declared. The entity with the name "aaa" in
+ // the EntityRef in the AttValue in the STag of the element "root" is referred before declared.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Entity 'aaa' is not declared");
+ });
+
+ test("ibm-not-wf-P68-ibm68n08.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: Parsed Entity. The EntityRef in the AttValue in the
+ // STag of the element "root" contains the name "aImage" of an unparsed entity.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\nunparsed entity reference in the wrong place &aImage;\r\n';
+ expectRejects(input, "XML Parse error: Unparsed entity 'aImage' cannot be referenced");
+ });
+
+ test("ibm-not-wf-P68-ibm68n09.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: No Recursion. The recursive entity reference occurs
+ // with the entity declarations for "aaa" and "bbb" in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n\r\n';
+ expectRejects(input, "XML Parse error: Entity 'aaa' refers to itself");
+ });
+
+ test("ibm-not-wf-P68-ibm68n10.xml", () => {
+ // 4.1 — Tests EntityRef which is against P68 WFC: No Recursion. The indirect recursive entity
+ // reference occurs with the entity declarations for "aaa", "bbb", "ccc", "ddd", and "eee" in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Entity 'aaa' refers to itself");
+ });
+
+ test("ibm-not-wf-P69-ibm69n01.xml", () => {
+ // 4.1 — Tests PEReference with a required field missing. The Name "paaa" is missing in the PEReference
+ // in the DTD.
+ const input: string =
+ '\r\n">\r\n\r\n%;\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '%'");
+ });
+
+ test("ibm-not-wf-P69-ibm69n02.xml", () => {
+ // 4.1 — Tests PEReference with a required field missing. The semicolon is missing in the PEReference
+ // "%paaa" in the DTD.
+ const input: string =
+ '\r\n">\r\n\r\n%paaa\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' to end the parameter entity reference 'paaa'");
+ });
+
+ test("ibm-not-wf-P69-ibm69n03.xml", () => {
+ // 4.1 — Tests PEReference with an extra white space. There is an extra white space occurs before ";"
+ // in the PEReference in the DTD.
+ const input: string =
+ '\r\n">\r\n\r\n%paaa ;\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected ';' to end the parameter entity reference 'paaa'");
+ });
+
+ test("ibm-not-wf-P69-ibm69n04.xml", () => {
+ // 4.1 — Tests PEReference with an extra white space. There is an extra white space occurs after "%" in
+ // the PEReference in the DTD.
+ const input: string =
+ '\r\n">\r\n\r\n% paaa;\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a markup declaration or ']' in the internal subset but found '%'");
+ });
+
+ test("ibm-not-wf-P69-ibm69n05.xml", () => {
+ // 4.1 — Based on E29 substantial source: minutes XML-Syntax 1999-02-24 E38 in XML 1.0 Errata, this WFC
+ // does not apply to P69, but the VC Entity declared still apply. Tests PEReference which is against
+ // P69 WFC: Entity Declared. The PE with the name "paaa" is referred before declared in the DTD.
+ // (upstream: optional error)
+ const input: string =
+ '\r\n\r\n\r\n%paaa;\r\n">\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Parameter entity 'paaa' is not declared");
+ });
+
+ test("ibm-not-wf-P69-ibm69n06.xml", () => {
+ // 4.1 — Tests PEReference which is against P69 WFC: No Recursion. The recursive PE reference occurs
+ // with the entity declarations for "paaa" and "bbb" in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P69-ibm69n07.xml", () => {
+ // 4.1 — Tests PEReference which is against P69 WFC: No Recursion. The indirect recursive PE reference
+ // occurs with the entity declarations for "paaa", "bbb", "ccc", "ddd", and "eee" in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P71-ibm70n01.xml", () => {
+ // 4.2 — Tests
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a markup declaration or ']' in the internal subset but found ' {
+ // 4.2 — Tests EntityDecl with a required field missing. The white space is missing between the
+ // beginning sequence and the Name "aaa" in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'aaa'");
+ });
+
+ test("ibm-not-wf-P71-ibm71n02.xml", () => {
+ // 4.2 — Tests EntityDecl with a required field missing. The white space is missing between the Name
+ // "aaa" and the EntityDef "aString" in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P71-ibm71n03.xml", () => {
+ // 4.2 — Tests EntityDecl with a required field missing. The EntityDef is missing in the EntityDecl
+ // with the Name "aaa" in the DTD.
+ const input: string =
+ "\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n";
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found '>'");
+ });
+
+ test("ibm-not-wf-P71-ibm71n04.xml", () => {
+ // 4.2 — Tests EntityDecl with a required field missing. The Name is missing in the EntityDecl with the
+ // EntityDef "aString" in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name or '%' after ' {
+ // 4.2 — Tests EntityDecl with wrong ordering. The Name "aaa" occurs after the EntityDef in the
+ // EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name or '%' after ' {
+ // 4.2 — Tests EntityDecl with wrong key word. The string "entity" is used as the key word in the
+ // beginning sequence in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 4.2 — Tests EntityDecl with a required field missing. The closing bracket (greater than) is missing
+ // in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n&aaa;\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found ']'");
+ });
+
+ test("ibm-not-wf-P71-ibm71n08.xml", () => {
+ // 4.2 — Tests EntityDecl with a required field missing. The exclamation mark is missing in the
+ // beginning sequence in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n&aaa;\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a markup declaration or ']' in the internal subset but found ' {
+ // 4.2 — Tests PEdecl with a required field missing. The white space is missing between the beginning
+ // sequence and the "%" in the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n">\r\n%paaa;\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '%'");
+ });
+
+ test("ibm-not-wf-P72-ibm72n02.xml", () => {
+ // 4.2 — Tests PEdecl with a required field missing. The Name is missing in the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n">\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the parameter entity name after '%' but found '\"'");
+ });
+
+ test("ibm-not-wf-P72-ibm72n03.xml", () => {
+ // 4.2 — Tests PEdecl with a required field missing. The white space is missing between the Name and
+ // the PEDef in the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n">\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P72-ibm72n04.xml", () => {
+ // 4.2 — Tests PEdecl with a required field missing. The PEDef is missing after the Name "paaa" in the
+ // PEDecl in the DTD.
+ const input: string =
+ "\r\n\r\n\r\n\r\n%paaa;\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found '>'");
+ });
+
+ test("ibm-not-wf-P72-ibm72n05.xml", () => {
+ // 4.2 — Tests PEdecl with wrong field ordering. The Name "paaa" occurs after the PEDef in the PEDecl
+ // in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n" paaa>\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the parameter entity name after '%' but found '\"'");
+ });
+
+ test("ibm-not-wf-P72-ibm72n06.xml", () => {
+ // 4.2 — Tests PEdecl with wrong field ordering. The "%" and the Name "paaa" occurs after the PEDef in
+ // the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n" % paaa >\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected an entity name or '%' after ' {
+ // 4.2 — Tests PEdecl with wrong key word. The string "entity" is used as the key word in the beginning
+ // sequence in the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n">\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 4.2 — Tests PEdecl with a required field missing. The closing bracket (greater than) is missing in
+ // the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n"\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Parameter entity references are not allowed inside markup declarations in the internal subset",
+ );
+ });
+
+ test("ibm-not-wf-P72-ibm72n09.xml", () => {
+ // 4.2 — Tests PEdecl with wrong closing sequence. The string "!(greater than)" is used as the closing
+ // sequence in the PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n" !>\r\n%paaa;\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before '%'");
+ });
+
+ test("ibm-not-wf-P73-ibm73n01.xml", () => {
+ // 4.2 — Tests EntityDef with wrong field ordering. The NDataDecl "NDATA JPGformat" occurs before the
+ // ExternalID in the EntityDef in the EntityDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found 'NDATA'");
+ });
+
+ test("ibm-not-wf-P73-ibm73n03.xml", () => {
+ // 4.2 — Tests EntityDef with a required field missing. The ExternalID is missing before the NDataDecl
+ // in the EntityDef in the EntityDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found 'NDATA'");
+ });
+
+ test("ibm-not-wf-P74-ibm74n01.xml", () => {
+ // 4.2 — Tests PEDef with extra fields. The NDataDecl occurs after the ExternalID in the PEDef in the
+ // PEDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Parameter entities cannot have NDATA");
+ });
+
+ test("ibm-not-wf-P75-ibm75n01.xml", () => {
+ // 4.2.2 — Tests ExternalID with wrong key word. The string "system" is used as the key word in the
+ // ExternalID in the EntityDef in the EntityDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted entity value, SYSTEM or PUBLIC but found 'system'");
+ });
+
+ test("ibm-not-wf-P75-ibm75n02.xml", () => {
+ // 4.2.2 — Tests ExternalID with wrong key word. The string "public" is used as the key word in the
+ // ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found 'public'",
+ );
+ });
+
+ test("ibm-not-wf-P75-ibm75n03.xml", () => {
+ // 4.2.2 — Tests ExternalID with wrong key word. The string "Public" is used as the key word in the
+ // ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found 'Public'",
+ );
+ });
+
+ test("ibm-not-wf-P75-ibm75n04.xml", () => {
+ // 4.2.2 — Tests ExternalID with wrong field ordering. The key word "PUBLIC" occurs after the
+ // PublicLiteral and the SystemLiteral in the ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P75-ibm75n05.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The white space between "SYSTEM" and the
+ // Systemliteral is missing in the ExternalID in the EntityDef in the EntityDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P75-ibm75n06.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The Systemliteral is missing after "SYSTEM"
+ // in the ExternalID in the EntityDef in the EntityDecl in the DTD.
+ const input: string =
+ "\r\n\r\n\r\n\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a quoted system identifier after SYSTEM but found '>'");
+ });
+
+ test("ibm-not-wf-P75-ibm75n07.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The white space between the PublicLiteral
+ // and the Systemliteral is missing in the ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P75-ibm75n08.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The key word "PUBLIC" is missing in the
+ // ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P75-ibm75n09.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The white space between "PUBLIC" and the
+ // PublicLiteral is missing in the ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P75-ibm75n10.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The PublicLiteral is missing in the
+ // ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Invalid character in a public identifier: '\\'");
+ });
+
+ test("ibm-not-wf-P75-ibm75n11.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The PublicLiteral is missing in the
+ // ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found 'public'",
+ );
+ });
+
+ test("ibm-not-wf-P75-ibm75n12.xml", () => {
+ // 4.2.2 — Tests ExternalID with a required field missing. The SystemLiteral is missing in the
+ // ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'SYSTEM'");
+ });
+
+ test("ibm-not-wf-P75-ibm75n13.xml", () => {
+ // 4.2.2 — Tests ExternalID with wrong field ordering. The key word "PUBLIC" occurs after the
+ // PublicLiteral in the ExternalID in the doctypedecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected SYSTEM, PUBLIC, '[' or '>' in the document type declaration but found '\"'",
+ );
+ });
+
+ test("ibm-not-wf-P76-ibm76n01.xml", () => {
+ // 4.2.2 — Tests NDataDecl with wrong key word. The string "ndata" is used as the key word in the
+ // NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'ndata'");
+ });
+
+ test("ibm-not-wf-P76-ibm76n02.xml", () => {
+ // 4.2.2 — Tests NDataDecl with wrong key word. The string "NData" is used as the key word in the
+ // NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'NData'");
+ });
+
+ test("ibm-not-wf-P76-ibm76n03.xml", () => {
+ // 4.2.2 — Tests NDataDecl with a required field missing. The leading white space is missing in the
+ // NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'NDATA'");
+ });
+
+ test("ibm-not-wf-P76-ibm76n04.xml", () => {
+ // 4.2.2 — Tests NDataDecl with a required field missing. The key word "NDATA" is missing in the
+ // NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'JPGformat'");
+ });
+
+ test("ibm-not-wf-P76-ibm76n05.xml", () => {
+ // 4.2.2 — Tests NDataDecl with a required field missing. The Name after the key word "NDATA" is
+ // missing in the NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a notation name after NDATA but found '>'");
+ });
+
+ test("ibm-not-wf-P76-ibm76n06.xml", () => {
+ // 4.2.2 — Tests NDataDecl with a required field missing. The white space between "NDATA" and the Name
+ // is missing in the NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'NDATAJPGformat'");
+ });
+
+ test("ibm-not-wf-P76-ibm76n07.xml", () => {
+ // 4.2.2 — Tests NDataDecl with wrong field ordering. The key word "NDATA" occurs after the Name in the
+ // NDataDecl in the EntityDef in the GEDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the entity declaration but found 'JPGformat'");
+ });
+
+ test("ibm-not-wf-P77-ibm77n01.xml", () => {
+ // 4.3.1 — Tests TextDecl with wrong field ordering. The VersionInfo occurs after the EncodingDecl in
+ // the TextDecl in the file "ibm77n01.ent". (upstream: not-wf; external general entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&aExternal;\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P77-ibm77n02.xml", () => {
+ // 4.3.1 — Tests TextDecl with wrong key word. The string "XML" is used in the beginning sequence in
+ // the TextDecl in the file "ibm77n02.ent". (upstream: not-wf; external general entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&aExternal;\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P77-ibm77n03.xml", () => {
+ // 4.3.1 — Tests TextDecl with wrong closing sequence. The character "greater than" is used as the
+ // closing sequence in the TextDecl in the file "ibm77n03.ent". (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n%pExternal;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P77-ibm77n04.xml", () => {
+ // 4.3.1 — Tests TextDecl with a required field missing. The closing sequence is missing in the
+ // TextDecl in the file "ibm77n04.ent". (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n%pExternal;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P78-ibm78n01.xml", () => {
+ // 4.3.2 — Tests extParsedEnt with wrong field ordering. The TextDecl occurs after the content in the
+ // file ibm78n01.ent. (upstream: not-wf; external general entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&aExternal;\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P78-ibm78n02.xml", () => {
+ // 4.3.2 — Tests extParsedEnt with extra field. A blank line occurs before the TextDecl in the file
+ // ibm78n02.ent. (upstream: not-wf; external general entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n&aExternal;\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P79-ibm79n01.xml", () => {
+ // 4.3.2 — Tests extPE with wrong field ordering. The TextDecl occurs after the extSubsetDecl (the
+ // white space and the comment) in the file ibm79n01.ent. (upstream: not-wf; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n%pExternal;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P79-ibm79n02.xml", () => {
+ // 4.3.2 — Tests extPE with extra field. A blank line occurs before the TextDecl in the file
+ // ibm78n02.ent. (upstream: not-wf; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\n%pExternal;\r\n]>\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-not-wf-P80-ibm80n01.xml", () => {
+ // 4.3.3 — Tests EncodingDecl with a required field missing. The leading white space is missing in the
+ // EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Whitespace is required before 'encoding'");
+ });
+
+ test("ibm-not-wf-P80-ibm80n02.xml", () => {
+ // 4.3.3 — Tests EncodingDecl with a required field missing. The "=" sign is missing in the
+ // EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Expected '=' after the name in the XML declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P80-ibm80n03.xml", () => {
+ // 4.3.3 — Tests EncodingDecl with a required field missing. The double quoted EncName are missing in
+ // the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Expected a quoted value in the XML declaration but found '?'");
+ });
+
+ test("ibm-not-wf-P80-ibm80n04.xml", () => {
+ // 4.3.3 — Tests EncodingDecl with wrong field ordering. The string "encoding=" occurs after the double
+ // quoted EncName in the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Expected '?>' to end the XML declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P80-ibm80n05.xml", () => {
+ // 4.3.3 — Tests EncodingDecl with wrong field ordering. The "encoding" occurs after the double quoted
+ // EncName in the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Expected '?>' to end the XML declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P80-ibm80n06.xml", () => {
+ // 4.3.3 — Tests EncodingDecl with wrong key word. The string "Encoding" is used as the key word in the
+ // EncodingDecl in the XMLDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Unexpected 'Encoding' in the XML declaration (expected version, encoding or standalone)",
+ );
+ });
+
+ test("ibm-not-wf-P81-ibm81n01.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The "_" is used as the first character in the
+ // EncName in the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name '_UTF-8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n02.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The "-" is used as the first character in the
+ // EncName in the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name '-UTF-8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n03.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The "." is used as the first character in the
+ // EncName in the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name '.UTF-8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n04.xml", () => {
+ // 4.3.3 — Tests EncName with illegal characters. The "8-" is used as the initial characters in the
+ // EncName in the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name '8-UTF' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n05.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The "~" is used as one character in the EncName in
+ // the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name 'UTF~8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n06.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The "#" is used as one character in the EncName in
+ // the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name 'UTF#8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n07.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The ":" is used as one character in the EncName in
+ // the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name 'UTF:8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n08.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The "/" is used as one character in the EncName in
+ // the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name 'UTF/8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P81-ibm81n09.xml", () => {
+ // 4.3.3 — Tests EncName with an illegal character. The ";" is used as one character in the EncName in
+ // the EncodingDecl in the XMLDecl.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectRejects(input, "XML Parse error: Invalid encoding name 'UTF;8' in the XML declaration");
+ });
+
+ test("ibm-not-wf-P82-ibm82n01.xml", () => {
+ // 4.7 — Tests NotationDecl with a required field missing. The white space after the beginning sequence
+ // of the NotationDecl is missing in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before 'JPGformat'");
+ });
+
+ test("ibm-not-wf-P82-ibm82n02.xml", () => {
+ // 4.7 — Tests NotationDecl with a required field missing. The Name in the NotationDecl is missing in
+ // the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected SYSTEM or PUBLIC in the notation declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P82-ibm82n03.xml", () => {
+ // 4.7 — Tests NotationDecl with a required field missing. The externalID or the PublicID is missing in
+ // the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected SYSTEM or PUBLIC in the notation declaration but found '>'");
+ });
+
+ test("ibm-not-wf-P82-ibm82n04.xml", () => {
+ // 4.7 — Tests NotationDecl with wrong field ordering. The Name occurs after the "SYSTEM" and the
+ // externalID in the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected SYSTEM or PUBLIC in the notation declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P82-ibm82n05.xml", () => {
+ // 4.7 — Tests NotationDecl with wrong key word. The string "notation" is used as a key word in the
+ // NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: ' {
+ // 4.7 — Tests NotationDecl with a required field missing. The closing bracket (the greater than
+ // character) is missing in the NotationDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the notation declaration but found ' {
+ // 4.7 — Tests NotationDecl with wrong beginning sequence. The "!" is missing in the beginning sequence
+ // in the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ expectRejects(
+ input,
+ "XML Parse error: Expected a markup declaration or ']' in the internal subset but found ' {
+ // 4.7 — Tests NotationDecl with wrong closing sequence. The extra "!" occurs in the closing sequence
+ // in the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected '>' to end the notation declaration but found '!'");
+ });
+
+ test("ibm-not-wf-P83-ibm83n01.xml", () => {
+ // 4.7 — Tests PublicID with wrong key word. The string "public" is used as the key word in the
+ // PublicID in the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected SYSTEM or PUBLIC in the notation declaration but found 'public'");
+ });
+
+ test("ibm-not-wf-P83-ibm83n02.xml", () => {
+ // 4.7 — Tests PublicID with wrong key word. The string "Public" is used as the key word in the
+ // PublicID in the NotationDecl in the DTD.
+ const input: string =
+ 'r\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected the root element but found 'r'");
+ });
+
+ test("ibm-not-wf-P83-ibm83n03.xml", () => {
+ // 4.7 — Tests PublicID with a required field missing. The key word "PUBLIC" is missing in the PublicID
+ // in the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected SYSTEM or PUBLIC in the notation declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P83-ibm83n04.xml", () => {
+ // 4.7 — Tests PublicID with a required field missing. The white space between the "PUBLIC" and the
+ // PubidLiteral is missing in the PublicID in the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Whitespace is required before a quoted string");
+ });
+
+ test("ibm-not-wf-P83-ibm83n05.xml", () => {
+ // 4.7 — Tests PublicID with a required field missing. The PubidLiteral is missing in the PublicID in
+ // the NotationDecl in the DTD.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected a quoted public identifier after PUBLIC but found '>'");
+ });
+
+ test("ibm-not-wf-P83-ibm83n06.xml", () => {
+ // 4.7 — Tests PublicID with wrong field ordering. The key word "PUBLIC" occurs after the PubidLiteral
+ // in the PublicID in the NotationDecl.
+ const input: string =
+ '\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n';
+ expectRejects(input, "XML Parse error: Expected SYSTEM or PUBLIC in the notation declaration but found '\"'");
+ });
+
+ test("ibm-not-wf-P85-ibm85n01.xml", () => {
+ // B. — Tests BaseChar with an illegal character. The character #x00D7 occurs as the first character of
+ // the PITarget in the PI in the DTD.
+ const input: string =
+ "\r\n× an illegal char #x0d7\r\n in PITarget ?>\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a processing instruction target after '' but found '×' (U+00D7)");
+ });
+
+ test("ibm-not-wf-P85-ibm85n02.xml", () => {
+ // B. — Tests BaseChar with an illegal character. The character #x00F7 occurs as the first character of
+ // the PITarget in the PI in the DTD.
+ const input: string =
+ "\r\n÷ an illegal char #x0f7\r\n in PITarget ?>\r\n]>\r\n\r\n";
+ expectRejects(input, "XML Parse error: Expected a processing instruction target after '' but found '÷' (U+00F7)");
+ });
+
+ test("ibm-not-wf-P88-ibm88n01.xml", () => {
+ // B. — Tests Digit with an illegal character. The character #x0029 occurs as the second character in
+ // the PITarget in the PI in the DTD.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found ')'",
+ );
+ });
+
+ test("ibm-not-wf-P88-ibm88n02.xml", () => {
+ // B. — Tests Digit with an illegal character. The character #x003B occurs as the second character in
+ // the PITarget in the PI in the DTD.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found ';'",
+ );
+ });
+
+ test("ibm-not-wf-P89-ibm89n01.xml", () => {
+ // B. — Tests Extender with an illegal character. The character #x00B6 occurs as the second character
+ // in the PITarget in the PI in the DTD.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found '¶' (U+00B6)",
+ );
+ });
+
+ test("ibm-not-wf-P89-ibm89n02.xml", () => {
+ // B. — Tests Extender with an illegal character. The character #x00B8 occurs as the second character
+ // in the PITarget in the PI in the DTD.
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ expectRejects(
+ input,
+ "XML Parse error: Expected whitespace or '?>' after the processing instruction target but found '¸' (U+00B8)",
+ );
+ });
+
+ test("ibm-valid-P01-ibm01v01.xml", () => {
+ // 2.1 — Tests with a xml document consisting of prolog followed by element then Misc
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n]>\r\n\r\n \r\n\r\n \r\n This is a white tiger in Mirage!!\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n',
+ );
+ const canonical =
+ '
This is a white tiger in Mirage!!
';
+ const compact: unknown = {
+ animal: {
+ cat: ["", ""],
+ tiger: { "@color": "white", "#text": "This is a white tiger in Mirage!!" },
+ leopard: { small: "", big: "" },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P02-ibm02v01.xml", () => {
+ // 2.2 — This test case covers legal character ranges plus discrete legal characters for production 02.
+ const input = Buffer.from(
+ '\r\n\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ expectParses(input);
+ });
+
+ test("ibm-valid-P03-ibm03v01.xml", () => {
+ // 2.3 — Tests all 4 legal white space characters - #x20 #x9 #xD #xA
+ const input = Buffer.from(
+ '\r\r\n\r\r\n\r\r\n\r\r\n]>\r\r\n\r\r\n',
+ );
+ expectParses(input);
+ });
+
+ test("ibm-valid-P09-ibm09v01.xml", () => {
+ // 2.3 — Empty EntityValue is legal
+ const input: string =
+ '\r\n \r\n \t\r\n]>\r\n\r\nMy Name is &FullName;. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ const canonical = "My Name is . ";
+ const compact: unknown = { student: "My Name is ." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P09-ibm09v02.xml", () => {
+ // 2.3 — Tests a normal EnitityValue
+ const input: string =
+ '\r\n \r\n \t\r\n]>\r\n\r\nMy Name is &FullName;. ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P09-ibm09v03.xml", () => {
+ // 2.3 — Tests EnitityValue referencing a Parameter Entity (upstream: valid; external parameter
+ // entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\nI am a new student with &Name;\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-valid-P09-ibm09v04.xml", () => {
+ // 2.3 — Tests EnitityValue referencing a General Entity
+ const input: string =
+ ' \r\n\r\n\r\n\t \r\n \t\r\n]>\r\n\r\nMy Name is &FullName;. ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P09-ibm09v05.xml", () => {
+ // 2.3 — Tests EnitityValue with combination of GE, PE and text, the GE used is declared in the
+ // student.dtd (upstream: valid; external parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n \r\n\t\r\n\t\r\n \t\r\n]>\r\n\r\n\r\nThis is a test of &combine;\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-valid-P10-ibm10v01.xml", () => {
+ // 2.3 — Tests empty AttValue with double quotes as the delimiters
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy Name is Snow &mylast; Man. \r\n\r\n\r\n\r\n\r\n\r\n\r\n';
+ const canonical = 'My Name is Snow Man. ';
+ const compact: unknown = { student: { "@first": "", "@last": "", "#text": "My Name is Snow Man." } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v02.xml", () => {
+ // 2.3 — Tests empty AttValue with single quotes as the delimiters
+ const input: string =
+ "\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy Name is Snow &mylast; Man. \r\n\r\n";
+ const canonical = 'My Name is Snow Man. ';
+ const compact: unknown = { student: { "@first": "", "@last": "", "#text": "My Name is Snow Man." } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v03.xml", () => {
+ // 2.3 — Test AttValue with double quotes as the delimiters and single quote inside
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy Name is &myfirst; &mylast;. ';
+ const canonical = 'My Name is Snow Man\'. ';
+ const compact: unknown = {
+ student: { "@first": "Snow'", "@last": "Man", "#text": "My Name is Snow Man'." },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v04.xml", () => {
+ // 2.3 — Test AttValue with single quotes as the delimiters and double quote inside
+ const input: string =
+ "\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy Name is &myfirst; &mylast;. \r\n\r\n";
+ const canonical = 'My Name is Snow Man". ';
+ const compact: unknown = {
+ student: { "@first": 'Snow"', "@last": "Man", "#text": 'My Name is Snow Man".' },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v05.xml", () => {
+ // 2.3 — Test AttValue with a GE reference and double quotes as the delimiters
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy Name is &mylast;. \r\n\r\n';
+ const canonical = 'My Name is Snow Man. ';
+ const compact: unknown = {
+ student: { "@first": "Snow", "@last": "mylast;", "#text": "My Name is Snow Man." },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v06.xml", () => {
+ // 2.3 — Test AttValue with a GE reference and single quotes as the delimiters
+ const input: string =
+ "\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy Name is &mylast;. \r\n\r\n";
+ const canonical = 'My Name is Snow Man. ';
+ const compact: unknown = {
+ student: { "@first": "Snow", "@last": "Snow Man", "#text": "My Name is Snow Man." },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v07.xml", () => {
+ // 2.3 — testing AttValue with mixed references and text content in double quotes
+ const input: string =
+ '\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy first Name is &myfirst; and my last name is &mylast;. \r\n';
+ const canonical =
+ 'My first Name is Snow and my last name is Man Snow and Snow mymiddle;.. ';
+ const compact: unknown = {
+ student: {
+ "@first": "Full Name Snow 1 and Man Snow and Snow mymiddle;. Man Snow and Snow mymiddle;. c",
+ "@last": "Man Snow and Snow mymiddle;.",
+ "#text": "My first Name is Snow and my last name is Man Snow and Snow mymiddle;..",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P10-ibm10v08.xml", () => {
+ // 2.3 — testing AttValue with mixed references and text content in single quotes
+ const input: string =
+ "\r\n\r\n\t \r\n\t\r\n\t\r\n\t\r\n]>\r\n\r\nMy first Name is &myfirst; and my last name is &mylast;. \r\n\r\n";
+ const canonical =
+ 'My first Name is Snow and my last name is Man Snow and Snow mymiddle;.. ';
+ const compact: unknown = {
+ student: {
+ "@first": 'Full Name Snow and "Man Snow and Snow mymiddle;." Man Snow and Snow mymiddle;.',
+ "@last": "Man Snow and Snow mymiddle;.",
+ "#text": "My first Name is Snow and my last name is Man Snow and Snow mymiddle;..",
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P11-ibm11v01.xml", () => {
+ // 2.3 — Tests empty systemliteral using the double quotes
+ const input: string =
+ '\r\n\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P11-ibm11v02.xml", () => {
+ // 2.3 — Tests empty systemliteral using the single quotes
+ const input: string =
+ "\r\n\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n";
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P11-ibm11v03.xml", () => {
+ // 2.3 — Tests regular systemliteral using the single quotes (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P11-ibm11v04.xml", () => {
+ // 2.3 — Tests regular systemliteral using the double quotes (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P12-ibm12v01.xml", () => {
+ // 2.3 — Tests empty systemliteral using the double quotes (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P12-ibm12v02.xml", () => {
+ // 2.3 — Tests empty systemliteral using the single quotes (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ "\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n";
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P12-ibm12v03.xml", () => {
+ // 2.3 — Tests regular systemliteral using the double quotes (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P12-ibm12v04.xml", () => {
+ // 2.3 — Tests regular systemliteral using the single quotes (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ "\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n";
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P13-ibm13v01.xml", () => {
+ // 2.3 — Testing PubidChar with all legal PubidChar in a PubidLiteral (upstream: valid; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P14-ibm14v01.xml", () => {
+ // 2.4 — Testing CharData with empty string
+ const input: string =
+ '\r\n\r\n\t\r\n]>\r\n\r\n\r\n\r\n\r\n\r\n';
+ const canonical = '';
+ const compact: unknown = { student: { "@first": "Snow" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P14-ibm14v02.xml", () => {
+ // 2.4 — Testing CharData with white space character
+ const input: string =
+ '\r\n\r\n\t\r\n]>\r\n\r\n\r\n
\r\n\r\n\r\n';
+ const canonical = '
';
+ const compact: unknown = { student: { "@first": "Eric" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P14-ibm14v03.xml", () => {
+ // 2.4 — Testing CharData with a general text string
+ const input: string =
+ '\r\n\r\n\t\r\n]>\r\n\r\n\r\nThis is a test';
+ const canonical = 'This is a test';
+ const compact: unknown = { student: { "@first": "Snow", "@last": "Man", "#text": "This is a test" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P15-ibm15v01.xml", () => {
+ // 2.5 — Tests empty comment
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P15-ibm15v02.xml", () => {
+ // 2.5 — Tests comment with regular text
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P15-ibm15v03.xml", () => {
+ // 2.5 — Tests comment with one dash inside
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P15-ibm15v04.xml", () => {
+ // 2.5 — Tests comment with more comprehensive content
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P16-ibm16v01.xml", () => {
+ // 2.6 — Tests PI definition with only PItarget name and nothing else
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P16-ibm16v02.xml", () => {
+ // 2.6 — Tests PI definition with only PItarget name and a white space
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P16-ibm16v03.xml", () => {
+ // 2.6 — Tests PI definition with PItarget name and text that contains question mark and right angle
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n IN PI ?>\r\nMy Name is SnowMan. ';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P17-ibm17v01.xml", () => {
+ // 2.6 — Tests PITarget name
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P18-ibm18v01.xml", () => {
+ // 2.7 — Tests CDSect with CDStart CData CDEnd
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. text]]> \r\n\r\n';
+ const canonical = "My Name is SnowMan. This is <normal> text ";
+ const compact: unknown = { student: "My Name is SnowMan. This is text" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P19-ibm19v01.xml", () => {
+ // 2.7 — Tests CDStart
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ const canonical = "My Name is SnowMan. This is a test ";
+ const compact: unknown = { student: "My Name is SnowMan. This is a test" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P20-ibm20v01.xml", () => {
+ // 2.7 — Tests CDATA with empty string
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ const canonical = "My Name is SnowMan. ";
+ const compact: unknown = { student: "My Name is SnowMan." };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P20-ibm20v02.xml", () => {
+ // 2.7 — Tests CDATA with regular content
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n\r\n\r\nMy Name is SnowMan. This is a test]]>';
+ const canonical = "My Name is SnowMan. <testing>This is a test</testing>";
+ const compact: unknown = { student: "My Name is SnowMan. This is a test" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P21-ibm21v01.xml", () => {
+ // 2.7 — Tests CDEnd
+ const input: string =
+ '\r\n \r\n]>\r\n\r\n \r\n\r\nMy Name is SnowMan. \r\n\r\n\r\n';
+ const canonical = "My Name is SnowMan. This is a test ";
+ const compact: unknown = { student: "My Name is SnowMan. This is a test" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v01.xml", () => {
+ // 2.8 — Tests prolog with XMLDecl and doctypedecl
+ const input = Buffer.from(
+ '\r\n\r\n]>\r\n\r\n',
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v02.xml", () => {
+ // 2.8 — Tests prolog with doctypedecl
+ const input: string = "\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v03.xml", () => {
+ // 2.8 — Tests prolog with Misc doctypedecl
+ const input: string = "\r\n]>\r\n\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v04.xml", () => {
+ // 2.8 — Tests prolog with doctypedecl Misc
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v05.xml", () => {
+ // 2.8 — Tests prolog with XMLDecl Misc doctypedecl
+ const input = Buffer.from(
+ '\r\n\r\n\r\n]>\r\n\r\n',
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v06.xml", () => {
+ // 2.8 — Tests prolog with XMLDecl doctypedecl Misc
+ const input = Buffer.from(
+ '\r\n\r\n]>\r\n\r\n\r\n',
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P22-ibm22v07.xml", () => {
+ // 2.8 — Tests prolog with XMLDecl Misc doctypedecl Misc
+ const input = Buffer.from(
+ '\r\n\r\n\r\n]>\r\n\r\n\r\n',
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P23-ibm23v01.xml", () => {
+ // 2.8 — Tests XMLDecl with VersionInfo only
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P23-ibm23v02.xml", () => {
+ // 2.8 — Tests XMLDecl with VersionInfo EncodingDecl
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n\r\n",
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P23-ibm23v03.xml", () => {
+ // 2.8 — Tests XMLDecl with VersionInfo SDDecl
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P23-ibm23v04.xml", () => {
+ // 2.8 — Tests XMLDecl with VerstionInfo and a trailing whitespace char
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P23-ibm23v05.xml", () => {
+ // 2.8 — Tests XMLDecl with VersionInfo EncodingDecl SDDecl
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n\r\n",
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P23-ibm23v06.xml", () => {
+ // 2.8 — Tests XMLDecl with VersionInfo EncodingDecl SDDecl and a trailing whitespace
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n\r\n",
+ );
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P24-ibm24v01.xml", () => {
+ // 2.8 — Tests VersionInfo with single quote
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P24-ibm24v02.xml", () => {
+ // 2.8 — Tests VersionInfo with double quote
+ const input: string = '\r\n\r\n]>\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P25-ibm25v01.xml", () => {
+ // 2.8 — Tests EQ with =
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P25-ibm25v02.xml", () => {
+ // 2.8 — Tests EQ with = and spaces on both sides
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P25-ibm25v03.xml", () => {
+ // 2.8 — Tests EQ with = and space in front of it
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P25-ibm25v04.xml", () => {
+ // 2.8 — Tests EQ with = and space after it
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P26-ibm26v01.xml", () => {
+ // 2.8 — Tests VersionNum 1.0
+ const input: string = "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P27-ibm27v01.xml", () => {
+ // 2.8 — Tests Misc with comment
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P27-ibm27v02.xml", () => {
+ // 2.8 — Tests Misc with PI
+ const input: string =
+ "\r\n\r\n]>\r\n\r\n";
+ const canonical = "";
+ const compact: unknown = { doc: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P27-ibm27v03.xml", () => {
+ // 2.8 — Tests Misc with white spaces
+ const input: string =
+ "\r\n\r\n]>\r\nS is in the following Misc\r\n";
+ const canonical = "S is in the following Misc";
+ const compact: unknown = { doc: "S is in the following Misc" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P28-ibm28v01.xml", () => {
+ // 2.8 — Tests doctypedecl with internal DTD only
+ const input = Buffer.from(
+ "\r\n\r\n]>\r\n \r\n\r\n",
+ );
+ const canonical = "";
+ const compact: unknown = { animal: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P28-ibm28v02.xml", () => {
+ // 2.8 — Tests doctypedecl with external subset and combinations of different markup declarations and
+ // PEReferences (upstream: valid; external parameter entities are not read)
+ const input = Buffer.from(
+ '\r\n\r\n \r\n \r\n ">\r\n ">\r\n ">\r\n %make_leopard_element; \r\n \r\n %make_small;\r\n ">\r\n %make_big;\r\n %make_attlist;\r\n \r\n \r\n]>\r\n\r\n &forcat;\r\n This is a white tiger in Mirage!!\r\n \r\n \r\n \r\n \r\n \r\n\r\n',
+ );
+ const canonical =
+ '
This is a small cat
This is a white tiger in Mirage!!
';
+ const compact: unknown = {
+ animal: {
+ cat: ["This is a small cat", ""],
+ tiger: { "@color": "white", "#text": "This is a white tiger in Mirage!!" },
+ leopard: { small: "", big: "" },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P29-ibm29v01.xml", () => {
+ // 2.8 — Tests markupdecl with combinations of elementdecl, AttlistDecl,EntityDecl, NotationDecl, PI
+ // and comment
+ const input = Buffer.from(
+ '\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n &forcat;\r\n This is a white tiger in Mirage!!\r\n \r\n \r\n \r\n \r\n \r\n\r\n',
+ );
+ const canonical =
+ '
This is a small cat
This is a white tiger in Mirage!!
';
+ const compact: unknown = {
+ animal: {
+ cat: ["This is a small cat", ""],
+ tiger: { "@color": "white", "#text": "This is a white tiger in Mirage!!" },
+ leopard: { small: "", big: "" },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P29-ibm29v02.xml", () => {
+ // 2.8 — Tests WFC: PE in internal subset as a positive test (upstream: valid; external parameter
+ // entities are not read)
+ const input = Buffer.from(
+ '\r\n\r\n \r\n \r\n \r\n \r\n ">\r\n %make_leopard_element; \r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n &forcat;\r\n This is a white tiger in Mirage!!\r\n \r\n \r\n \r\n \r\n \r\n\r\n',
+ );
+ const canonical =
+ '
This is a small cat
This is a white tiger in Mirage!!
';
+ const compact: unknown = {
+ animal: {
+ cat: ["This is a small cat", ""],
+ tiger: { "@color": "white", "#text": "This is a white tiger in Mirage!!" },
+ leopard: { small: "", big: "" },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P30-ibm30v01.xml", () => {
+ // 2.8 — Tests extSubset with extSubsetDecl only in the dtd file (upstream: valid; external parameter
+ // entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { animal: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P30-ibm30v02.xml", () => {
+ // 2.8 — Tests extSubset with TextDecl and extSubsetDecl in the dtd file (upstream: valid; external
+ // parameter entities are not read)
+ const input: string =
+ '\r\n\r\n\r\n';
+ const canonical = "";
+ const compact: unknown = { animal: "" };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P31-ibm31v01.xml", () => {
+ // 2.8 — Tests extSubsetDecl with combinations of markupdecls, conditionalSects, PEReferences and white
+ // spaces (upstream: valid; external parameter entities are not read)
+ const input: string =
+ '\r\n\r\n \r\n\r\n\r\n';
+ const canonical = "
";
+ const compact: unknown = { animal: { tiger: "" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P32-ibm32v01.xml", () => {
+ // 2.9 — Tests VC: Standalone Document Declaration with absent attribute that has default value and
+ // standalone is no (upstream: valid; external parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-valid-P32-ibm32v02.xml", () => {
+ // 2.9 — Tests VC: Standalone Document Declaration with external entity reference and standalone is no
+ // (upstream: valid; external parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n&animal_content;\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-valid-P32-ibm32v03.xml", () => {
+ // 2.9 — Tests VC: Standalone Document Declaration with attribute values that need to be normalized and
+ // standalone is no (upstream: valid; external parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\n\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-valid-P32-ibm32v04.xml", () => {
+ // 2.9 — Tests VC: Standalone Document Declaration with whitespace in mixed content and standalone is
+ // no (upstream: valid; external parameter entities are not read; output depends on them)
+ const input: string =
+ '\r\n\r\nThis is a \r\n \r\n\r\nyellow tiger\r\n\r\n';
+ expectParses(input);
+ });
+
+ test("ibm-valid-P33-ibm33v01.xml", () => {
+ // 2.12 — Tests LanguageID with Langcode - Subcode
+ const input: string =
+ '\r\n \r\n]>\r\nIt is written in English\r\n';
+ const canonical = 'It is written in English';
+ const compact: unknown = { book: { "@xml:lang": "en-US", "#text": "It is written in English" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P34-ibm34v01.xml", () => {
+ // 2.12 — Duplicate Test as ibm33v01.xml
+ const input: string =
+ '\r\n \r\n]>\r\nIt is written in English\r\n';
+ const canonical = 'It is written in English';
+ const compact: unknown = { book: { "@xml:lang": "en-US", "#text": "It is written in English" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P35-ibm35v01.xml", () => {
+ // 2.12 — Tests ISO639Code
+ const input: string =
+ '\r\n \r\n]>\r\nIt is written in English\r\n';
+ const canonical = 'It is written in English';
+ const compact: unknown = { book: { "@xml:lang": "en", "#text": "It is written in English" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P36-ibm36v01.xml", () => {
+ // 2.12 — Tests IanaCode
+ const input: string =
+ '\r\n \r\n]>\r\nIt is written in English\r\n';
+ const canonical = 'It is written in English';
+ const compact: unknown = { book: { "@xml:lang": "i-BS-ABCD", "#text": "It is written in English" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P37-ibm37v01.xml", () => {
+ // 2.12 — Tests UserCode
+ const input: string =
+ '\r\n \r\n]>\r\nIt is written in English\r\n';
+ const canonical = 'It is written in English';
+ const compact: unknown = { book: { "@xml:lang": "x-uk-eng", "#text": "It is written in English" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P38-ibm38v01.xml", () => {
+ // 2.12 — Tests SubCode
+ const input: string =
+ '\r\n \r\n]>\r\nIt is written in English\r\n';
+ const canonical = 'It is written in English';
+ const compact: unknown = { book: { "@xml:lang": "en-USa", "#text": "It is written in English" } };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P39-ibm39v01.xml", () => {
+ // 3 — Tests element with EmptyElemTag and STag content Etag, also tests the VC: Element Valid with
+ // elements that have children, Mixed and ANY contents
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n]>\r\n\r\n \r\n content of b element\r\n \r\n no more children\r\n \r\n\r\n\r\n';
+ const canonical =
+ "
content of b element
no more children
";
+ const compact: unknown = {
+ root: {
+ a: "",
+ b: {
+ c: ["", { d: { e: ["no more children", { f: "" }], f: "" } }],
+ "#text": "content of b element",
+ },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P40-ibm40v01.xml", () => {
+ // 3.1 — Tests STag with possible combinations of its fields, also tests WFC: Unique Att Spec.
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n without white space\r\n with a white space\r\n one attribute\r\n one attribute\r\n\r\n\r\n';
+ const canonical =
+ '
without white space
with a white space
one attribute
one attribute
';
+ const compact: unknown = {
+ root: {
+ b: [
+ "without white space",
+ "with a white space",
+ { "@attr1": "value1", "#text": "one attribute" },
+ {
+ "@attr1": "value1",
+ "@attr2": "value2",
+ "@attr3": "value3",
+ "#text": "one attribute",
+ },
+ ],
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P41-ibm41v01.xml", () => {
+ // 3.1 — Tests Attribute with Name Eq AttValue and VC: Attribute Value Type
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n \r\n]>\r\n\r\n Name eq AttValue\r\n\r\n\r\n';
+ const canonical = '
Name eq AttValue
';
+ const compact: unknown = {
+ root: {
+ b: {
+ "@attr1": "value1",
+ "@attr2": "def",
+ "@attr3": "fixed",
+ "#text": "Name eq AttValue",
+ },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P42-ibm42v01.xml", () => {
+ // 3.1 — Tests ETag with possible combinations of its fields
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n]>\r\n\r\n : End tag with a space inside\r\n content of b element\r\n\r\n\r\n\r\n';
+ const canonical =
+ "
: End tag with a space inside
content of b element
";
+ const compact: unknown = {
+ root: {
+ a: "",
+ b: { c: "", "#text": ": End tag with a space inside\n content of b element" },
+ },
+ };
+ expectParses(input, canonical, compact);
+ });
+
+ test("ibm-valid-P43-ibm43v01.xml", () => {
+ // 3.1 — Tests content with all possible constructs: element, CharData, Reference, CDSect, Comment
+ const input: string =
+ '\r\n\r\n \r\n \r\n \r\n General entity reference in element content">\r\n]>\r\n\r\n\r\n\r\n \r\n CharData: content of b element\r\n %paaa; : PE reference should not be recognized in element content \r\n \r\n\r\n\r\n &inContent;\r\n Charater reference: A\r\n CDSect in content: markupsHEADnothing