我已經使用System.Xml.Linq;
來匹配來自xml文檔的Xpath。 XElement
和SaveOptions
均得自System.Xml.Linq;
。System.Xml.Linq的替代方案與Xpath匹配
XmlNamespaceManager nsmgr = new XmlNamespaceManager(new NameTable());
nsmgr.AddNamespace("ns", "http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-02-03T16:54:46");
XElement docRfsid = XElement.Parse(content);
//if (docRfsid.XPathSelectElement("//ns:RFSID", nsmgr).Value != null)
if (Regex.Match(docRfsid.ToString(), "RFSID", RegexOptions.IgnoreCase).Success)
{
projData.RfsId = docRfsid.XPathSelectElement("//ns:RFSID", nsmgr).Value.ToString();
}
XElement doc_Financial = XElement.Parse(content);
string resultFinancial = doc_Financial.XPathSelectElement("//ns:Financial", nsmgr).ToString(SaveOptions.DisableFormatting);
我只是想刪除System.Xml.Linq;
DLL,因爲我只使用.NET框架2.0。 有沒有其他的選擇,我可以使用System.Xml.Linq;
。