Repository navigation
[Fix] read ReqIF documents whose elements use a namespace prefix (#87) - #93
Merged
Merged
Conversation
#87 Elements were matched on their qualified name, so a document that binds the ReqIF namespace to a prefix (reqif:REQ-IF) was read as zero documents, and nested lookups (type references, spec-object references, relation-group source/target and spec relations) failed the same way. - Match the REQ-IF root on local name and namespace in all four sync/async .reqif/.reqifz paths. A root in no namespace is still read; a REQ-IF root in any other namespace is skipped and a warning is logged. - Switch RelationGroup to LocalName and pass the current element's namespace to every ReadToDescendant call. - Add PrefixedNamespaceTestFixture: prefixed and namespace-free copies of test documents read to the same object graph as the originals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
4 of 5 tasks
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 #87.
Elements were matched on their qualified name (
XmlReader.Name, which includes the prefix). A document that binds the ReqIF namespace to a prefix (<reqif:REQ-IF xmlns:reqif="...">) was therefore read as zero documents, with no error, although it is valid against the schema. The same problem affected nested lookups.Changes
ReqIFDeserializer, all four sync/async and.reqif/.reqifzpaths): matched on local name and namespace.REQ-IFroot in any other namespace is skipped and a warning is logged. Before, such a root was read when it had no prefix. The schema (targetNamespace=http://www.omg.org/spec/ReqIF/20110401/reqif.xsd,elementFormDefault="qualified") does not allow it, and ReqIF 1.2 clause 3 names the schema as the authoritative description of the document structure. Listed under Changed in the CHANGELOG.RelationGroupnow switches onLocalName(source/target specification, spec relations).ReadToDescendant("X")now passes the current element's namespace. This covers the type references,SPEC-OBJECT-REFin hierarchies and relations, and the attribute-definition references of the Boolean, Date, Integer, Real and String values.Tests
New
PrefixedNamespaceTestFixture, 14 tests:reqif:-prefixed copy of four test documents reads into the same object graph as the original, sync and async,.reqifand.reqifz. The graphs are compared by re-serializing both and comparing the XML, ignoring namespace declarations.reqifsharpgenerated.reqifreads into the same graph as the original.<other:REQ-IF>and<REQ-IF xmlns="…other">) gives zero documents and one warning, sync and async.dotnet build -c Release: 0 warnings.dotnet test: 403 passed.🤖 Generated with Claude Code