Skip to content

Serialize and deserialize ArchiMate Model Exchange File Format

License

Notifications You must be signed in to change notification settings

adrichem/AmeffSerializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AmeffSerializer

Serialize and deserialize ArchiMate Model Exchange File Format files (AMEFF).

Deserialization example

using Adrichem.Serialization.Ameff.V31;
using Adrichem.Serialization.Ameff.V31.Diagram;
using System.Net;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

void Deserialize()
{
	XmlSchemaSet Schemas = new XmlSchemaSet();
	Schemas.Add(null, "http://www.opengroup.org/xsd/archimate/3.0/archimate3_Diagram.xsd");
	Schemas.Add("http://purl.org/dc/elements/1.1/", "http://dublincore.org/schemas/xmls/qdc/2008/02/11/dc.xsd");

	var MyXmlReaderSettings = new XmlReaderSettings
	{
		Schemas = Schemas,
		ValidationType = ValidationType.Schema,
		ValidationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints |
						  XmlSchemaValidationFlags.ReportValidationWarnings
	};
	var AmeffStream = WebRequest.Create("http://www.opengroup.org/xsd/archimate/3.1/examples/Model_View.xml").GetResponse().GetResponseStream();
	
	using (var Reader = new StreamReader(AmeffStream))
	{
		using (var XmlRdr = XmlReader.Create(Reader, MyXmlReaderSettings))
		{
			ModelType MyAmeff;
			MyAmeff = new XmlSerializer(typeof(ModelType))
				.Deserialize(XmlRdr)
				as ModelType;

			MyAmeff
				.Views
				.Diagrams
				.Select(d => d.Name.FirstOrDefault())
				.Dump()
			;
		}
	}
}

About

Serialize and deserialize ArchiMate Model Exchange File Format

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages