public SelectNodesNS ( [ xpath, [ namespaces ) : XmlNodeList | ||
xpath | [ | |
namespaces | [ | |
return | XmlNodeList |
private void RemoveNodes(string localName, Namespace ns) { ArrayList nodes = new ArrayList(); foreach (XmlNode n in _entryNode.SelectNodesNS("./" + ns.Prefix + ":" + localName, _nsMgr.ToNSMethodFormat())) { nodes.Add(n); } for (int i = 0; i < nodes.Count; i++) { XmlNode n = (XmlNode)nodes[i]; n.ParentNode.RemoveChild(n); } }
public override BlogPostCategory[] ExtractCategories(XmlElement entry, string categoryScheme, Uri documentUri) { XmlNamespaceManager nsMgr = new XmlNamespaceManager(new NameTable()); nsMgr.AddNamespace("dc", DC_URI); ArrayList results = new ArrayList(); foreach (XmlElement el in entry.SelectNodesNS("dc:subject", nsMgr.ToNSMethodFormat())) { string subject = el.InnerText; if (subject != string.Empty) { results.Add(new BlogPostCategory(subject, subject)); } } return((BlogPostCategory[])results.ToArray(typeof(BlogPostCategory))); }
public override BlogPostCategory[] ExtractCategories(XmlElement entry, string categoryScheme, Uri documentUri) { if (categoryScheme == null) { return(new BlogPostCategory[0]); } XmlNamespaceManager nsMgr = new XmlNamespaceManager(new NameTable()); nsMgr.AddNamespace("atom", NamespaceUri); ArrayList results = new ArrayList(); foreach (XmlElement el in entry.SelectNodesNS("atom:category", nsMgr.ToNSMethodFormat())) { if (!SchemesEqual(el.GetAttribute("scheme"), categoryScheme)) { continue; } string term = el.GetAttribute("term"); string label = el.GetAttribute("label"); bool noTerm = term == null || term == string.Empty; bool noLabel = label == null || label == string.Empty; if (noTerm && noLabel) { continue; } if (noTerm) { term = label; } if (noLabel) { label = term; } results.Add(new BlogPostCategory(term, label)); } return((BlogPostCategory[])results.ToArray(typeof(BlogPostCategory))); }
private static XmlNodeList GetNodes(XmlElement xml, string xpath) { var ns = new PropertySet { {"root", "http://www.w3.org/2005/Atom"}, {"media", "http://search.yahoo.com/mrss/"}, {"openSearch", "http://a9.com/-/spec/opensearchrss/1.0/"}, //"http://a9.com/-/spec/opensearch/1.1/"}, //http://a9.com/-/spec/opensearchrss/1.0/ {"gd", "http://schemas.google.com/g/2005"}, {"yt", "http://gdata.youtube.com/schemas/2007"} }; return xml.SelectNodesNS(xpath, ns); }