<configuration>
<Persister>
<InfoPlat>
<add key="DbServer" value="SqlServer" />
<add key="ConnectionString" value="Persist Security Info=False;database=XFZDBdf;server=(local);user id=sa;pwd=;Connect Timeout=30"/>
<add key="AutoLoadLevel" value="2" />
</InfoPlat>
</configuration> string xpath = "//configuration/Persister/InfoPlat/add[key='ConnectionString']";
XmlNode node = doc.SelectSingleNode(xpath); 返回为空,为什么不对?
要把key = 'ConnectionString'的节点读出,如何写 xpath?
解决方案 »
- hadoopdotnet 和 qizmt 谁玩过?
- c#中,如何使shockwave的flash控件 播放改变了内容后的flash文件
- byte[] 相加问题
- 怎样让DataTable时的数据和对应的DataSet保持一致????
- 一个关于变量作用域的的问题
- 如何将excel数据取出来放在二维数组里面,进行处理后写人另一个excel文件?急
- 问关于 VC# 编译器的代码优化的问题,还有 VC# 做图象处理时性能怎么样。
- WEB窗体连接数据库问题
- udp问题
- 怎么在c# 中,在webform1中点击一个button,弹出webform2
- C# 怎么屏蔽winform 中的开始菜单和禁用拼音输入法?
- DataGridView控件选定多行删除的一个问题
<session-factory name="NHibernate.Test">
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">server=(local);database=XFZDB;uid=sa;pwd=</property>
<property name="show_sql">false</property>
<property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
<property name="use_outer_join">true</property>
<property name="command_timeout">444</property>
<property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
</session-factory>
</hibernate-configuration>这段中如何找出节点: <property name="connection.connection_string">server=(local);database=XFZDB;uid=sa;pwd=</property>
?????????????
试试,没有环境,不能帮你测了
doc.Load(Server.MapPath("x.xml"));
XmlNamespaceManager nm = new XmlNamespaceManager(doc.NameTable);
nm.AddNamespace("mxh", "urn:nhibernate-configuration-2.0");
string xpath = "/mxh:hibernate-configuration/mxh:session-factory/mxh:property[@name='connection.connection_string']";
XmlNode node = doc.SelectSingleNode(xpath,nm);
Response.Write(node.InnerText);
doc.Load(@"c:\x.xml");
XmlNamespaceManager nm = new XmlNamespaceManager(doc.NameTable);
nm.AddNamespace("mxh", "urn:nhibernate-configuration-2.0");
string xpath = "/mxh:hibernate-configuration/mxh:session-factory/mxh:property[@name='connection.connection_string']";
XmlNode node = doc.SelectSingleNode(xpath,nm);
MessageBox.Show(node.InnerText);