mustang
2007-09-24 13:18:00 UTC
I have created a custom receive pipeline component and I need to validate the
incoming message contents against the schema. Currently I use the pipeline
context property to obtain the schema. My code looks something like this:
private static System.Xml.Schema.XmlSchemaSet
GetSchemaSet(Microsoft.BizTalk.Component.Interop.IPipelineContext
pContext)
{
System.Xml.Schema.XmlSchemaSet schemaSet;
Microsoft.BizTalk.Component.Interop.IDocumentSpec docSpec;
System.Xml.Schema.XmlSchemaCollection schemaCollection;
try {
docSpec = pContext.GetDocumentSpecByType(DOC_SPEC_TYPE);
schemaCollection = docSpec.GetSchemaCollection();
if (schemaCollection.Count > 0) {
schemaSet = new System.Xml.Schema.XmlSchemaSet();
foreach (System.Xml.Schema.XmlSchema schema in schemaCollection) {
schemaSet.Add(schema);
}
}
}
catch { /* If any errors occur, just return a null SchemaSet */ }
return schemaSet;
}
According to Microsoft's documentation, XmlSchemaCollection is an obsolete
class, yet this is the return type for IDocumentSpec.GetSchemaCollection. Am
I handling this the wrong way, or is there another way I could be loading the
schemas into a XmlSchemaSet collection?
Thanks in advance.
-mustang
incoming message contents against the schema. Currently I use the pipeline
context property to obtain the schema. My code looks something like this:
private static System.Xml.Schema.XmlSchemaSet
GetSchemaSet(Microsoft.BizTalk.Component.Interop.IPipelineContext
pContext)
{
System.Xml.Schema.XmlSchemaSet schemaSet;
Microsoft.BizTalk.Component.Interop.IDocumentSpec docSpec;
System.Xml.Schema.XmlSchemaCollection schemaCollection;
try {
docSpec = pContext.GetDocumentSpecByType(DOC_SPEC_TYPE);
schemaCollection = docSpec.GetSchemaCollection();
if (schemaCollection.Count > 0) {
schemaSet = new System.Xml.Schema.XmlSchemaSet();
foreach (System.Xml.Schema.XmlSchema schema in schemaCollection) {
schemaSet.Add(schema);
}
}
}
catch { /* If any errors occur, just return a null SchemaSet */ }
return schemaSet;
}
According to Microsoft's documentation, XmlSchemaCollection is an obsolete
class, yet this is the return type for IDocumentSpec.GetSchemaCollection. Am
I handling this the wrong way, or is there another way I could be loading the
schemas into a XmlSchemaSet collection?
Thanks in advance.
-mustang