Repository navigation
[Fix] read THE-ORIGINAL-VALUE of XHTML attribute values; fixes #95 - #99
Merged
Merged
Conversation
AttributeValueXHTML.ReadXml and ReadXmlAsync never read THE-ORIGINAL-VALUE, so TheOriginalValue was always null after reading, and a document that was read and written again lost the original values of its simplified XHTML attribute values. - Read only the direct children (DEFINITION, THE-VALUE, THE-ORIGINAL-VALUE) in any order. ReadInnerXml and Skip already move to the next node, so the loop does not call Read after them and no sibling is skipped in minified documents (see #94). Other children are skipped. - Read the definition reference through a subtree of DEFINITION; an unknown reference still throws. - Add AttributeValueXHTMLReadTestFixture: original values read from the test data, kept on read-write-read, and four child orders (also with an unknown child) read correctly, indented and minified, reqif and reqifz, sync and async. Add a cancellation test for ReadXmlAsync. - Move the minify helper into TestDocuments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Prerequisites
Description
Fixes #95.
AttributeValueXHTML.ReadXmlandReadXmlAsyncnever readTHE-ORIGINAL-VALUE, althoughWriteXmlwrites it.TheOriginalValuewas alwaysnullafter reading, so a document that was read and written again lost the original values of its simplified XHTML attribute values. ReqIF 1.2 (10.8.20 and Clause 8) needs that value so that a later tool in the exchange chain can restore the original.Changes (
AttributeValueXHTML.cs)ATTRIBUTE-VALUE-XHTML:DEFINITION,THE-VALUEandTHE-ORIGINAL-VALUE, in any order, as the schema'sxsd:allallows.THE-ORIGINAL-VALUEis read likeTHE-VALUE(inner XML, trimmed).ReadInnerXmlandSkipalready move the reader to the next node, so the loop does not callRead()after them. AddingTHE-ORIGINAL-VALUEto the old loop would have lost it in minified documents when it followsTHE-VALUE(the problem fixed in [Bug]: Elements are skipped when a ReqIF document has no whitespace between elements #94).ATTRIBUTE-DEFINITION-XHTML-REFis read through a subtree ofDEFINITION, where the schema puts it. An unknown reference still throwsInvalidOperationException.Tests
AttributeValueXHTMLReadTestFixture:reqifsharpgenerated.reqifare read, and each is marked as simplified;TheOriginalValueandIsSimplified;THE-VALUEand aDEFINITIONthat must not be read), each read correctly, indented and minified,.reqifand.reqifz, sync and async.THE-VALUEandTHE-ORIGINAL-VALUEget distinct content, so a mix-up is caught;AttributeValueXHTMLTestFixture:ReadXmlAsyncthrowsOperationCanceledExceptionfor a cancelled token.MinifiedDocumentTestFixtureintoTestDocuments, and keeps whitespace insideTHE-ORIGINAL-VALUE. The existing graph comparisons now include the original values.THE-ORIGINAL-VALUEadded fails the minified orders.dotnet build -c Release: 0 warnings;dotnet test: 448 passed.Found during this work and tracked separately:
AttributeValueXHTMLleaveExternalObjectsor the logger null.🤖 Generated with Claude Code