private string getInterface( XmlDocument xml, string name, out string defaultNameSpace, out string modelXml )
{
defaultNameSpace = null;
var nsmgr = new XmlNamespaceManager( xml.NameTable );
nsmgr.AddNamespace( "tsf", ATMLContext.NS_STDTSF );
nsmgr.AddNamespace( "std", ATMLContext.NS_STDBSC );
nsmgr.AddNamespace("std1", ATMLContext.NS_STDBSC);
nsmgr.AddNamespace("this", ATMLContext.NS_STDBSC);
nsmgr.AddNamespace( "xs", ATMLContext.NS_XS );
nsmgr.AddNamespace( "xsi", ATMLContext.NS_XSI );
XmlNode node = xml.SelectSingleNode( "descendant::tsf:TSF[@name='" + name + "']", nsmgr );
if (node == null)
throw new Exception( "Failed to find TSF name \"" + name + "\" in the supplied TSF Library File" );
XmlNode interfaceNode = node.SelectSingleNode( "tsf:interface", nsmgr );
XmlNode modelNode = node.SelectSingleNode( "tsf:model", nsmgr );
if (interfaceNode == null)
throw new Exception( "Failed to find the interface schema for TSF name \"" + name +
"\" in the supplied TSF Library File" );
if (modelNode == null)
throw new Exception( "Failed to find the model schema for TSF name \"" + name +
"\" in the supplied TSF Library File" );
if (node.Attributes != null && node.Attributes.GetNamedItem( XMLNS ) != null)
defaultNameSpace = node.Attributes.GetNamedItem( XMLNS ).Value;
modelXml = modelNode.InnerXml;
return interfaceNode.InnerXml;
}