Repository navigation
FAQ
The Deserialize(string fileUri) overload picks the format from the file extension, and the check is case-sensitive: Export.REQIF is rejected. Rename the file, or open it as a stream and pass the format:
using var stream = File.OpenRead("Export.REQIF");
var reqifs = new ReqIFDeserializer().Deserialize(stream, SupportedFileExtensionKind.Reqif);You passed a validation handler but left validation off. Pass validate: true as well, or remove the handler.
You turned on validation without a handler, and the document doesn't follow the ReqIF schema. Pass a handler to collect all problems and still get the document, or turn validation off. Many tools export files that are not strictly valid; ReqIFSharp reads most of them without validation. See Reading ReqIF.
The .reqifz or .zip contains no file that ends with .reqif. Open the archive with a zip tool to check what it contains.
The deserializer and the ReqIFLoaderService rewind the stream to its start, which needs a seekable stream. Copy the stream into a MemoryStream first, see Reading ReqIF.
Rich text attributes hold XHTML. Use ExtractUnformattedTextFromValue() on the AttributeValueXHTML for plain text, or render TheValue as HTML. QueryFormattedValue() from ReqIFSharp.Extensions returns the markup unchanged.
Some content is skipped and I see warnings like The ... element at line:position ... is not supported
ReqIFSharp logs a warning for XML it does not recognize at that position, and continues. Pass an ILoggerFactory to the deserializer to see these warnings, see Reading ReqIF. If the element is valid ReqIF, please open an issue and attach a small sample file.
In the XHTML attribute values, as ExternalObjects. In a .reqifz archive the image files sit next to the ReqIF document. See Reading ReqIF or the loader service.
ReqIF has no fixed attribute names: every tool defines its own spec types and attributes. Look at reqif.CoreContent.SpecTypes in a sample export, or open it in the ReqIF Viewer, to see which names your tool uses. Many tools follow the ReqIF Implementation Guide and use ReqIF.ForeignID, ReqIF.Text and ReqIF.ChapterName.
Read your file back with validation turned on; the problems it lists are usually the cause:
new ReqIFDeserializer().Deserialize("output.reqif", true, (sender, e) => Console.WriteLine(e.Message));The usual causes are an identifier that starts with a digit (such as a bare GUID), a missing LastChange, an enumeration literal without Properties, or a datatype or type that is used but not added to CoreContent. See the tips in Writing ReqIF.
An extension method from ReqIFSharp.Extensions needs to find related elements through the ReqIFContent property. Set it on the elements you built yourself, for example specObjectType.ReqIFContent = content;.
Yes, to a .reqifz or .zip archive: pass all ReqIF objects to Serialize. A .reqif file holds exactly one document.
Both packages target netstandard2.0: .NET Framework 4.6.2 and later, and .NET Core 2.0 and later, including .NET 6, 8 and 10. Building ReqIFSharp itself from source needs the .NET 10 SDK.
It doesn't force an old version. 6.0.0 is the minimum; NuGet uses the version your application references when that is newer. The low minimum keeps ReqIFSharp usable from older applications. See Dependencies in the README.
Each release of ReqIFSharp.Extensions depends on the ReqIFSharp release it was built with. The CHANGELOG lists both versions for every release. Installing ReqIFSharp.Extensions also installs a matching ReqIFSharp.
ReqIF 1.0.1, 1.1 and 1.2. They share the same XML schema and namespace, http://www.omg.org/spec/ReqIF/20110401/reqif.xsd.
The repository contains a CITATION.cff. GitHub shows a "Cite this repository" button based on it.
copyright @ Starion Group S.A.