private static XmlDocument CreateMessage(DocumentSpec documentSpec) { using (var writer = new StringWriter()) { var document = new XmlDocument(); document.Load(documentSpec.CreateXmlInstance(writer)); return(document); } }
/// <summary> /// Creates a document specification from a CLR /// Type representing the root node of a BizTalk /// compiled Schema /// </summary> /// <param name="schemaType">The schema to create</param> /// <returns>The document specification object</returns> public IDocumentSpec LoadDocSpec(Type schemaType) { if ( schemaType == null ) throw new ArgumentNullException("schemaType"); if ( !schemaType.IsSubclassOf(typeof(SchemaBase)) ) throw new ArgumentException("Type does not represent a schema", "schemaType"); string typename = schemaType.FullName; string assemblyName = schemaType.Assembly.FullName; DocumentSpec docSpec = new DocumentSpec(typename, assemblyName); return docSpec; }
private static XmlDocument Create(DocumentSpec documentSpec) { using (var writer = new StringWriter()) using (var reader = XmlReader.Create(documentSpec.CreateXmlInstance(writer), new XmlReaderSettings { CloseInput = true, XmlResolver = null })) { var document = new XmlDocument { XmlResolver = null }; document.Load(reader); return(document); } }
/// <summary> /// Creates a document specification from a CLR /// Type representing the root node of a BizTalk /// compiled Schema /// </summary> /// <param name="schemaType">The schema to create</param> /// <returns>The document specification object</returns> public IDocumentSpec LoadDocSpec(Type schemaType) { if (schemaType == null) { throw new ArgumentNullException("schemaType"); } if (!schemaType.IsSubclassOf(typeof(SchemaBase))) { throw new ArgumentException("Type does not represent a schema", "schemaType"); } string typename = schemaType.FullName; string assemblyName = schemaType.Assembly.FullName; DocumentSpec docSpec = new DocumentSpec(typename, assemblyName); return(docSpec); }
/// <summary> /// Initializes an instance of SchemaMap class. /// </summary> /// <param name="schemaList">A list of schemas</param> public SchemaMap(SchemaList schemaList) { if (null == schemaList) { throw new ArgumentNullException("schemaList"); } foreach (Schema schema in schemaList) { // There is a known drawback in BizTalk Server 2016 when there is no way to find // out an assembly name for pipeline from a pipeline component, so local schemas are // always retrieved by message type. if (null == schema.AssemblyName) { continue; } IDocumentSpec documentSpec = new DocumentSpec(schema.DocSpecName, schema.AssemblyName); schemaMap.Add(documentSpec.DocType, documentSpec); } }