因为做 windows CE 开发 ,想做个类似于 configuration 类来读取配置文件,用xmlreader 来读取节点和属性,
但现在只会读取节点,请问怎么读取属性。
但现在只会读取节点,请问怎么读取属性。
解决方案 »
- 请教高手datatable循环写入数据库的事务操作
- 值类型转换把我给搞混了。。
- msmq 如何设置超时时间?
- 在C#下调用API函数CopyMemory,自定义结构拷贝到byte数组好使,反过来把byte数组内容拷贝到结构体就不好用了.请高手指点?
- 使用ResourceManager怎么解决DataGridView的HeaderText多语言的问题,一绑定DataTable,HeaderText默认是字段名.
- 请问各位高手,如何能够给MessageBox添加背景图片?这样是否可行?
- 重定向 URI 不能包含换行符
- webform中怎样将数据库中的图现image控件绑定?
- 使用Microsoft C#编程实现一个ActiveX插件用于上传/预览功能
- 请问如何使用.net开发支持Windows DPI缩放的应用程序
- 用线程查询数据库时,大家的SqlConnection是怎么处理的?
- GDI+ 保存文件问题
if (reader.HasAttributes) {
Console.WriteLine("Attributes of <" + reader.Name + ">");
for (int i = 0; i < reader.AttributeCount; i++) {
Console.WriteLine(" {0}", reader[i]);
}
// Move the reader back to the element node.
reader.MoveToElement();
}以下示例在 While 循环中使用 MoveToNextAttribute 属性读取某个元素的所有属性
if (reader.HasAttributes) {
Console.WriteLine("Attributes of <" + reader.Name + ">");
while (reader.MoveToNextAttribute()) {
Console.WriteLine(" {0}={1}", reader.Name, reader.Value);
}
// Move the reader back to the element node.
reader.MoveToElement();
}
reader.ReadToFollowing("book");
string isbn = reader.GetAttribute("ISBN");
Console.WriteLine("The ISBN value: " + isbn);
{
while (tr.Read()){
if (tr.NodeType == XmlNodeType.Element){
for (int i = 0; i < tr.AttributeCount; i++){
richTextBox1.AppendText(tr.GetAttribute(i)+"\r\n");
}
}
}
{
while (reader .Read()){
if (reader.NodeType == XmlNodeType.Element){
for (int i = 0; i < reader.AttributeCount; i++){
str+=reader.GetAttribute(i)+"\r\n");
}
}
}