+{"Data":{"Sdk":{"Events":[{"Id":"12619586563","Type":"IssuesEvent","CreatedAt":"2026-08-01T03:04:57","Actor":"jafin","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"opened","RelatedUrl":"https://github.com/dotnet/Open-XML-SDK/issues/2128","RelatedDescription":"Opened issue \"OpenXmlValidator rejects a valid CT_Filters holding both filter and dateGroupItem\" (#2128) at dotnet/Open-XML-SDK","RelatedBody":"**Describe the bug**\n\n`OpenXmlValidator` reports `Sch_UnexpectedElementContentExpectingComplex` for a `x:filters` element containing both `filter` and `dateGroupItem` children. That content is valid: ECMA-376 defines `CT_Filters` as an `xsd:sequence` of `filter [0..*]` followed by `dateGroupItem [0..*]`, not a choice.\n\nIt matters because this is the shape Excel writes for a mixed tick-box selection on a date column — a fully ticked month or year becomes a `dateGroupItem`, individually ticked dates become `filter` entries. Validating a genuine Excel-produced workbook therefore reports an error that is not there.\n\n**To Reproduce**\n\nSelf-contained console app, no document or external resources needed — the element validates on its own.\n\n```csharp\nusing DocumentFormat.OpenXml;\nusing DocumentFormat.OpenXml.Spreadsheet;\nusing DocumentFormat.OpenXml.Validation;\n\nvar filters = new Filters();\nfilters.Append(new Filter { Val = \"Cookies\" });\nfilters.Append(new DateGroupItem { DateTimeGrouping = DateTimeGroupingValues.Year, Year = 2024 });\n\nConsole.WriteLine(filters.OuterXml);\n\nforeach (var error in new OpenXmlValidator(FileFormatVersions.Office2007).Validate(filters))\n Console.WriteLine($\"{error.Id}: {error.Description}\");\n```\n\nOutput:\n\n```xml\n<x:filters xmlns:x=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">\n<x:filter val=\"Cookies\" /><x:dateGroupItem year=\"2024\" dateTimeGrouping=\"year\" /></x:filters>\nSch_UnexpectedElementContentExpectingComplex: The element has unexpected child element 'http://schemas.openxmlformats.org/spreadsheetml/2006/main:dateGroupItem'.\n```\n\n**Observed behavior**\n\nAny mixture of the two child kinds is rejected; either kind alone, repeated, is accepted. Reproduced on all seven `FileFormatVersions` values (`Office2007` through `Microsoft365`).\n\n| `filters` content | Validator | ECMA-376 |\n|---|---|---|\n| `filter` ×1 | valid | valid |\n| `filter` ×2 | valid | valid |\n| `dateGroupItem` ×1 | valid | valid |\n| `dateGroupItem` ×2 | valid | valid |\n| **`filter` then `dateGroupItem`** | **rejected** | **valid** |\n| `dateGroupItem` then `filter` | rejected | invalid (out of sequence order) |\n\nOnly the fifth row is a false positive. The last row is correctly rejected, though as a choice violation rather than an ordering one.\n\n**Expected behavior**\n\n`filter*` followed by `dateGroupItem*` validates.\n\n**Root cause**\n\n`data/schemas/schemas_openxmlformats_org_spreadsheetml_2006_main.json` on `main` models the particle as a `Choice`:\n\n```json\n{\n \"Name\": \"x:CT_Filters/x:filters\",\n \"ClassName\": \"Filters\",\n \"Particle\": {\n \"Kind\": \"Choice\",\n \"Items\": [\n { \"Name\": \"x14:CT_Filter/x14:filter\", \"Occurs\": [{}], \"InitialVersion\": \"Office2010\" },\n { \"Name\": \"x:CT_Filter/x:filter\", \"Occurs\": [{}] },\n { \"Name\": \"x:CT_DateGroupItem/x:dateGroupItem\", \"Occurs\": [{}] }\n ]\n }\n}\n```\n\nFor contrast, `CT_FilterColumn` in the same file is correctly a bounded `Choice` (`\"Occurs\": [{ \"Max\": 1 }]` on the group), which matches its XSD — so the format does distinguish the two cases and this entry looks like a straightforward data error rather than a modelling limitation.\n\nI have not proposed a patch because the SDK's model also carries `x14:CT_Filter/x14:filter` as a member, which has no counterpart in the ECMA sequence. How that extension composes with a corrected `Sequence` seemed better left to maintainers than guessed at.\n\n**Schema references**\n\n- [`CT_Filters`](http://www.datypic.com/sc/ooxml/t-ssml_CT_Filters.html) — `Sequence [1..1]` of `filter [0..*]`, `dateGroupItem [0..*]`, with a sample instance showing both\n- The [`Filters` class reference](https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.filters), quoting ISO/IEC 29500-1, lists both `dateGroupItem` and `filter` as child elements with no choice constraint\n\n**Desktop**\n\n- OS: Windows 11 Pro 10.0.22631\n- .NET Target: .NET 8.0 (also reproduces on .NET 11 preview)\n- DocumentFormat.OpenXml Version: 3.5.1 (current latest on NuGet); particle data unchanged on `main`\n\n**Additional context**\n\nFound while adding schema-validation coverage to [XLibur](https://github.com/XLibur/XLibur). I had used `OpenXmlValidator` as the authority on the schema and filed an issue against our own writer on the strength of it; the report was wrong and the validator was the thing at fault. ClosedXML has carried a test comment noting this same false positive, with validation disabled for that one case, for several years.\n\nI searched open and closed issues for `dateGroupItem`, `CT_Filters`, `Sch_UnexpectedElementContentExpectingComplex` and `autofilter` and did not find a duplicate; #1218 is a different false positive in presentations."},{"Id":"12425092452","Type":"IssuesEvent","CreatedAt":"2026-07-28T16:11:26","Actor":"mikeebowen","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"closed","RelatedUrl":"https://github.com/dotnet/Open-XML-SDK/issues/2120","RelatedDescription":"Closed issue \"New project: OOXML Behavioral Intelligence — behavioral spec research\" (#2120) at dotnet/Open-XML-SDK","RelatedBody":"Hi Open XML SDK team,\n\nI am launching an open research initiative to document real-world OOXML behavior — the gap between the ECMA/ISO specification and what Office actually does. The project covers differential testing, compatibility case databases, and future AI-assisted discovery.\n\nAs the technical authority on OOXML, your guidance would be invaluable — even just pointing us at known edge cases or undocumented behaviors worth documenting.\n\nRepo: https://github.com/nessim-liamani/ooxml-behavioral-intelligence\n\nOpen to feedback or a brief discussion."},{"Id":"12216072422","Type":"PullRequestEvent","CreatedAt":"2026-07-23T20:02:55","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null},{"Id":"12216071798","Type":"PullRequestEvent","CreatedAt":"2026-07-23T20:02:54","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null},{"Id":"12216071695","Type":"PullRequestEvent","CreatedAt":"2026-07-23T20:02:54","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null},{"Id":"12216071486","Type":"PullRequestEvent","CreatedAt":"2026-07-23T20:02:54","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"opened","RelatedUrl":null,"RelatedDescription":"Opened pull request \"\" (#2127) at dotnet/Open-XML-SDK","RelatedBody":null},{"Id":"12099794200","Type":"PullRequestEvent","CreatedAt":"2026-07-21T19:38:38","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null},{"Id":"12099793209","Type":"PullRequestEvent","CreatedAt":"2026-07-21T19:38:37","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null},{"Id":"12099793086","Type":"PullRequestEvent","CreatedAt":"2026-07-21T19:38:37","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null},{"Id":"12099792863","Type":"PullRequestEvent","CreatedAt":"2026-07-21T19:38:37","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"opened","RelatedUrl":null,"RelatedDescription":"Opened pull request \"\" (#2126) at dotnet/Open-XML-SDK","RelatedBody":null},{"Id":"12099107588","Type":"PullRequestEvent","CreatedAt":"2026-07-21T19:23:08","Actor":"dependabot[bot]","Repository":"dotnet/Open-XML-SDK","Organization":"dotnet","RawContent":null,"RelatedAction":"labeled","RelatedUrl":null,"RelatedDescription":null,"RelatedBody":null}],"ResultType":"GitHubEvent"}},"RunOn":"2026-08-01T03:30:26.5762344Z","RunDurationInMilliseconds":906}
0 commit comments