在c#XmlSchema中查找schemaLocation
我已将以下架构加载到xmlSchema中:在c#XmlSchema中查找schemaLocation,c#,xsd,C#,Xsd,我已将以下架构加载到xmlSchema中: ... <xs:import schemaLocation="\_1.xsd" namespace="http://tempuri.org/" /> ... 。。。 ... 我想检索字符串“_1.xsd” 如何从XMLSchemaAPI获得schemaLocation值? schemaSet会更好吗 谢谢 这应该可以工作,可能会抛出一些错误,因为我没有在IDE中编译它,因为我不是在开发机器atm上 string xsd = "examp
...
<xs:import schemaLocation="\_1.xsd" namespace="http://tempuri.org/" />
...
。。。
...
我想检索字符串“_1.xsd”
如何从XMLSchemaAPI获得schemaLocation值?
schemaSet会更好吗
谢谢
这应该可以工作,可能会抛出一些错误,因为我没有在IDE中编译它,因为我不是在开发机器atm上
string xsd = "example.xsd";
FileStream fs;
XmlSchema schema;
fs = new FileStream(xsd, FileMode.Open);
schema = XmlSchema.Read(fs, new ValidationEventHandler(ShowCompileError));
foreach (XmlSchemaObject externalSchema in schema.Includes)
{
string schemaLoc = (XmlSchemaExternal)externalSchema.SchemaLocation.ToString();
}
这应该可以工作,可能会抛出一些错误,因为我没有在IDE中编译它,因为我不是在开发机器atm上
string xsd = "example.xsd";
FileStream fs;
XmlSchema schema;
fs = new FileStream(xsd, FileMode.Open);
schema = XmlSchema.Read(fs, new ValidationEventHandler(ShowCompileError));
foreach (XmlSchemaObject externalSchema in schema.Includes)
{
string schemaLoc = (XmlSchemaExternal)externalSchema.SchemaLocation.ToString();
}
我最后用了这个:
schema.Includes[0] as XmlSchemaImport;
var wsdlId = schemaImport.SchemaLocation;
我最后用了这个:
schema.Includes[0] as XmlSchemaImport;
var wsdlId = schemaImport.SchemaLocation;