Table of Contents

Class PortrayalCatalogueReader

Namespace
EncDotNet.S100.Portrayals
Assembly
EncDotNet.S100.Portrayals.dll

Parses S-100 Part 9 Portrayal Catalogue XML (portrayal_catalogue.xml) into a PortrayalCatalogue. Elements are matched both unqualified and in the http://www.iho.int/S100PortrayalCatalog/5.2 namespace. Only the catalogue document is read; referenced asset and rule files are not opened.

public static class PortrayalCatalogueReader
Inheritance
PortrayalCatalogueReader
Inherited Members

Methods

Read(Stream)

Reads a portrayal catalogue from an XML stream.

public static PortrayalCatalogue Read(Stream stream)

Parameters

stream Stream

Stream positioned at the start of the catalogue XML. It is not disposed.

Returns

PortrayalCatalogue

The parsed catalogue.

Remarks

The document is not validated against the Part 9 schema. Elements and attributes 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 root productId and version, a catalogue item's id and a description's name are lenient and read as empty strings when absent; viewingGroup entries without an id are treated as references and skipped.

Exceptions

XmlException

The XML is malformed or has no root element, or a required element or attribute is missing: the fileName, fileType or fileFormat of a catalogue item or rule file, a rule file's ruleType, a context parameter's type or default, or the id of a rule file, context parameter, viewing group layer, display mode or display plane. The message names the missing element or attribute.

Read(string)

Reads a portrayal catalogue from an XML file or URI.

public static PortrayalCatalogue Read(string path)

Parameters

path string

Path or URI of the catalogue XML file.

Returns

PortrayalCatalogue

The parsed catalogue.

Remarks

See Read(Stream) for which elements are required and which are read leniently.

Exceptions

XmlException

The XML is malformed or has no root element, or a required element or attribute is missing: the fileName, fileType or fileFormat of a catalogue item or rule file, a rule file's ruleType, a context parameter's type or default, or the id of a rule file, context parameter, viewing group layer, display mode or display plane. The message names the missing element or attribute.

IOException

The file cannot be read (e.g. it does not exist).