Пример #1
0
			string MonoImpInfo(string assemblyname, string typename, string membername, XPathNodeIterator itr, bool strlong)
			{
				if (quiet)
					return string.Empty;
				
				var rgs = itr.Cast<XPathNavigator> ().Select (nav => nav.Value).ToList ();
			
				return MonoImpInfo (assemblyname, typename, membername, rgs, strlong);
			}
Пример #2
0
        protected XPathNavigator[] distinct_values(XPathNodeIterator iter)
        {
            // fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType*

             XPathNavigator[] nodes = iter.Cast<XPathNavigator>().ToArray();
             var distinct = new Dictionary<object, XPathNavigator>();

             foreach (object item in nodes.Select(n => n.TypedValue).Distinct()) {

            if (!distinct.ContainsKey(item)) {
               distinct.Add(item, nodes.First(n => n.TypedValue.Equals(item)));
            }
             }

             return distinct.Values.ToArray();
        }
Пример #3
0
        public XPathNavigator[] subsequence(XPathNodeIterator sourceSeq, int startingLoc, int length)
        {
            // fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()*

             return sourceSeq.Cast<XPathNavigator>().Skip(startingLoc).Take(length).ToArray();
        }
Пример #4
0
        public XPathNavigator[] tail(XPathNodeIterator iter)
        {
            // fn:tail($arg as item()*) as item()*

             return iter.Cast<XPathNavigator>().Skip(1).ToArray();
        }
Пример #5
0
        public string serialize(XPathNodeIterator arg, XPathNodeIterator parameters)
        {
            // fn:serialize($arg	as item()*, $params as element(output:serialization-parameters)?) as xs:string

             var itemFactory = new SystemItemFactory();

             XPathSerializationOptions options = null;

             if (parameters != null
            && parameters.Count == 1) {

            options = new XPathSerializationOptions();
            ((IXmlSerializable)options).ReadXml(parameters.Cast<XPathNavigator>().First().ReadSubtree());
             }

             using (var writer = new StringWriter()) {

            IEnumerable<XPathItem> items = arg.Cast<XPathItem>();

            if (options == null) {
               itemFactory.Serialize(items, writer);
            } else {
               itemFactory.Serialize(items, writer, options);
            }

            return writer.ToString();
             }
        }