自己正在做电信的互联星空项目,里面用到的xml

自己正在做电信的互联星空项目,里面用到xml,封装一个xml节点读取器(我没有找到类似的,如果有我只好抱歉了)
//----------------------------------------------------------------
// Copyright (C) 2003-2005 ZTE Corporation
// 版权所有
//
// 系统名称:互联星空
// 子系统名称:***********
// 模块名称:XmlReader
// 描述:读取,按条件查询xml文件   
// 
// 作者:大步牛^_^
// 创建日期:[05/24/2005]
// 版本:0.5
//----------------------------------------------------------------
using System;
using System.Xml;

namespace Arthur.XmlReader
{
 
/// <summary>
 
/// XmlReadHeleper 的摘要说明。
 
/// </summary>

 public class XmlReadHeleper
 
{
  
public static XmlDocument doc;
  
public XmlReadHeleper()
  
{
   
//
   
// TODO: 在此处添加构造函数逻辑
   
//
   if ( doc == null )
   
{
    doc 
= new XmlDocument();
    doc.Load( 
@"C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\VNETResAdminProjGroup\VNETResAdminInterfaceRemotingImplClass\WebServiceInfoConfig.xml");
    
//    doc.Load( System.Web.HttpContext.Current.Server.MapPath("WebServiceInfoConfig.xml"));
   }

  }

  
/// <summary>
  
/// 查询所有的XML节点
  
/// </summary>
  
/// <returns></returns>

  public XmlNodeList ReadAllXml( )
  
{
   XmlNodeList xmlNodeList 
= doc.SelectNodes("/WebService/Node");
   
return xmlNodeList;
  }

  
/// <summary>
  
/// 根据所有属性查询单个的XML节点
  
/// </summary>
  
/// <param name="findParameter"></param>
  
/// <returns></returns>

  public XmlNode FindSingleXml( object[] findParameter )
  
{
   XmlNode xmlNode 
= doc.SelectSingleNode("/WebService/Node[@FullName='" + findParameter[0].ToString() + 
    
"' and @Url='" + findParameter[1].ToString() + 
    
"' and @MethodName='" + findParameter[2].ToString() + "']");
   
return xmlNode;
  }

  
/// <summary>
  
/// 根据id属性查询单个的XML节点
  
/// </summary>
  
/// <param name="id"></param>
  
/// <returns></returns>

  public XmlNode FindSingleXml( string id )
  
{
   XmlNode xmlNode 
= doc.SelectSingleNode("/WebService/Node[@id='" + id +"']");
   
return xmlNode;
  }

 
 }



posted on 2005-06-30 18:18  Arthur_wuancheng(大步牛)  阅读(527)  评论(0编辑  收藏  举报