我有一个wsdl文档,其摘录如下所示......
<xs:complexType name="CustomerNameType">
<xs:annotation>
<xs:documentation>Structure for customer name</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="FullName" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Forenames" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="60"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)
我知道xs:element/@ name,我想得到最近的xs:documentation元素.
使用上面的示例,我知道xs:element/@ name ="FullName",我想从最近的xs:documentation节点获取文本"客户名称的结构"!
我已经尝试更改我在stackoverflow(和其他站点)上找到的一些示例,但它们都不起作用.典型:0).
干杯.
感谢您回答...希望这会有用......
public static string DecryptStupidCapsError(string sOriginalErrorMessage)
{
string sProblem = sOriginalErrorMessage.Substring(sOriginalErrorMessage.IndexOf("---> System.Xml.Schema.XmlSchemaException: ") + "---> System.Xml.Schema.XmlSchemaException: ".Length);
sProblem = sProblem.Substring(0, sProblem.IndexOf("An error occurred"));
string sElementName = sProblem.Substring(sProblem.IndexOf(":") + 1);
sElementName = sElementName.Substring(sElementName.IndexOf(":") + 1);
sElementName = sElementName.Substring(0, sElementName.IndexOf("'"));
XmlDocument …Run Code Online (Sandbox Code Playgroud)