internal static DcElement Parse(XPathNavigator navigator) { DcElement element = new DcElement(); XPathNavigator nav = navigator.Clone(); // select the element itself XPathNodeIterator iter = nav.SelectDescendants(XPathNodeType.Element, true); while (iter.MoveNext()) { string name = iter.Current.Name; int idx = name.IndexOf(":"); if (idx != -1) { name = name.Split(new char[] { ':' }, 2)[1]; } try { element.XmlLang = Utils.Utils.ParseLanguage(iter.Current.XmlLang); } catch {} element.LocalName = name; element.Content = iter.Current.Value; } return(element); }
internal static DcElement Parse(XPathNavigator navigator, Uri ns) { DcElement element = new DcElement(ns); XPathNavigator nav = navigator.Clone(); // select the element itself XPathNodeIterator iter = nav.SelectDescendants(XPathNodeType.Element, true); while (iter.MoveNext()) { string name = iter.Current.Name.ToLower(); int idx = name.IndexOf(":"); if (idx != -1) { name = name.Split(new char[] { ':' }, 2)[1]; } switch (name) { case "title": case "creator": case "subject": case "description": case "publisher": case "contributor": case "date": case "type": case "format": case "identifier": case "source": case "language": case "relation": case "coverage": case "rights": try { element.XmlLang = Utils.Utils.ParseLanguage(iter.Current.XmlLang); } catch {} element.LocalName = name; element.Content = iter.Current.Value; break; } } return(element); }
internal static DcElement Parse(XPathNavigator navigator, Uri ns) { DcElement element = new DcElement(ns); XPathNavigator nav = navigator.Clone(); // select the element itself XPathNodeIterator iter = nav.SelectDescendants(XPathNodeType.Element, true); while(iter.MoveNext()) { string name = iter.Current.Name.ToLower(); int idx = name.IndexOf(":"); if(idx != -1) name = name.Split(new char[] {':'}, 2)[1]; switch(name) { case "title": case "creator": case "subject": case "description": case "publisher": case "contributor": case "date": case "type": case "format": case "identifier": case "source": case "language": case "relation": case "coverage": case "rights": try { element.XmlLang = Utils.Utils.ParseLanguage(iter.Current.XmlLang); } catch {} element.LocalName = name; element.Content = iter.Current.Value; break; } } return element; }