Use specialized URI type for package spec that is more relaxed than System.Uri
Is your feature request related to a problem? Please describe. The current Uri usage in the System.IO.Packaging is very strict to the official RFC, but appears to be too strict for what Office documents can have
Describe the solution you'd like
We should have a generalized type (i.e. OpenXmlUri) that will easily convert to System.Uri or string representations.
Describe alternatives you've considered There are a few attempts at handling this, most recently, this:
https://github.com/dotnet/Open-XML-SDK/blob/307fa23e7f92222230216bb73a756022b8104046/src/DocumentFormat.OpenXml.Framework/Packaging/PackageUriHandlingExtensions.cs#L228-L241
It may be useful to start with.
TODO:
- [x] Find where in the spec the Uri type is defined for the packaging spec
The URI is stored under the Relationship element's Target attribute, is defined in ISO/IEC 29500-2:2012(E) 9.3.2.2 Relationship Element as a xsd:anyURI
xsd:anyURI is defined in W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes as
The value space of anyURI is the set of finite-length sequences of zero or more characters (as defined in [XML]) that ·match· the Char production from [XML].
So, while:
anyURI represents an Internationalized Resource Identifier Reference (IRI). An anyURI value can be absolute or relative, and may have an optional fragment identifier (i.e., it may be an IRI Reference).
It is not restricted to valid URIs