由於某種原因,我今天早上有一個巨大的腦部放屁。XDocument閱讀MetaBase.xml
我無法從下面的代碼得到任何東西......它總是彈出0,並且永遠不會填充_Qry,即使_MBXml正確填寫(調試過程中盤旋顯示它)
_MetaBasePath += "IIS6-MetaBase.xml" '"metabase.xml"
_MBXml = XDocument.Load(_MetaBasePath, LoadOptions.PreserveWhitespace)
_Qry = (From n In _MBXml.<IIsWebServer>
Select New Typing.MetaBase() With {
.Binding = Common.IsNull(Of String)([email protected], String.Empty)
}).ToList()
MsgBox(_Qry.Count)
這裏是一個例如IIS 6 Metabase.xml文件的...
<?xml version ="1.0"?>
<configuration xmlns="urn:microsoft-catalog:XML_Metabase_V64_0">
<IIsWebServer Location ="/LM/W3SVC/1174460368"
AuthFlags="0"
SSLCertHash="8251cc2a9671150ac107aee3d78006b032f9bc36"
SSLStoreName="MY"
SecureBindings="184.106.185.111:443:"
ServerAutoStart="TRUE"
ServerBindings="184.106.185.111:80:beta.turbokits.com"
ServerComment="TurboKits Beta"
>
</IIsWebServer>
</configurarion>
也嘗試過...和.Elements(「IIsWebServer」) –
Kevin
2012-04-13 14:46:09