Inheritance: System.Xml.XmlWriter
Exemplo n.º 1
0
		public XPathNavigator CreateNavigator (int node_quota, XmlSpace space)
		{
			if (nav_cache == null) {
				DTMXPathDocumentWriter2 pw = new DTMXPathDocumentWriter2 (new NameTable (), node_quota);
				XmlDictionaryWriter w = XmlDictionaryWriter.CreateDictionaryWriter (pw);
				CreateMessage ().WriteMessage (w);
				nav_cache = pw.CreateDocument ().CreateNavigator ();
			}
			return nav_cache.Clone ();
		}
Exemplo n.º 2
0
		public object Evaluate (XslTransformProcessor p)
		{
			if (select != null) {
				object o = p.Evaluate (select);
				// To resolve variable references correctly, we
				// have to collect all the target nodes here.
				// (otherwise, variables might be resolved with
				// different level of variable stack in
				// XslTransformProcessor).
				if (o is XPathNodeIterator) {
					ArrayList al = new ArrayList ();
					XPathNodeIterator iter = (XPathNodeIterator) o;
					while (iter.MoveNext ())
						al.Add (iter.Current.Clone ());
					o = new ListIterator (al, p.XPathContext);
				}
				return o;
			} else if (content != null) {
				DTMXPathDocumentWriter2 w = new DTMXPathDocumentWriter2 (p.Root.NameTable, 200);
				Outputter outputter = new GenericOutputter(w, p.Outputs, null, true);
				p.PushOutput (outputter);
				if (p.CurrentNodeset.CurrentPosition == 0)
					p.NodesetMoveNext ();
				content.Evaluate (p);
				p.PopOutput ();
				return w.CreateDocument ().CreateNavigator ();
			} else {
				return "";
			}
		}
Exemplo n.º 3
0
		public override object Evaluate (BaseIterator iter)
		{
			XsltCompiledContext ctx = iter.NamespaceManager as XsltCompiledContext;
			XPathNavigator loc = iter.Current != null ? iter.Current.Clone () : null;
			object val = arg0.Evaluate (iter);

			XPathNavigator nav = val as XPathNavigator;
			if (nav == null && !strict) {
				var iterResult = val as XPathNodeIterator;
				if (iterResult != null)
					return iterResult;

				var strResult = val as string;
				if (strResult == string.Empty) {
					DTMXPathDocumentWriter2 w = new DTMXPathDocumentWriter2 (ctx.Processor.Root.NameTable, 10);
					nav = w.CreateDocument ().CreateNavigator ();
				}
			}

			if (nav == null) {
				if (loc != null)
					return new XsltException ("Cannot convert the XPath argument to a result tree fragment.", null, loc);
				else
					return new XsltException ("Cannot convert the XPath argument to a result tree fragment.", null);
			}

			ArrayList al = new ArrayList ();
			al.Add (nav);
			return new ListIterator (al, ctx);
		}