Class ExchangeCatalogueReader
- Namespace
- EncDotNet.S100.ExchangeSets
- Assembly
- EncDotNet.S100.ExchangeSets.dll
Parses an S-100 Part 17 exchange catalogue (CATALOG.XML) into an
ExchangeCatalogue.
public static class ExchangeCatalogueReader
- Inheritance
-
ExchangeCatalogueReader
- Inherited Members
Remarks
The catalogue namespace is taken from the root element, so product-specific
namespaces and discovery elements (e.g. S102_DatasetDiscoveryMetadata)
are accepted alongside the generic S100_* ones, as is the legacy
S100EC layout without wrapper elements. Most optional elements that are
absent or unparseable yield null or default values rather
than errors; Part 15 digital-signature elements are validated strictly.
OpenAsync(IAssetSource, string, CancellationToken) uses this reader to open an exchange set.
Methods
Read(Stream)
Reads an exchange catalogue from a stream.
public static ExchangeCatalogue Read(Stream stream)
Parameters
streamStreamA readable stream positioned at the start of the
CATALOG.XMLcontent. It is not disposed.
Returns
- ExchangeCatalogue
The parsed catalogue.
Remarks
The document is not validated against the Part 17 schema. Elements that
the returned model declares non-nullable are checked for presence, so a
catalogue that lacks one fails with an XmlException rather
than yielding null in a non-nullable property. The
identifier's dateTime is lenient because the legacy S100EC
layout omits it: the legacy date is used instead, or an empty
string when neither is present. Optional elements that are absent or
unparseable yield null or default values.
Exceptions
- XmlException
The XML is malformed or has no root element; a required element is missing (the catalogue
identifieror itsidentifierchild, unless AllowMissingIdentifier is set; thefileNameof a dataset discovery-metadata record; or that of a support-file or catalogue record, unless SkipIncompleteSupportRecords is set); or, when security is read, adigitalSignatureValueis invalid (not exactly one child, an unrecognized security namespace or signature element, a missing required or disallowed attribute, an unsupporteddataStatus, or an empty or non-base64 value). The message names the missing element.- FormatException
A certificate in the
certificatesblock is not valid base64 (only when security is read).
Read(Stream, ExchangeCatalogueReadOptions)
Reads an exchange catalogue from a stream with the given options (for example DiscoveryOnly).
public static ExchangeCatalogue Read(Stream stream, ExchangeCatalogueReadOptions options)
Parameters
streamStreamA readable stream positioned at the start of the
CATALOG.XMLcontent. It is not disposed.optionsExchangeCatalogueReadOptionsWhat to read, and how strictly.
Returns
- ExchangeCatalogue
The parsed catalogue.
Remarks
The document is not validated against the Part 17 schema. Elements that
the returned model declares non-nullable are checked for presence, so a
catalogue that lacks one fails with an XmlException rather
than yielding null in a non-nullable property. The
identifier's dateTime is lenient because the legacy S100EC
layout omits it: the legacy date is used instead, or an empty
string when neither is present. Optional elements that are absent or
unparseable yield null or default values.
Exceptions
- XmlException
The XML is malformed or has no root element; a required element is missing (the catalogue
identifieror itsidentifierchild, unless AllowMissingIdentifier is set; thefileNameof a dataset discovery-metadata record; or that of a support-file or catalogue record, unless SkipIncompleteSupportRecords is set); or, when security is read, adigitalSignatureValueis invalid (not exactly one child, an unrecognized security namespace or signature element, a missing required or disallowed attribute, an unsupporteddataStatus, or an empty or non-base64 value). The message names the missing element.- FormatException
A certificate in the
certificatesblock is not valid base64 (only when security is read).
Read(string)
Reads an exchange catalogue from a file path or URI.
public static ExchangeCatalogue Read(string path)
Parameters
pathstringThe path (or URI) of the
CATALOG.XMLfile, as accepted by Load(string).
Returns
- ExchangeCatalogue
The parsed catalogue.
Remarks
The document is not validated against the Part 17 schema. Elements that
the returned model declares non-nullable are checked for presence, so a
catalogue that lacks one fails with an XmlException rather
than yielding null in a non-nullable property. The
identifier's dateTime is lenient because the legacy S100EC
layout omits it: the legacy date is used instead, or an empty
string when neither is present. Optional elements that are absent or
unparseable yield null or default values.
Exceptions
- XmlException
The XML is malformed or has no root element; a required element is missing (the catalogue
identifieror itsidentifierchild, unless AllowMissingIdentifier is set; thefileNameof a dataset discovery-metadata record; or that of a support-file or catalogue record, unless SkipIncompleteSupportRecords is set); or, when security is read, adigitalSignatureValueis invalid (not exactly one child, an unrecognized security namespace or signature element, a missing required or disallowed attribute, an unsupporteddataStatus, or an empty or non-base64 value). The message names the missing element.- FormatException
A certificate in the
certificatesblock is not valid base64 (only when security is read).- IOException
The file cannot be opened or read.
Read(string, ExchangeCatalogueReadOptions)
Reads an exchange catalogue from a file path or URI with the given options (for example DiscoveryOnly).
public static ExchangeCatalogue Read(string path, ExchangeCatalogueReadOptions options)
Parameters
pathstringThe path (or URI) of the
CATALOG.XMLfile, as accepted by Load(string).optionsExchangeCatalogueReadOptionsWhat to read, and how strictly.
Returns
- ExchangeCatalogue
The parsed catalogue.
Remarks
The document is not validated against the Part 17 schema. Elements that
the returned model declares non-nullable are checked for presence, so a
catalogue that lacks one fails with an XmlException rather
than yielding null in a non-nullable property. The
identifier's dateTime is lenient because the legacy S100EC
layout omits it: the legacy date is used instead, or an empty
string when neither is present. Optional elements that are absent or
unparseable yield null or default values.
Exceptions
- XmlException
The XML is malformed or has no root element; a required element is missing (the catalogue
identifieror itsidentifierchild, unless AllowMissingIdentifier is set; thefileNameof a dataset discovery-metadata record; or that of a support-file or catalogue record, unless SkipIncompleteSupportRecords is set); or, when security is read, adigitalSignatureValueis invalid (not exactly one child, an unrecognized security namespace or signature element, a missing required or disallowed attribute, an unsupporteddataStatus, or an empty or non-base64 value). The message names the missing element.- FormatException
A certificate in the
certificatesblock is not valid base64 (only when security is read).- IOException
The file cannot be opened or read.