XML Utility
来源:互联网 发布:什么是淘宝长尾词 编辑:程序博客网 时间:2024/05/14 20:36
public class XmlUtility
{
private XDocument doc = null;
public XmlUtility(string path)
{
doc = XDocument.Load(path);
}
/// <summary>
/// Get the content of a specified element
/// </summary>
/// <param name="elementName">element name</param>
/// <returns>element content</returns>
public string GetElementContent(string elementName)
{
IEnumerable<XElement> query = doc.Descendants(elementName);
return query.First<XElement>().Value.Trim();
}
/// <summary>
/// Get the content of an element whose attribute has a specified value
/// </summary>
/// <param name="elementName">element name</param>
/// <param name="attributeName">attribute name</param>
/// <param name="attributeValue">attribute value</param>
/// <returns>the element content</returns>
public string GetAttributedElementContent(
string elementName, string attributeName, string attributeValue)
{
IEnumerable<XElement> query = doc.Descendants(elementName).Where(
r => string.Equals(r.Attribute(attributeName).Value, attributeValue,
StringComparison.InvariantCultureIgnoreCase));
return query.First<XElement>().Value.Trim();
}
}
- XML Utility
- scala.xml.Utility 代码实例
- utility
- Oracle9中XML SQL Utility技术
- XDB: Utility package to change the HTTP and FTP ports used by XML DB
- XDB: Utility package to change the HTTP and FTP ports used by XML DB.
- Utility Classes
- common utility
- mtd utility
- boost::utility
- utility pipes
- Utility WebSite
- MD5 Utility
- utility.c
- disk utility
- Utility Objects
- boost utility
- DirectShow Utility
- 昨天jlink不能用了
- A progress bar (gauge box) -- dialog Linux
- Hibernate 一对多外键双向关联
- Collection
- Hibernate 一对多连接表双向关联
- XML Utility
- MHDD使用方法以及图文教程(简洁教程)
- Hibernate 多对多双向关联
- 1.写student类中的select,delete,update,insert方法并在objectDataSource中应用(分别写两个,一个返回datatable,一个使用list)
- <5>c语言实现ATM存取款系统(文件、排序)
- Struts2直接跳转到web.xml里的默认路径
- why C++ [Herb Sutter] ~路人的评论
- 写student类中的select,delete,update,insert方法并在objectDataSource中应用(分别写两个,一个返回datatable,一个使用list)
- GNU内嵌汇编资料