由于保护级别而变得不可访问
我正在写一个VB.Net
Private Function generateXMLSchema()
Dim generatedXmlSchema As String = "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:glob="http://sap.com/xi/SAPGlobal20/Global"><soapenv:Header/>" & _
"<soapenv:Body>" & _
"<glob:RouteBundleMaintainRequest_sync_V1>" & _
"<Route actionCode="01">" & _
"<Name>tEST 250502</Name>" & _
"<RouteTypeCode>2</RouteTypeCode>" & _
"</Route>" & _
"</glob:RouteBundleMaintainRequest_sync_V1>" & _
"</soapenv:Body>" & _
"</soapenv:Envelope>"
Return generatedXmlSchema
End Function
在Return generatedXmlSchema
我收到错误: generatedXmlSchema未声明。 由于保护级别,它可能无法访问
有人可以告诉我这个问题吗?
用双引号更新,仍然是同样的错误
Private Function generateXMLSchema()
Dim genXmlSchema As String = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:glob=""http://sap.com/xi/SAPGlobal20/Global"><soapenv:Header/>" & _
"<soapenv:Body>" & _
"<glob:RouteBundleMaintainRequest_sync_V1>" & _
"<Route actionCode="01">" & _
"<Name>tEST 250502</Name>" & _
"<RouteTypeCode>2</RouteTypeCode>" & _
"</Route>" & _
"</glob:RouteBundleMaintainRequest_sync_V1>" & _
"</soapenv:Body>" & _
"</soapenv:Envelope>"
Return genXmlSchema
End Function
您必须将每个引号出现的双引号作为字符串分隔符来使用:
"http://schemas.xmlsoap.org/soap/envelope/" -> ""http://schemas.xmlsoap.org/soap/envelope/""
"http://sap.com/xi/SAPGlobal20/Global" -> ""http://sap.com/xi/SAPGlobal20/Global""
"01" -> ""01""
说,这个函数是Private
所以它必须在它属于同一个Class
调用
以上所有内容都倾倒在下面:
Public Class Class1
Sub main()
Console.WriteLine(generateXMLSchema())
End Sub
Private Function generateXMLSchema()
Dim generatedXmlSchema As String = "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:glob=""http://sap.com/xi/SAPGlobal20/Global""><soapenv:Header/>" &
"<soapenv:Body>" &
"<glob:RouteBundleMaintainRequest_sync_V1>" &
"<Route actionCode=""01"">" &
"<Name>tEST 250502</Name>" &
"<RouteTypeCode>2</RouteTypeCode>" &
"</Route>" &
"</glob:RouteBundleMaintainRequest_sync_V1>" &
"</soapenv:Body>" &
"</soapenv:Envelope>"
Return generatedXmlSchema
End Function
End Class
链接地址: http://www.djcxy.com/p/65219.html
上一篇: Variable inaccessible due to protection level
下一篇: * is not declared. It may be inaccessible due to its protection level