public static Manifest ReadFrom(Stream stream, IPropertyProvider propertyProvider, bool validateSchema) { XDocument document = XmlUtility.LoadSafe(stream, ignoreWhiteSpace: true); string schemaNamespace = GetSchemaNamespace(document); foreach (var e in document.Descendants()) { // Assign the schema namespace derived to all nodes in the document. e.Name = XName.Get(e.Name.LocalName, schemaNamespace); } // Validate if the schema is a known one CheckSchemaVersion(document); if (validateSchema) { // Validate the schema ValidateManifestSchema(document, schemaNamespace); } // Deserialize it var manifest = ManifestReader.ReadManifest(document); return(manifest); }
public static Manifest ReadFrom(Stream stream, IPropertyProvider propertyProvider) { XDocument document; if (propertyProvider == NullPropertyProvider.Instance) { document = XDocument.Load(stream); } else { string content = Preprocessor.Process(stream, propertyProvider); document = XDocument.Parse(content); } string schemaNamespace = GetSchemaNamespace(document); foreach (var e in document.Descendants()) { // Assign the schema namespace derived to all nodes in the document. e.Name = XName.Get(e.Name.LocalName, schemaNamespace); } // Validate the schema ValidateManifestSchema(document, schemaNamespace); // Serialize it var manifest = ManifestReader.ReadManifest(document); // Validate before returning Validate(manifest); return(manifest); }
public static Manifest ReadFrom(Stream stream) { XDocument document = XDocument.Load(stream); var schemaNamespace = GetSchemaNamespace(document); return(ManifestReader.ReadManifest(document)); }
public static Manifest ReadFrom(Stream stream, IPropertyProvider propertyProvider, bool validateSchema) { XDocument document = !ReferenceEquals(propertyProvider, NullPropertyProvider.Instance) ? XDocument.Parse(Preprocessor.Process(stream, propertyProvider, true)) : XmlUtility.LoadSafe(stream, true); string schemaNamespace = GetSchemaNamespace(document); foreach (XElement local1 in document.Descendants()) { local1.Name = XName.Get(local1.Name.LocalName, schemaNamespace); } CheckSchemaVersion(document); if (validateSchema) { ValidateManifestSchema(document, schemaNamespace); } Manifest manifest = ManifestReader.ReadManifest(document); Validate(manifest); return(manifest); }
public static Manifest ReadFrom(Stream stream, IPropertyProvider propertyProvider, bool validateSchema) { XDocument document; if (propertyProvider == NullPropertyProvider.Instance) { document = XmlUtility.LoadSafe(stream, ignoreWhiteSpace: true); } else { string content = Preprocessor.Process(stream, propertyProvider); document = XDocument.Parse(content); } string schemaNamespace = GetSchemaNamespace(document); foreach (var e in document.Descendants()) { // Assign the schema namespace derived to all nodes in the document. e.Name = XName.Get(e.Name.LocalName, schemaNamespace); } // Validate if the schema is a known one CheckSchemaVersion(document); if (validateSchema) { // Validate the schema ValidateManifestSchema(document, schemaNamespace); } // Deserialize it var manifest = ManifestReader.ReadManifest(document); // Validate before returning Validate(manifest); return(manifest); }
public static Manifest ReadFrom(Stream stream) { // Read the document XDocument document = XDocument.Load(stream); string schemeNamespace = GetSchemaNamespace(document); foreach (XElement e in document.Descendants()) { // Assign the schema namespace derived to all nodes in the document. e.Name = XName.Get(e.Name.LocalName, schemeNamespace); } // Validate the schema ValidateManifestSchema(document, schemeNamespace); // Serialize it var manifest = ManifestReader.ReadManifest(document); // Validate before returning Validate(manifest); return(manifest); }