/// <summary> /// 得到节点属性 /// </summary> /// <param name="path"></param> /// <param name="attrName"></param> /// <returns></returns> private string GetXmlAttr(string path, string attrName) { SuperMesServer.Xml.ReadXml readXml = new SuperMesServer.Xml.ReadXml(); string attrValue = readXml.ReadAttrFromFile("dbconnect.xml", path, attrName); return(attrValue); }
/// <summary> /// 得到某个节点下指定子节点属性值 /// </summary> /// <param name="path"></param> /// <param name="attrName"></param> /// <returns></returns> private string GetXmlNodeAndAttr(string path, string nodeAttr, string nodeValue, string nodeName, string attrName) { SuperMesServer.Xml.ReadXml readXml = new SuperMesServer.Xml.ReadXml(); XmlNodeList nodeList = readXml.ReadNodeListFromFile("dbconnect.xml", path); XmlNode node = readXml.ReadNodeFromNodeListByNodeAttr(nodeList, nodeAttr, nodeValue); XmlNodeList listChild = readXml.ReadNodeListFromNode(node); XmlNode nodeChild = readXml.ReadNodeFromNodeListByNodeName(listChild, nodeName); return(readXml.ReadAttrFromNode(nodeChild, attrName)); }
public static ConnectDB GetProduct() { SuperMesServer.Xml.ReadXml readXml = new SuperMesServer.Xml.ReadXml(); string attrValue = readXml.ReadAttrFromFile("dbconnect.xml", "dbconn", "dbtype"); if (sqlServerType.Equals(attrValue)) { return(new ConnectSqlServer()); } else { return(new ConnectOracle()); } }